| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2333 return Api::Error("%s: Unable to deserialize snapshot correctly.", | 2333 return Api::Error("%s: Unable to deserialize snapshot correctly.", |
| 2334 CURRENT_FUNC); | 2334 CURRENT_FUNC); |
| 2335 } | 2335 } |
| 2336 library ^= tmp.raw(); | 2336 library ^= tmp.raw(); |
| 2337 library.Register(); | 2337 library.Register(); |
| 2338 isolate->object_store()->set_root_library(library); | 2338 isolate->object_store()->set_root_library(library); |
| 2339 return Api::NewLocalHandle(library); | 2339 return Api::NewLocalHandle(library); |
| 2340 } | 2340 } |
| 2341 | 2341 |
| 2342 | 2342 |
| 2343 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); | |
| 2344 | |
| 2345 static void CompileAll(Isolate* isolate, Dart_Handle* result) { | 2343 static void CompileAll(Isolate* isolate, Dart_Handle* result) { |
| 2346 *result = Api::Success(); | 2344 *result = Api::Success(); |
| 2347 if (FLAG_compile_all) { | 2345 ASSERT(isolate != NULL); |
| 2348 ASSERT(isolate != NULL); | 2346 LongJump* base = isolate->long_jump_base(); |
| 2349 LongJump* base = isolate->long_jump_base(); | 2347 LongJump jump; |
| 2350 LongJump jump; | 2348 isolate->set_long_jump_base(&jump); |
| 2351 isolate->set_long_jump_base(&jump); | 2349 if (setjmp(*jump.Set()) == 0) { |
| 2352 if (setjmp(*jump.Set()) == 0) { | 2350 Library::CompileAll(); |
| 2353 Library::CompileAll(); | 2351 } else { |
| 2354 } else { | 2352 SetupErrorResult(result); |
| 2355 SetupErrorResult(result); | |
| 2356 } | |
| 2357 isolate->set_long_jump_base(base); | |
| 2358 } | 2353 } |
| 2354 isolate->set_long_jump_base(base); |
| 2359 } | 2355 } |
| 2360 | 2356 |
| 2361 | 2357 |
| 2362 DART_EXPORT Dart_Handle Dart_CompileAll() { | 2358 DART_EXPORT Dart_Handle Dart_CompileAll() { |
| 2363 Isolate* isolate = Isolate::Current(); | 2359 Isolate* isolate = Isolate::Current(); |
| 2364 DARTSCOPE(isolate); | 2360 DARTSCOPE(isolate); |
| 2365 Dart_Handle result; | 2361 Dart_Handle result; |
| 2366 const char* msg = CheckIsolateState(isolate); | 2362 const char* msg = CheckIsolateState(isolate); |
| 2367 if (msg != NULL) { | 2363 if (msg != NULL) { |
| 2368 return Api::Error(msg); | 2364 return Api::Error(msg); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 } | 2534 } |
| 2539 delete debug_region; | 2535 delete debug_region; |
| 2540 } else { | 2536 } else { |
| 2541 *buffer = NULL; | 2537 *buffer = NULL; |
| 2542 *buffer_size = 0; | 2538 *buffer_size = 0; |
| 2543 } | 2539 } |
| 2544 } | 2540 } |
| 2545 | 2541 |
| 2546 | 2542 |
| 2547 } // namespace dart | 2543 } // namespace dart |
| OLD | NEW |