| 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 "vm/bootstrap.h" | 5 #include "vm/bootstrap.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/bootstrap_natives.h" | 9 #include "vm/bootstrap_natives.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 Dart_Handle library, | 186 Dart_Handle library, |
| 187 Dart_Handle uri) { | 187 Dart_Handle uri) { |
| 188 Isolate* isolate = Isolate::Current(); | 188 Isolate* isolate = Isolate::Current(); |
| 189 if (!Dart_IsLibrary(library)) { | 189 if (!Dart_IsLibrary(library)) { |
| 190 return Api::NewError("not a library"); | 190 return Api::NewError("not a library"); |
| 191 } | 191 } |
| 192 if (!Dart_IsString(uri)) { | 192 if (!Dart_IsString(uri)) { |
| 193 return Api::NewError("uri is not a string"); | 193 return Api::NewError("uri is not a string"); |
| 194 } | 194 } |
| 195 if (tag == Dart_kCanonicalizeUrl) { | 195 if (tag == Dart_kCanonicalizeUrl) { |
| 196 // In the boot strap loader we do not try and do any canonicalization. | 196 // In the bootstrap loader we do not try and do any canonicalization. |
| 197 return uri; | 197 return uri; |
| 198 } | 198 } |
| 199 const String& uri_str = Api::UnwrapStringHandle(isolate, uri); | 199 const String& uri_str = Api::UnwrapStringHandle(isolate, uri); |
| 200 ASSERT(!uri_str.IsNull()); | 200 ASSERT(!uri_str.IsNull()); |
| 201 if (tag == Dart_kImportTag) { | 201 if (tag == Dart_kImportTag) { |
| 202 // We expect the core bootstrap libraries to only import other | 202 // We expect the core bootstrap libraries to only import other |
| 203 // core bootstrap libraries. | 203 // core bootstrap libraries. |
| 204 // We have precreated all the bootstrap library objects hence | 204 // We have precreated all the bootstrap library objects hence |
| 205 // we do not expect to be called back with the tag set to kImportTag. | 205 // we do not expect to be called back with the tag set to kImportTag. |
| 206 // The bootstrap process explicitly loads all the libraries one by one. | 206 // The bootstrap process explicitly loads all the libraries one by one. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 HANDLESCOPE(isolate); | 264 HANDLESCOPE(isolate); |
| 265 | 265 |
| 266 // Create library objects for all the bootstrap libraries. | 266 // Create library objects for all the bootstrap libraries. |
| 267 for (intptr_t i = 0; | 267 for (intptr_t i = 0; |
| 268 bootstrap_libraries[i].index_ != ObjectStore::kNone; | 268 bootstrap_libraries[i].index_ != ObjectStore::kNone; |
| 269 ++i) { | 269 ++i) { |
| 270 uri = Symbols::New(bootstrap_libraries[i].uri_); | 270 uri = Symbols::New(bootstrap_libraries[i].uri_); |
| 271 lib = Library::LookupLibrary(uri); | 271 lib = Library::LookupLibrary(uri); |
| 272 if (lib.IsNull()) { | 272 if (lib.IsNull()) { |
| 273 lib = Library::NewLibraryHelper(uri, false); | 273 lib = Library::NewLibraryHelper(uri, false); |
| 274 lib.SetLoadRequested(); |
| 274 lib.Register(); | 275 lib.Register(); |
| 275 } | 276 } |
| 276 isolate->object_store()->set_bootstrap_library( | 277 isolate->object_store()->set_bootstrap_library( |
| 277 bootstrap_libraries[i].index_, lib); | 278 bootstrap_libraries[i].index_, lib); |
| 278 } | 279 } |
| 279 | 280 |
| 280 // Load, compile and patch bootstrap libraries. | 281 // Load, compile and patch bootstrap libraries. |
| 281 for (intptr_t i = 0; | 282 for (intptr_t i = 0; |
| 282 bootstrap_libraries[i].index_ != ObjectStore::kNone; | 283 bootstrap_libraries[i].index_ != ObjectStore::kNone; |
| 283 ++i) { | 284 ++i) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 312 SetupNativeResolver(); | 313 SetupNativeResolver(); |
| 313 } | 314 } |
| 314 | 315 |
| 315 // Restore the library tag handler for the isolate. | 316 // Restore the library tag handler for the isolate. |
| 316 isolate->set_library_tag_handler(saved_tag_handler); | 317 isolate->set_library_tag_handler(saved_tag_handler); |
| 317 | 318 |
| 318 return error.raw(); | 319 return error.raw(); |
| 319 } | 320 } |
| 320 | 321 |
| 321 } // namespace dart | 322 } // namespace dart |
| OLD | NEW |