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

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

Issue 1310463005: - Ensure that HandleScope is initialized with a thread. (Remove (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 years, 3 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/metrics_test.cc ('k') | runtime/vm/native_api_impl.cc » ('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"
11 #include "vm/dart_api_state.h" 11 #include "vm/dart_api_state.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/exceptions.h" 13 #include "vm/exceptions.h"
14 #include "vm/growable_array.h" 14 #include "vm/growable_array.h"
15 #include "vm/object.h" 15 #include "vm/object.h"
16 #include "vm/resolver.h" 16 #include "vm/resolver.h"
17 #include "vm/stack_frame.h" 17 #include "vm/stack_frame.h"
18 #include "vm/symbols.h" 18 #include "vm/symbols.h"
19 19
20 namespace dart { 20 namespace dart {
21 21
22 // Facilitate quick access to the current zone once we have the curren thread.
23 #define Z (T->zone())
24
22 25
23 // --- Classes and Interfaces Reflection --- 26 // --- Classes and Interfaces Reflection ---
24 27
25 DART_EXPORT Dart_Handle Dart_TypeName(Dart_Handle object) { 28 DART_EXPORT Dart_Handle Dart_TypeName(Dart_Handle object) {
26 Isolate* isolate = Isolate::Current(); 29 DARTSCOPE(Thread::Current());
27 DARTSCOPE(isolate); 30 const Object& obj = Object::Handle(I, Api::UnwrapHandle(object));
28 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
29 if (obj.IsType()) { 31 if (obj.IsType()) {
30 const Class& cls = Class::Handle(Type::Cast(obj).type_class()); 32 const Class& cls = Class::Handle(Type::Cast(obj).type_class());
31 return Api::NewHandle(isolate, cls.UserVisibleName()); 33 return Api::NewHandle(I, cls.UserVisibleName());
32 } else { 34 } else {
33 RETURN_TYPE_ERROR(isolate, object, Class/Type); 35 RETURN_TYPE_ERROR(I, object, Class/Type);
34 } 36 }
35 } 37 }
36 38
37 39
38 DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) { 40 DART_EXPORT Dart_Handle Dart_QualifiedTypeName(Dart_Handle object) {
39 Isolate* isolate = Isolate::Current(); 41 DARTSCOPE(Thread::Current());
40 DARTSCOPE(isolate); 42 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
41 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
42 if (obj.IsType() || obj.IsClass()) { 43 if (obj.IsType() || obj.IsClass()) {
43 const Class& cls = (obj.IsType()) ? 44 const Class& cls = (obj.IsType()) ?
44 Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj); 45 Class::Handle(Z, Type::Cast(obj).type_class()) : Class::Cast(obj);
45 const char* str = cls.ToCString(); 46 const char* str = cls.ToCString();
46 if (str == NULL) { 47 if (str == NULL) {
47 RETURN_NULL_ERROR(str); 48 RETURN_NULL_ERROR(str);
48 } 49 }
49 CHECK_CALLBACK_STATE(isolate); 50 CHECK_CALLBACK_STATE(I);
50 return Api::NewHandle(isolate, String::New(str)); 51 return Api::NewHandle(I, String::New(str));
51 } else { 52 } else {
52 RETURN_TYPE_ERROR(isolate, object, Class/Type); 53 RETURN_TYPE_ERROR(I, object, Class/Type);
53 } 54 }
54 } 55 }
55 56
56 57
57 // --- Function and Variable Reflection --- 58 // --- Function and Variable Reflection ---
58 59
59 // Outside of the vm, we expose setter names with a trailing '='. 60 // Outside of the vm, we expose setter names with a trailing '='.
60 static bool HasExternalSetterSuffix(const String& name) { 61 static bool HasExternalSetterSuffix(const String& name) {
61 return name.CharAt(name.Length() - 1) == '='; 62 return name.CharAt(name.Length() - 1) == '=';
62 } 63 }
63 64
64 65
65 static RawString* RemoveExternalSetterSuffix(const String& name) { 66 static RawString* RemoveExternalSetterSuffix(const String& name) {
66 ASSERT(HasExternalSetterSuffix(name)); 67 ASSERT(HasExternalSetterSuffix(name));
67 return String::SubString(name, 0, name.Length() - 1); 68 return String::SubString(name, 0, name.Length() - 1);
68 } 69 }
69 70
70 71
71 DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) { 72 DART_EXPORT Dart_Handle Dart_GetFunctionNames(Dart_Handle target) {
72 Isolate* isolate = Isolate::Current(); 73 DARTSCOPE(Thread::Current());
73 DARTSCOPE(isolate); 74 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target));
74 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
75 if (obj.IsError()) { 75 if (obj.IsError()) {
76 return target; 76 return target;
77 } 77 }
78 78
79 const GrowableObjectArray& names = 79 const GrowableObjectArray& names =
80 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); 80 GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
81 Function& func = Function::Handle(); 81 Function& func = Function::Handle(Z);
82 String& name = String::Handle(); 82 String& name = String::Handle(Z);
83 83
84 if (obj.IsType()) { 84 if (obj.IsType()) {
85 const Class& cls = Class::Handle(Type::Cast(obj).type_class()); 85 const Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
86 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); 86 const Error& error = Error::Handle(Z, cls.EnsureIsFinalized(I));
87 if (!error.IsNull()) { 87 if (!error.IsNull()) {
88 return Api::NewHandle(isolate, error.raw()); 88 return Api::NewHandle(I, error.raw());
89 } 89 }
90 const Array& func_array = Array::Handle(cls.functions()); 90 const Array& func_array = Array::Handle(Z, cls.functions());
91 91
92 // Some special types like 'dynamic' have a null functions list. 92 // Some special types like 'dynamic' have a null functions list.
93 if (!func_array.IsNull()) { 93 if (!func_array.IsNull()) {
94 for (intptr_t i = 0; i < func_array.Length(); ++i) { 94 for (intptr_t i = 0; i < func_array.Length(); ++i) {
95 func ^= func_array.At(i); 95 func ^= func_array.At(i);
96 96
97 // Skip implicit getters and setters. 97 // Skip implicit getters and setters.
98 if (func.kind() == RawFunction::kImplicitGetter || 98 if (func.kind() == RawFunction::kImplicitGetter ||
99 func.kind() == RawFunction::kImplicitSetter || 99 func.kind() == RawFunction::kImplicitSetter ||
100 func.kind() == RawFunction::kImplicitStaticFinalGetter || 100 func.kind() == RawFunction::kImplicitStaticFinalGetter ||
(...skipping 16 matching lines...) Expand all
117 func ^= obj.raw(); 117 func ^= obj.raw();
118 name = func.UserVisibleName(); 118 name = func.UserVisibleName();
119 names.Add(name); 119 names.Add(name);
120 } 120 }
121 } 121 }
122 } else { 122 } else {
123 return Api::NewError( 123 return Api::NewError(
124 "%s expects argument 'target' to be a class or library.", 124 "%s expects argument 'target' to be a class or library.",
125 CURRENT_FUNC); 125 CURRENT_FUNC);
126 } 126 }
127 return Api::NewHandle(isolate, Array::MakeArray(names)); 127 return Api::NewHandle(I, 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 Isolate* isolate = Isolate::Current(); 133 DARTSCOPE(Thread::Current());
134 DARTSCOPE(isolate); 134 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target));
135 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
136 if (obj.IsError()) { 135 if (obj.IsError()) {
137 return target; 136 return target;
138 } 137 }
139 const String& func_name = Api::UnwrapStringHandle(isolate, function_name); 138 const String& func_name = Api::UnwrapStringHandle(I, function_name);
140 if (func_name.IsNull()) { 139 if (func_name.IsNull()) {
141 RETURN_TYPE_ERROR(isolate, function_name, String); 140 RETURN_TYPE_ERROR(I, function_name, String);
142 } 141 }
143 142
144 Function& func = Function::Handle(isolate); 143 Function& func = Function::Handle(Z);
145 String& tmp_name = String::Handle(isolate); 144 String& tmp_name = String::Handle(Z);
146 if (obj.IsType()) { 145 if (obj.IsType()) {
147 const Class& cls = Class::Handle(Type::Cast(obj).type_class()); 146 const Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
148 147
149 // Case 1. Lookup the unmodified function name. 148 // Case 1. Lookup the unmodified function name.
150 func = cls.LookupFunctionAllowPrivate(func_name); 149 func = cls.LookupFunctionAllowPrivate(func_name);
151 150
152 // Case 2. Lookup the function without the external setter suffix 151 // Case 2. Lookup the function without the external setter suffix
153 // '='. Make sure to do this check after the regular lookup, so 152 // '='. Make sure to do this check after the regular lookup, so
154 // that we don't interfere with operator lookups (like ==). 153 // that we don't interfere with operator lookups (like ==).
155 if (func.IsNull() && HasExternalSetterSuffix(func_name)) { 154 if (func.IsNull() && HasExternalSetterSuffix(func_name)) {
156 tmp_name = RemoveExternalSetterSuffix(func_name); 155 tmp_name = RemoveExternalSetterSuffix(func_name);
157 tmp_name = Field::SetterName(tmp_name); 156 tmp_name = Field::SetterName(tmp_name);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #if defined(DEBUG) 198 #if defined(DEBUG)
200 if (!func.IsNull()) { 199 if (!func.IsNull()) {
201 // We only provide access to a subset of function kinds. 200 // We only provide access to a subset of function kinds.
202 RawFunction::Kind func_kind = func.kind(); 201 RawFunction::Kind func_kind = func.kind();
203 ASSERT(func_kind == RawFunction::kRegularFunction || 202 ASSERT(func_kind == RawFunction::kRegularFunction ||
204 func_kind == RawFunction::kGetterFunction || 203 func_kind == RawFunction::kGetterFunction ||
205 func_kind == RawFunction::kSetterFunction || 204 func_kind == RawFunction::kSetterFunction ||
206 func_kind == RawFunction::kConstructor); 205 func_kind == RawFunction::kConstructor);
207 } 206 }
208 #endif 207 #endif
209 return Api::NewHandle(isolate, func.raw()); 208 return Api::NewHandle(I, func.raw());
210 } 209 }
211 210
212 211
213 DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function) { 212 DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function) {
214 Isolate* isolate = Isolate::Current(); 213 DARTSCOPE(Thread::Current());
215 DARTSCOPE(isolate); 214 const Function& func = Api::UnwrapFunctionHandle(I, function);
216 const Function& func = Api::UnwrapFunctionHandle(isolate, function);
217 if (func.IsNull()) { 215 if (func.IsNull()) {
218 RETURN_TYPE_ERROR(isolate, function, Function); 216 RETURN_TYPE_ERROR(I, function, Function);
219 } 217 }
220 return Api::NewHandle(isolate, func.UserVisibleName()); 218 return Api::NewHandle(I, func.UserVisibleName());
221 } 219 }
222 220
223 221
224 DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function) { 222 DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function) {
225 Isolate* isolate = Isolate::Current(); 223 DARTSCOPE(Thread::Current());
226 DARTSCOPE(isolate); 224 const Function& func = Api::UnwrapFunctionHandle(I, function);
227 const Function& func = Api::UnwrapFunctionHandle(isolate, function);
228 if (func.IsNull()) { 225 if (func.IsNull()) {
229 RETURN_TYPE_ERROR(isolate, function, Function); 226 RETURN_TYPE_ERROR(I, function, Function);
230 } 227 }
231 if (func.IsNonImplicitClosureFunction()) { 228 if (func.IsNonImplicitClosureFunction()) {
232 RawFunction* parent_function = func.parent_function(); 229 RawFunction* parent_function = func.parent_function();
233 return Api::NewHandle(isolate, parent_function); 230 return Api::NewHandle(I, parent_function);
234 } 231 }
235 const Class& owner = Class::Handle(func.Owner()); 232 const Class& owner = Class::Handle(Z, func.Owner());
236 ASSERT(!owner.IsNull()); 233 ASSERT(!owner.IsNull());
237 if (owner.IsTopLevel()) { 234 if (owner.IsTopLevel()) {
238 // Top-level functions are implemented as members of a hidden class. We hide 235 // Top-level functions are implemented as members of a hidden class. We hide
239 // that class here and instead answer the library. 236 // that class here and instead answer the library.
240 #if defined(DEBUG) 237 #if defined(DEBUG)
241 const Library& lib = Library::Handle(owner.library()); 238 const Library& lib = Library::Handle(Z, owner.library());
242 if (lib.IsNull()) { 239 if (lib.IsNull()) {
243 ASSERT(owner.IsDynamicClass() || owner.IsVoidClass()); 240 ASSERT(owner.IsDynamicClass() || owner.IsVoidClass());
244 } 241 }
245 #endif 242 #endif
246 return Api::NewHandle(isolate, owner.library()); 243 return Api::NewHandle(I, owner.library());
247 } else { 244 } else {
248 return Api::NewHandle(isolate, owner.RareType()); 245 return Api::NewHandle(I, owner.RareType());
249 } 246 }
250 } 247 }
251 248
252 249
253 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, 250 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
254 bool* is_static) { 251 bool* is_static) {
255 Isolate* isolate = Isolate::Current(); 252 DARTSCOPE(Thread::Current());
256 DARTSCOPE(isolate);
257 if (is_static == NULL) { 253 if (is_static == NULL) {
258 RETURN_NULL_ERROR(is_static); 254 RETURN_NULL_ERROR(is_static);
259 } 255 }
260 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 256 const Function& func = Api::UnwrapFunctionHandle(I, function);
261 if (func.IsNull()) { 257 if (func.IsNull()) {
262 RETURN_TYPE_ERROR(isolate, function, Function); 258 RETURN_TYPE_ERROR(I, function, Function);
263 } 259 }
264 *is_static = func.is_static(); 260 *is_static = func.is_static();
265 return Api::Success(); 261 return Api::Success();
266 } 262 }
267 263
268 264
269 DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function, 265 DART_EXPORT Dart_Handle Dart_FunctionIsConstructor(Dart_Handle function,
270 bool* is_constructor) { 266 bool* is_constructor) {
271 Isolate* isolate = Isolate::Current(); 267 DARTSCOPE(Thread::Current());
272 DARTSCOPE(isolate);
273 if (is_constructor == NULL) { 268 if (is_constructor == NULL) {
274 RETURN_NULL_ERROR(is_constructor); 269 RETURN_NULL_ERROR(is_constructor);
275 } 270 }
276 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 271 const Function& func = Api::UnwrapFunctionHandle(I, function);
277 if (func.IsNull()) { 272 if (func.IsNull()) {
278 RETURN_TYPE_ERROR(isolate, function, Function); 273 RETURN_TYPE_ERROR(I, function, Function);
279 } 274 }
280 *is_constructor = func.kind() == RawFunction::kConstructor; 275 *is_constructor = func.kind() == RawFunction::kConstructor;
281 return Api::Success(); 276 return Api::Success();
282 } 277 }
283 278
284 279
285 DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function, 280 DART_EXPORT Dart_Handle Dart_FunctionIsGetter(Dart_Handle function,
286 bool* is_getter) { 281 bool* is_getter) {
287 Isolate* isolate = Isolate::Current(); 282 DARTSCOPE(Thread::Current());
288 DARTSCOPE(isolate);
289 if (is_getter == NULL) { 283 if (is_getter == NULL) {
290 RETURN_NULL_ERROR(is_getter); 284 RETURN_NULL_ERROR(is_getter);
291 } 285 }
292 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 286 const Function& func = Api::UnwrapFunctionHandle(I, function);
293 if (func.IsNull()) { 287 if (func.IsNull()) {
294 RETURN_TYPE_ERROR(isolate, function, Function); 288 RETURN_TYPE_ERROR(I, function, Function);
295 } 289 }
296 *is_getter = func.IsGetterFunction(); 290 *is_getter = func.IsGetterFunction();
297 return Api::Success(); 291 return Api::Success();
298 } 292 }
299 293
300 294
301 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, 295 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function,
302 bool* is_setter) { 296 bool* is_setter) {
303 Isolate* isolate = Isolate::Current(); 297 DARTSCOPE(Thread::Current());
304 DARTSCOPE(isolate);
305 if (is_setter == NULL) { 298 if (is_setter == NULL) {
306 RETURN_NULL_ERROR(is_setter); 299 RETURN_NULL_ERROR(is_setter);
307 } 300 }
308 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 301 const Function& func = Api::UnwrapFunctionHandle(I, function);
309 if (func.IsNull()) { 302 if (func.IsNull()) {
310 RETURN_TYPE_ERROR(isolate, function, Function); 303 RETURN_TYPE_ERROR(I, function, Function);
311 } 304 }
312 *is_setter = (func.kind() == RawFunction::kSetterFunction); 305 *is_setter = (func.kind() == RawFunction::kSetterFunction);
313 return Api::Success(); 306 return Api::Success();
314 } 307 }
315 308
316 309
317 // --- Libraries Reflection --- 310 // --- Libraries Reflection ---
318 311
319 DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library) { 312 DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library) {
320 Isolate* isolate = Isolate::Current(); 313 DARTSCOPE(Thread::Current());
321 DARTSCOPE(isolate); 314 const Library& lib = Api::UnwrapLibraryHandle(I, library);
322 const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
323 if (lib.IsNull()) { 315 if (lib.IsNull()) {
324 RETURN_TYPE_ERROR(isolate, library, Library); 316 RETURN_TYPE_ERROR(I, library, Library);
325 } 317 }
326 const String& name = String::Handle(isolate, lib.name()); 318 const String& name = String::Handle(Z, lib.name());
327 ASSERT(!name.IsNull()); 319 ASSERT(!name.IsNull());
328 return Api::NewHandle(isolate, name.raw()); 320 return Api::NewHandle(I, name.raw());
329 } 321 }
330 322
331 DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library) { 323 DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library) {
332 Isolate* isolate = Isolate::Current(); 324 DARTSCOPE(Thread::Current());
333 DARTSCOPE(isolate); 325 const Library& lib = Api::UnwrapLibraryHandle(I, library);
334 const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
335 if (lib.IsNull()) { 326 if (lib.IsNull()) {
336 RETURN_TYPE_ERROR(isolate, library, Library); 327 RETURN_TYPE_ERROR(I, library, Library);
337 } 328 }
338 329
339 const GrowableObjectArray& names = 330 const GrowableObjectArray& names =
340 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); 331 GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
341 ClassDictionaryIterator it(lib); 332 ClassDictionaryIterator it(lib);
342 Class& cls = Class::Handle(); 333 Class& cls = Class::Handle(Z);
343 String& name = String::Handle(); 334 String& name = String::Handle(Z);
344 while (it.HasNext()) { 335 while (it.HasNext()) {
345 cls = it.GetNextClass(); 336 cls = it.GetNextClass();
346 if (cls.IsSignatureClass()) { 337 if (cls.IsSignatureClass()) {
347 if (!cls.IsCanonicalSignatureClass()) { 338 if (!cls.IsCanonicalSignatureClass()) {
348 // This is a typedef. Add it to the list of class names. 339 // This is a typedef. Add it to the list of class names.
349 name = cls.UserVisibleName(); 340 name = cls.UserVisibleName();
350 names.Add(name); 341 names.Add(name);
351 } else { 342 } else {
352 // Skip canonical signature classes. These are not named. 343 // Skip canonical signature classes. These are not named.
353 } 344 }
354 } else { 345 } else {
355 name = cls.UserVisibleName(); 346 name = cls.UserVisibleName();
356 names.Add(name); 347 names.Add(name);
357 } 348 }
358 } 349 }
359 return Api::NewHandle(isolate, Array::MakeArray(names)); 350 return Api::NewHandle(I, Array::MakeArray(names));
360 } 351 }
361 352
362 353
363 // --- Closures Reflection --- 354 // --- Closures Reflection ---
364 355
365 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) { 356 DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure) {
366 Isolate* isolate = Isolate::Current(); 357 DARTSCOPE(Thread::Current());
367 DARTSCOPE(isolate); 358 const Instance& closure_obj = Api::UnwrapInstanceHandle(I, closure);
368 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure);
369 if (closure_obj.IsNull() || !closure_obj.IsClosure()) { 359 if (closure_obj.IsNull() || !closure_obj.IsClosure()) {
370 RETURN_TYPE_ERROR(isolate, closure, Instance); 360 RETURN_TYPE_ERROR(I, closure, Instance);
371 } 361 }
372 362
373 ASSERT(ClassFinalizer::AllClassesFinalized()); 363 ASSERT(ClassFinalizer::AllClassesFinalized());
374 364
375 RawFunction* rf = Closure::function(closure_obj); 365 RawFunction* rf = Closure::function(closure_obj);
376 return Api::NewHandle(isolate, rf); 366 return Api::NewHandle(I, rf);
377 } 367 }
378 368
379 } // namespace dart 369 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/metrics_test.cc ('k') | runtime/vm/native_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698