Chromium Code Reviews| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 library = Library::New(url_str); | 392 library = Library::New(url_str); |
| 393 library.Register(); | 393 library.Register(); |
| 394 isolate->object_store()->set_root_library(library); | 394 isolate->object_store()->set_root_library(library); |
| 395 Dart_Handle result; | 395 Dart_Handle result; |
| 396 CompileSource(isolate, | 396 CompileSource(isolate, |
| 397 library, | 397 library, |
| 398 url_str, | 398 url_str, |
| 399 source_str, | 399 source_str, |
| 400 RawScript::kScript, | 400 RawScript::kScript, |
| 401 &result); | 401 &result); |
| 402 if (!Dart_IsError(result)) { | |
| 403 library.SetLoaded(); | |
| 404 } | |
|
turnidge
2011/11/16 00:51:36
Does it make sense to move this into CompileSource
siva
2011/11/16 18:57:31
CompileSource is also called from Dart_LoadSource
| |
| 402 return result; | 405 return result; |
| 403 } | 406 } |
| 404 | 407 |
| 405 | 408 |
| 406 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); | 409 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); |
| 407 | 410 |
| 408 static void CompileAll(Isolate* isolate, Dart_Handle* result) { | 411 static void CompileAll(Isolate* isolate, Dart_Handle* result) { |
| 409 *result = Api::Success(); | 412 *result = Api::Success(); |
| 410 if (FLAG_compile_all) { | 413 if (FLAG_compile_all) { |
| 411 ASSERT(isolate != NULL); | 414 ASSERT(isolate != NULL); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 library = Library::New(url_str); | 514 library = Library::New(url_str); |
| 512 library.Register(); | 515 library.Register(); |
| 513 } | 516 } |
| 514 Dart_Handle result; | 517 Dart_Handle result; |
| 515 CompileSource(isolate, | 518 CompileSource(isolate, |
| 516 library, | 519 library, |
| 517 url_str, | 520 url_str, |
| 518 source_str, | 521 source_str, |
| 519 RawScript::kLibrary, | 522 RawScript::kLibrary, |
| 520 &result); | 523 &result); |
| 524 if (!Dart_IsError(result)) { | |
| 525 library.SetLoaded(); | |
| 526 } | |
| 521 return result; | 527 return result; |
| 522 } | 528 } |
| 523 | 529 |
| 524 | 530 |
| 525 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library_in, | 531 DART_EXPORT Dart_Handle Dart_LoadSource(Dart_Handle library_in, |
| 526 Dart_Handle url_in, | 532 Dart_Handle url_in, |
| 527 Dart_Handle source_in) { | 533 Dart_Handle source_in) { |
| 528 Isolate* isolate = Isolate::Current(); | 534 Isolate* isolate = Isolate::Current(); |
| 529 DARTSCOPE(isolate); | 535 DARTSCOPE(isolate); |
| 530 const String& url = String::CheckedHandle(Api::UnwrapHandle(url_in)); | 536 const String& url = String::CheckedHandle(Api::UnwrapHandle(url_in)); |
| (...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2133 ASSERT(isolate != NULL); | 2139 ASSERT(isolate != NULL); |
| 2134 ApiState* state = isolate->api_state(); | 2140 ApiState* state = isolate->api_state(); |
| 2135 ASSERT(state != NULL); | 2141 ASSERT(state != NULL); |
| 2136 ApiLocalScope* scope = state->top_scope(); | 2142 ApiLocalScope* scope = state->top_scope(); |
| 2137 ASSERT(scope != NULL); | 2143 ASSERT(scope != NULL); |
| 2138 return scope->zone().Reallocate(ptr, old_size, new_size); | 2144 return scope->zone().Reallocate(ptr, old_size, new_size); |
| 2139 } | 2145 } |
| 2140 | 2146 |
| 2141 | 2147 |
| 2142 } // namespace dart | 2148 } // namespace dart |
| OLD | NEW |