| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 return Api::NewError("%s: did not find static method '%s.%s'.", | 2197 return Api::NewError("%s: did not find static method '%s.%s'.", |
| 2198 CURRENT_FUNC, | 2198 CURRENT_FUNC, |
| 2199 cls_name.ToCString(), | 2199 cls_name.ToCString(), |
| 2200 function_name.ToCString()); | 2200 function_name.ToCString()); |
| 2201 } | 2201 } |
| 2202 const Object& result = Object::Handle( | 2202 const Object& result = Object::Handle( |
| 2203 DartEntry::InvokeStatic(function, dart_args, kNoArgNames)); | 2203 DartEntry::InvokeStatic(function, dart_args, kNoArgNames)); |
| 2204 return Api::NewLocalHandle(result); | 2204 return Api::NewLocalHandle(result); |
| 2205 | 2205 |
| 2206 } else if (obj.IsLibrary()) { | 2206 } else if (obj.IsLibrary()) { |
| 2207 // Finalize all classes. | 2207 // Check whether class finalization is needed. |
| 2208 const char* msg = CheckIsolateState(isolate); | 2208 bool finalize_classes = true; |
| 2209 if (msg != NULL) { | 2209 Library& lib = Library::Handle(); |
| 2210 return Api::NewError(msg); | 2210 lib ^= obj.raw(); |
| 2211 |
| 2212 // When calling functions in the dart:builtin library do not finalize as it |
| 2213 // should have been prefinalized. |
| 2214 Library& builtin = |
| 2215 Library::Handle(isolate->object_store()->builtin_library()); |
| 2216 if (builtin.raw() == lib.raw()) { |
| 2217 finalize_classes = false; |
| 2211 } | 2218 } |
| 2212 | 2219 |
| 2213 Library& lib = Library::Handle(); | 2220 // Finalize all classes if needed. |
| 2214 lib ^= obj.raw(); | 2221 if (finalize_classes) { |
| 2222 const char* msg = CheckIsolateState(isolate); |
| 2223 if (msg != NULL) { |
| 2224 return Api::NewError(msg); |
| 2225 } |
| 2226 } |
| 2227 |
| 2215 const Function& function = Function::Handle( | 2228 const Function& function = Function::Handle( |
| 2216 lib.LookupLocalFunction(function_name)); | 2229 lib.LookupLocalFunction(function_name)); |
| 2217 if (function.IsNull()) { | 2230 if (function.IsNull()) { |
| 2218 return Api::NewError("%s: did not find top-level function '%s'.", | 2231 return Api::NewError("%s: did not find top-level function '%s'.", |
| 2219 CURRENT_FUNC, | 2232 CURRENT_FUNC, |
| 2220 function_name.ToCString()); | 2233 function_name.ToCString()); |
| 2221 } | 2234 } |
| 2222 const Object& result = Object::Handle( | 2235 const Object& result = Object::Handle( |
| 2223 DartEntry::InvokeStatic(function, dart_args, kNoArgNames)); | 2236 DartEntry::InvokeStatic(function, dart_args, kNoArgNames)); |
| 2224 return Api::NewLocalHandle(result); | 2237 return Api::NewLocalHandle(result); |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 *buffer = NULL; | 3258 *buffer = NULL; |
| 3246 } | 3259 } |
| 3247 delete debug_region; | 3260 delete debug_region; |
| 3248 } else { | 3261 } else { |
| 3249 *buffer = NULL; | 3262 *buffer = NULL; |
| 3250 *buffer_size = 0; | 3263 *buffer_size = 0; |
| 3251 } | 3264 } |
| 3252 } | 3265 } |
| 3253 | 3266 |
| 3254 } // namespace dart | 3267 } // namespace dart |
| OLD | NEW |