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

Side by Side Diff: runtime/vm/mirrors_api_impl.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/method_recognizer.h ('k') | runtime/vm/object.h » ('j') | 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 "include/dart_mirrors_api.h" 5 #include "include/dart_mirrors_api.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (obj.IsFunction()) { 117 if (obj.IsFunction()) {
118 func ^= obj.raw(); 118 func ^= obj.raw();
119 name = func.UserVisibleName(); 119 name = func.UserVisibleName();
120 names.Add(name); 120 names.Add(name);
121 } 121 }
122 } 122 }
123 } else { 123 } else {
124 return Api::NewError( 124 return Api::NewError(
125 "%s expects argument 'target' to be a class or library.", CURRENT_FUNC); 125 "%s expects argument 'target' to be a class or library.", CURRENT_FUNC);
126 } 126 }
127 return Api::NewHandle(T, Array::MakeFixedLength(names)); 127 return Api::NewHandle(T, Array::MakeArray(names));
128 } 128 }
129 129
130 130
131 DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target, 131 DART_EXPORT Dart_Handle Dart_LookupFunction(Dart_Handle target,
132 Dart_Handle function_name) { 132 Dart_Handle function_name) {
133 DARTSCOPE(Thread::Current()); 133 DARTSCOPE(Thread::Current());
134 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target)); 134 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target));
135 if (obj.IsError()) { 135 if (obj.IsError()) {
136 return target; 136 return target;
137 } 137 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 const GrowableObjectArray& names = 329 const GrowableObjectArray& names =
330 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); 330 GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
331 ClassDictionaryIterator it(lib); 331 ClassDictionaryIterator it(lib);
332 Class& cls = Class::Handle(Z); 332 Class& cls = Class::Handle(Z);
333 String& name = String::Handle(Z); 333 String& name = String::Handle(Z);
334 while (it.HasNext()) { 334 while (it.HasNext()) {
335 cls = it.GetNextClass(); 335 cls = it.GetNextClass();
336 name = cls.UserVisibleName(); 336 name = cls.UserVisibleName();
337 names.Add(name); 337 names.Add(name);
338 } 338 }
339 return Api::NewHandle(T, Array::MakeFixedLength(names)); 339 return Api::NewHandle(T, Array::MakeArray(names));
340 } 340 }
341 341
342 342
343 // --- Closures Reflection --- 343 // --- Closures Reflection ---
344 344
345 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) { 345 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) {
346 DARTSCOPE(Thread::Current()); 346 DARTSCOPE(Thread::Current());
347 const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure); 347 const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure);
348 if (closure_obj.IsNull() || !closure_obj.IsClosure()) { 348 if (closure_obj.IsNull() || !closure_obj.IsClosure()) {
349 RETURN_TYPE_ERROR(Z, closure, Instance); 349 RETURN_TYPE_ERROR(Z, closure, Instance);
350 } 350 }
351 351
352 ASSERT(ClassFinalizer::AllClassesFinalized()); 352 ASSERT(ClassFinalizer::AllClassesFinalized());
353 353
354 RawFunction* rf = Closure::Cast(closure_obj).function(); 354 RawFunction* rf = Closure::Cast(closure_obj).function();
355 return Api::NewHandle(T, rf); 355 return Api::NewHandle(T, rf);
356 } 356 }
357 357
358 } // namespace dart 358 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698