| 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 9 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 pending.set_is_marked_for_parsing(); | 86 pending.set_is_marked_for_parsing(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Load the bootstrap libraries in order (see object_store.h). | 89 // Load the bootstrap libraries in order (see object_store.h). |
| 90 Library& library = Library::Handle(zone); | 90 Library& library = Library::Handle(zone); |
| 91 String& dart_name = String::Handle(zone); | 91 String& dart_name = String::Handle(zone); |
| 92 for (intptr_t i = 0; i < bootstrap_library_count; ++i) { | 92 for (intptr_t i = 0; i < bootstrap_library_count; ++i) { |
| 93 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; | 93 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; |
| 94 library = isolate->object_store()->bootstrap_library(id); | 94 library = isolate->object_store()->bootstrap_library(id); |
| 95 dart_name = library.url(); | 95 dart_name = library.url(); |
| 96 for (intptr_t j = 0; j < program->libraries().length(); ++j) { | 96 for (intptr_t j = 0; j < program->library_count(); ++j) { |
| 97 kernel::Library* kernel_library = program->libraries()[j]; | 97 const String& kernel_name = reader.DartSymbolForLib(j); |
| 98 kernel::StringIndex uri_index = kernel_library->import_uri(); | |
| 99 const String& kernel_name = reader.DartSymbol(uri_index); | |
| 100 if (kernel_name.Equals(dart_name)) { | 98 if (kernel_name.Equals(dart_name)) { |
| 101 reader.ReadLibrary(kernel_library->kernel_offset()); | 99 reader.ReadLibrary(reader.library_offset(j)); |
| 102 library.SetLoaded(); | 100 library.SetLoaded(); |
| 103 break; | 101 break; |
| 104 } | 102 } |
| 105 } | 103 } |
| 106 } | 104 } |
| 107 | 105 |
| 108 // Finish bootstrapping, including class finalization. | 106 // Finish bootstrapping, including class finalization. |
| 109 Finish(thread, /*from_kernel=*/true); | 107 Finish(thread, /*from_kernel=*/true); |
| 110 | 108 |
| 111 // The platform binary may contain other libraries (e.g., dart:_builtin or | 109 // The platform binary may contain other libraries (e.g., dart:_builtin or |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return BootstrapFromKernel(thread, program); | 145 return BootstrapFromKernel(thread, program); |
| 148 } | 146 } |
| 149 #else | 147 #else |
| 150 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { | 148 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { |
| 151 UNREACHABLE(); | 149 UNREACHABLE(); |
| 152 return Error::null(); | 150 return Error::null(); |
| 153 } | 151 } |
| 154 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 152 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 155 | 153 |
| 156 } // namespace dart | 154 } // namespace dart |
| OLD | NEW |