| 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 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 RETURN_TYPE_ERROR(isolate, source, String); | 3107 RETURN_TYPE_ERROR(isolate, source, String); |
| 3108 } | 3108 } |
| 3109 Library& library = | 3109 Library& library = |
| 3110 Library::Handle(isolate, isolate->object_store()->root_library()); | 3110 Library::Handle(isolate, isolate->object_store()->root_library()); |
| 3111 if (!library.IsNull()) { | 3111 if (!library.IsNull()) { |
| 3112 const String& library_url = String::Handle(isolate, library.url()); | 3112 const String& library_url = String::Handle(isolate, library.url()); |
| 3113 return Api::NewError("%s: A script has already been loaded from '%s'.", | 3113 return Api::NewError("%s: A script has already been loaded from '%s'.", |
| 3114 CURRENT_FUNC, library_url.ToCString()); | 3114 CURRENT_FUNC, library_url.ToCString()); |
| 3115 } | 3115 } |
| 3116 library = Library::New(url_str); | 3116 library = Library::New(url_str); |
| 3117 library.set_debuggable(true); |
| 3117 library.Register(); | 3118 library.Register(); |
| 3118 isolate->object_store()->set_root_library(library); | 3119 isolate->object_store()->set_root_library(library); |
| 3119 Dart_Handle result; | 3120 Dart_Handle result; |
| 3120 CompileSource(isolate, | 3121 CompileSource(isolate, |
| 3121 library, | 3122 library, |
| 3122 url_str, | 3123 url_str, |
| 3123 source_str, | 3124 source_str, |
| 3124 RawScript::kScript, | 3125 RawScript::kScript, |
| 3125 &result); | 3126 &result); |
| 3126 return result; | 3127 return result; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3147 return Api::NewError("%s: A script has already been loaded from '%s'.", | 3148 return Api::NewError("%s: A script has already been loaded from '%s'.", |
| 3148 CURRENT_FUNC, library_url.ToCString()); | 3149 CURRENT_FUNC, library_url.ToCString()); |
| 3149 } | 3150 } |
| 3150 SnapshotReader reader(snapshot, isolate); | 3151 SnapshotReader reader(snapshot, isolate); |
| 3151 const Object& tmp = Object::Handle(isolate, reader.ReadObject()); | 3152 const Object& tmp = Object::Handle(isolate, reader.ReadObject()); |
| 3152 if (!tmp.IsLibrary()) { | 3153 if (!tmp.IsLibrary()) { |
| 3153 return Api::NewError("%s: Unable to deserialize snapshot correctly.", | 3154 return Api::NewError("%s: Unable to deserialize snapshot correctly.", |
| 3154 CURRENT_FUNC); | 3155 CURRENT_FUNC); |
| 3155 } | 3156 } |
| 3156 library ^= tmp.raw(); | 3157 library ^= tmp.raw(); |
| 3158 library.set_debuggable(true); |
| 3157 isolate->object_store()->set_root_library(library); | 3159 isolate->object_store()->set_root_library(library); |
| 3158 return Api::NewHandle(isolate, library.raw()); | 3160 return Api::NewHandle(isolate, library.raw()); |
| 3159 } | 3161 } |
| 3160 | 3162 |
| 3161 | 3163 |
| 3162 DART_EXPORT Dart_Handle Dart_RootLibrary() { | 3164 DART_EXPORT Dart_Handle Dart_RootLibrary() { |
| 3163 Isolate* isolate = Isolate::Current(); | 3165 Isolate* isolate = Isolate::Current(); |
| 3164 DARTSCOPE(isolate); | 3166 DARTSCOPE(isolate); |
| 3165 Library& library = | 3167 Library& library = |
| 3166 Library::Handle(isolate, isolate->object_store()->root_library()); | 3168 Library::Handle(isolate, isolate->object_store()->root_library()); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3392 *buffer = NULL; | 3394 *buffer = NULL; |
| 3393 } | 3395 } |
| 3394 delete debug_region; | 3396 delete debug_region; |
| 3395 } else { | 3397 } else { |
| 3396 *buffer = NULL; | 3398 *buffer = NULL; |
| 3397 *buffer_size = 0; | 3399 *buffer_size = 0; |
| 3398 } | 3400 } |
| 3399 } | 3401 } |
| 3400 | 3402 |
| 3401 } // namespace dart | 3403 } // namespace dart |
| OLD | NEW |