Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: runtime/vm/service_test.cc

Issue 2968003004: Revert "The current growth strategy for growable arrays allocates a backing array of size 2 at (emp… (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_tools_api.h" 7 #include "include/dart_tools_api.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 }; 73 };
74 74
75 75
76 static RawArray* Eval(Dart_Handle lib, const char* expr) { 76 static RawArray* Eval(Dart_Handle lib, const char* expr) {
77 const String& dummy_isolate_id = String::Handle(String::New("isolateId")); 77 const String& dummy_isolate_id = String::Handle(String::New("isolateId"));
78 Dart_Handle expr_val = Dart_EvaluateExpr(lib, NewString(expr)); 78 Dart_Handle expr_val = Dart_EvaluateExpr(lib, NewString(expr));
79 EXPECT_VALID(expr_val); 79 EXPECT_VALID(expr_val);
80 Zone* zone = Thread::Current()->zone(); 80 Zone* zone = Thread::Current()->zone();
81 const GrowableObjectArray& value = 81 const GrowableObjectArray& value =
82 Api::UnwrapGrowableObjectArrayHandle(zone, expr_val); 82 Api::UnwrapGrowableObjectArrayHandle(zone, expr_val);
83 const Array& result = Array::Handle(Array::MakeFixedLength(value)); 83 const Array& result = Array::Handle(Array::MakeArray(value));
84 GrowableObjectArray& growable = GrowableObjectArray::Handle(); 84 GrowableObjectArray& growable = GrowableObjectArray::Handle();
85 growable ^= result.At(4); 85 growable ^= result.At(4);
86 // Append dummy isolate id to parameter values. 86 // Append dummy isolate id to parameter values.
87 growable.Add(dummy_isolate_id); 87 growable.Add(dummy_isolate_id);
88 Array& array = Array::Handle(Array::MakeFixedLength(growable)); 88 Array& array = Array::Handle(Array::MakeArray(growable));
89 result.SetAt(4, array); 89 result.SetAt(4, array);
90 growable ^= result.At(5); 90 growable ^= result.At(5);
91 // Append dummy isolate id to parameter values. 91 // Append dummy isolate id to parameter values.
92 growable.Add(dummy_isolate_id); 92 growable.Add(dummy_isolate_id);
93 array = Array::MakeFixedLength(growable); 93 array = Array::MakeArray(growable);
94 result.SetAt(5, array); 94 result.SetAt(5, array);
95 return result.raw(); 95 return result.raw();
96 } 96 }
97 97
98 98
99 static RawArray* EvalF(Dart_Handle lib, const char* fmt, ...) { 99 static RawArray* EvalF(Dart_Handle lib, const char* fmt, ...) {
100 va_list args; 100 va_list args;
101 va_start(args, fmt); 101 va_start(args, fmt);
102 intptr_t len = OS::VSNPrint(NULL, 0, fmt, args); 102 intptr_t len = OS::VSNPrint(NULL, 0, fmt, args);
103 va_end(args); 103 va_end(args);
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage()); 789 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
790 // Expect error. 790 // Expect error.
791 EXPECT_SUBSTRING("\"error\"", handler.msg()); 791 EXPECT_SUBSTRING("\"error\"", handler.msg());
792 } 792 }
793 793
794 #endif // !defined(TARGET_ARCH_ARM64) 794 #endif // !defined(TARGET_ARCH_ARM64)
795 795
796 #endif // !PRODUCT 796 #endif // !PRODUCT
797 797
798 } // namespace dart 798 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698