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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 TIMERSCOPE(time_script_loading); | 212 TIMERSCOPE(time_script_loading); |
213 const String& url_str = String::CheckedHandle(Api::UnwrapHandle(url)); | 213 const String& url_str = String::CheckedHandle(Api::UnwrapHandle(url)); |
214 const String& source_str = String::CheckedHandle(Api::UnwrapHandle(source)); | 214 const String& source_str = String::CheckedHandle(Api::UnwrapHandle(source)); |
215 Library& library = Library::Handle(isolate->object_store()->root_library()); | 215 Library& library = Library::Handle(isolate->object_store()->root_library()); |
216 if (!library.IsNull()) { | 216 if (!library.IsNull()) { |
217 RETURN_FAILURE("Script already loaded"); | 217 RETURN_FAILURE("Script already loaded"); |
218 } | 218 } |
219 isolate->set_library_tag_handler(handler); | 219 isolate->set_library_tag_handler(handler); |
220 library = Library::New(url_str); | 220 library = Library::New(url_str); |
221 library.Register(); | 221 library.Register(); |
| 222 isolate->object_store()->set_root_library(library); |
222 Dart_Result result; | 223 Dart_Result result; |
223 CompileSource(library, url_str, source_str, RawScript::kScript, &result); | 224 CompileSource(library, url_str, source_str, RawScript::kScript, &result); |
224 return result; | 225 return result; |
225 } | 226 } |
226 | 227 |
227 | 228 |
228 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); | 229 DEFINE_FLAG(bool, compile_all, false, "Eagerly compile all code."); |
229 | 230 |
230 static void CompileAll(Dart_Result* result) { | 231 static void CompileAll(Dart_Result* result) { |
231 result->type_ = kRetCBool; | 232 result->type_ = kRetCBool; |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 ASSERT(isolate != NULL); | 1672 ASSERT(isolate != NULL); |
1672 ApiState* state = isolate->api_state(); | 1673 ApiState* state = isolate->api_state(); |
1673 ASSERT(state != NULL); | 1674 ASSERT(state != NULL); |
1674 ApiLocalScope* scope = state->top_scope(); | 1675 ApiLocalScope* scope = state->top_scope(); |
1675 ASSERT(scope != NULL); | 1676 ASSERT(scope != NULL); |
1676 return scope->zone().Reallocate(ptr, old_size, new_size); | 1677 return scope->zone().Reallocate(ptr, old_size, new_size); |
1677 } | 1678 } |
1678 | 1679 |
1679 | 1680 |
1680 } // namespace dart | 1681 } // namespace dart |
OLD | NEW |