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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 TIMERSCOPE(time_script_loading); | 261 TIMERSCOPE(time_script_loading); |
262 const String& url_str = String::CheckedHandle(Api::UnwrapHandle(url)); | 262 const String& url_str = String::CheckedHandle(Api::UnwrapHandle(url)); |
263 const String& source_str = String::CheckedHandle(Api::UnwrapHandle(source)); | 263 const String& source_str = String::CheckedHandle(Api::UnwrapHandle(source)); |
264 Library& library = Library::Handle(isolate->object_store()->root_library()); | 264 Library& library = Library::Handle(isolate->object_store()->root_library()); |
265 if (!library.IsNull()) { | 265 if (!library.IsNull()) { |
266 RETURN_FAILURE("Script already loaded"); | 266 RETURN_FAILURE("Script already loaded"); |
267 } | 267 } |
268 isolate->set_library_tag_handler(handler); | 268 isolate->set_library_tag_handler(handler); |
269 library = Library::New(url_str); | 269 library = Library::New(url_str); |
270 library.Register(); | 270 library.Register(); |
| 271 isolate->object_store()->set_root_library(library); |
271 Dart_Result result; | 272 Dart_Result result; |
272 CompileSource(library, url_str, source_str, RawScript::kScript, &result); | 273 CompileSource(library, url_str, source_str, RawScript::kScript, &result); |
273 return result; | 274 return result; |
274 } | 275 } |
275 | 276 |
276 | 277 |
277 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); | 278 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); |
278 | 279 |
279 static void CompileAll(Dart_Result* result) { | 280 static void CompileAll(Dart_Result* result) { |
280 result->type_ = kRetCBool; | 281 result->type_ = kRetCBool; |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 ASSERT(isolate != NULL); | 1721 ASSERT(isolate != NULL); |
1721 ApiState* state = isolate->api_state(); | 1722 ApiState* state = isolate->api_state(); |
1722 ASSERT(state != NULL); | 1723 ASSERT(state != NULL); |
1723 ApiLocalScope* scope = state->top_scope(); | 1724 ApiLocalScope* scope = state->top_scope(); |
1724 ASSERT(scope != NULL); | 1725 ASSERT(scope != NULL); |
1725 return scope->zone().Reallocate(ptr, old_size, new_size); | 1726 return scope->zone().Reallocate(ptr, old_size, new_size); |
1726 } | 1727 } |
1727 | 1728 |
1728 | 1729 |
1729 } // namespace dart | 1730 } // namespace dart |
OLD | NEW |