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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 pending.set_is_marked_for_parsing(); | 327 pending.set_is_marked_for_parsing(); |
328 } | 328 } |
329 | 329 |
330 // Load the bootstrap libraries in order (see object_store.h). | 330 // Load the bootstrap libraries in order (see object_store.h). |
331 Library& library = Library::Handle(zone); | 331 Library& library = Library::Handle(zone); |
332 String& dart_name = String::Handle(zone); | 332 String& dart_name = String::Handle(zone); |
333 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) { | 333 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) { |
334 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; | 334 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; |
335 library = isolate->object_store()->bootstrap_library(id); | 335 library = isolate->object_store()->bootstrap_library(id); |
336 dart_name = library.url(); | 336 dart_name = library.url(); |
337 for (intptr_t j = 0; j < program->libraries().length(); ++j) { | 337 for (intptr_t j = 0; j < program->library_count(); ++j) { |
338 kernel::Library* kernel_library = program->libraries()[j]; | 338 const String& kernel_name = reader.LibraryUri(j); |
339 kernel::StringIndex uri_index = kernel_library->import_uri(); | |
340 const String& kernel_name = reader.DartSymbol(uri_index); | |
341 if (kernel_name.Equals(dart_name)) { | 339 if (kernel_name.Equals(dart_name)) { |
342 reader.ReadLibrary(kernel_library->kernel_offset()); | 340 reader.ReadLibrary(reader.library_offset(j)); |
343 library.SetLoaded(); | 341 library.SetLoaded(); |
344 break; | 342 break; |
345 } | 343 } |
346 } | 344 } |
347 } | 345 } |
348 | 346 |
349 // Finish bootstrapping, including class finalization. | 347 // Finish bootstrapping, including class finalization. |
350 Finish(thread, /*from_kernel=*/true); | 348 Finish(thread, /*from_kernel=*/true); |
351 | 349 |
352 // The platform binary may contain other libraries (e.g., dart:_builtin or | 350 // The platform binary may contain other libraries (e.g., dart:_builtin or |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 lib.Register(thread); | 387 lib.Register(thread); |
390 isolate->object_store()->set_bootstrap_library(id, lib); | 388 isolate->object_store()->set_bootstrap_library(id, lib); |
391 } | 389 } |
392 } | 390 } |
393 | 391 |
394 return (kernel_program == NULL) ? BootstrapFromSource(thread) | 392 return (kernel_program == NULL) ? BootstrapFromSource(thread) |
395 : BootstrapFromKernel(thread, kernel_program); | 393 : BootstrapFromKernel(thread, kernel_program); |
396 } | 394 } |
397 | 395 |
398 } // namespace dart | 396 } // namespace dart |
OLD | NEW |