Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: runtime/vm/bootstrap.cc

Issue 2786083002: Read platform.dill in the VM. (Closed)
Patch Set: Incorporate review comments and merge. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/bootstrap_nocore.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Mark the already-pending classes. This mark bit will be used to avoid 351 // Mark the already-pending classes. This mark bit will be used to avoid
352 // adding classes to the list more than once. 352 // adding classes to the list more than once.
353 GrowableObjectArray& pending_classes = GrowableObjectArray::Handle( 353 GrowableObjectArray& pending_classes = GrowableObjectArray::Handle(
354 zone, isolate->object_store()->pending_classes()); 354 zone, isolate->object_store()->pending_classes());
355 dart::Class& pending = dart::Class::Handle(zone); 355 dart::Class& pending = dart::Class::Handle(zone);
356 for (intptr_t i = 0; i < pending_classes.Length(); ++i) { 356 for (intptr_t i = 0; i < pending_classes.Length(); ++i) {
357 pending ^= pending_classes.At(i); 357 pending ^= pending_classes.At(i);
358 pending.set_is_marked_for_parsing(); 358 pending.set_is_marked_for_parsing();
359 } 359 }
360 360
361 // Load the bootstrap libraries in order (see object_store.h).
361 Library& library = Library::Handle(zone); 362 Library& library = Library::Handle(zone);
362 String& dart_name = String::Handle(zone); 363 String& dart_name = String::Handle(zone);
363 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) { 364 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) {
364 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; 365 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
365 library = isolate->object_store()->bootstrap_library(id); 366 library = isolate->object_store()->bootstrap_library(id);
366 dart_name = library.url(); 367 dart_name = library.url();
367 for (intptr_t j = 0; j < program->libraries().length(); ++j) { 368 for (intptr_t j = 0; j < program->libraries().length(); ++j) {
368 kernel::Library* kernel_library = program->libraries()[j]; 369 kernel::Library* kernel_library = program->libraries()[j];
369 kernel::String* uri = kernel_library->import_uri(); 370 kernel::String* uri = kernel_library->import_uri();
370 const String& kernel_name = reader.DartSymbol(uri); 371 const String& kernel_name = reader.DartSymbol(uri);
371 if (kernel_name.Equals(dart_name)) { 372 if (kernel_name.Equals(dart_name)) {
372 reader.ReadLibrary(kernel_library); 373 reader.ReadLibrary(kernel_library);
373 library.SetLoaded(); 374 library.SetLoaded();
374 break; 375 break;
375 } 376 }
376 } 377 }
377 } 378 }
378 379
380 // Finish bootstrapping, including class finalization.
379 Finish(thread, /*from_kernel=*/true); 381 Finish(thread, /*from_kernel=*/true);
382
383 // The platform binary may contain other libraries (e.g., dart:_builtin or
384 // dart:io) that will not be bundled with application. Load them now.
385 reader.ReadProgram();
386
387 // The builtin library should be registered with the VM.
388 dart_name = String::New("dart:_builtin");
389 library = Library::LookupLibrary(thread, dart_name);
390 isolate->object_store()->set_builtin_library(library);
391
380 return Error::null(); 392 return Error::null();
381 } 393 }
382 #else 394 #else
383 static RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { 395 static RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) {
384 UNREACHABLE(); 396 UNREACHABLE();
385 return Error::null(); 397 return Error::null();
386 } 398 }
387 #endif 399 #endif
388 400
389 401
(...skipping 18 matching lines...) Expand all
408 lib.Register(thread); 420 lib.Register(thread);
409 isolate->object_store()->set_bootstrap_library(id, lib); 421 isolate->object_store()->set_bootstrap_library(id, lib);
410 } 422 }
411 } 423 }
412 424
413 return (kernel_program == NULL) ? BootstrapFromSource(thread) 425 return (kernel_program == NULL) ? BootstrapFromSource(thread)
414 : BootstrapFromKernel(thread, kernel_program); 426 : BootstrapFromKernel(thread, kernel_program);
415 } 427 }
416 428
417 } // namespace dart 429 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/bootstrap_nocore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698