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

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

Issue 2820363002: Move Kernel strings into the VM's heap. (Closed)
Patch Set: 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
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Library& library = Library::Handle(zone); 361 Library& library = Library::Handle(zone);
362 String& dart_name = String::Handle(zone); 362 String& dart_name = String::Handle(zone);
363 String& kernel_name = String::Handle(zone);
364 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) { 363 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) {
365 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; 364 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
366 library = isolate->object_store()->bootstrap_library(id); 365 library = isolate->object_store()->bootstrap_library(id);
367 dart_name = library.url(); 366 dart_name = library.url();
368 for (intptr_t j = 0; j < program->libraries().length(); ++j) { 367 for (intptr_t j = 0; j < program->libraries().length(); ++j) {
369 kernel::Library* kernel_library = program->libraries()[j]; 368 kernel::Library* kernel_library = program->libraries()[j];
370 kernel::String* uri = kernel_library->import_uri(); 369 kernel::String* uri = kernel_library->import_uri();
371 kernel_name = Symbols::FromUTF8(thread, uri->buffer(), uri->size()); 370 const String& kernel_name = reader.DartSymbol(uri);
372 if (kernel_name.Equals(dart_name)) { 371 if (kernel_name.Equals(dart_name)) {
373 reader.ReadLibrary(kernel_library); 372 reader.ReadLibrary(kernel_library);
374 library.SetLoaded(); 373 library.SetLoaded();
375 break; 374 break;
376 } 375 }
377 } 376 }
378 } 377 }
379 378
380 Finish(thread, /*from_kernel=*/true); 379 Finish(thread, /*from_kernel=*/true);
381 return Error::null(); 380 return Error::null();
(...skipping 27 matching lines...) Expand all
409 lib.Register(thread); 408 lib.Register(thread);
410 isolate->object_store()->set_bootstrap_library(id, lib); 409 isolate->object_store()->set_bootstrap_library(id, lib);
411 } 410 }
412 } 411 }
413 412
414 return (kernel_program == NULL) ? BootstrapFromSource(thread) 413 return (kernel_program == NULL) ? BootstrapFromSource(thread)
415 : BootstrapFromKernel(thread, kernel_program); 414 : BootstrapFromKernel(thread, kernel_program);
416 } 415 }
417 416
418 } // namespace dart 417 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698