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

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

Issue 2517953002: Revert "Merge of source position information from kernel-sdk." (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 return error.raw(); 315 return error.raw();
316 } 316 }
317 317
318 318
319 #if !defined(DART_PRECOMPILED_RUNTIME) 319 #if !defined(DART_PRECOMPILED_RUNTIME)
320 static RawError* BootstrapFromKernel(Thread* thread, 320 static RawError* BootstrapFromKernel(Thread* thread,
321 const uint8_t* buffer, 321 const uint8_t* buffer,
322 intptr_t buffer_size) { 322 intptr_t buffer_size) {
323 Zone* zone = thread->zone(); 323 Zone* zone = thread->zone();
324 kernel::KernelReader reader(buffer, buffer_size, true); 324 kernel::Program* program =
325 kernel::Program* program = reader.ReadPrecompiledProgram(); 325 ReadPrecompiledKernelFromBuffer(buffer, buffer_size);
326 if (program == NULL) { 326 if (program == NULL) {
327 const String& message = 327 const String& message =
328 String::Handle(zone, String::New("Failed to read Kernel file")); 328 String::Handle(zone, String::New("Failed to read Kernel file"));
329 return ApiError::New(message); 329 return ApiError::New(message);
330 } 330 }
331 331
332 Isolate* isolate = thread->isolate(); 332 Isolate* isolate = thread->isolate();
333 // Mark the already-pending classes. This mark bit will be used to avoid 333 // Mark the already-pending classes. This mark bit will be used to avoid
334 // adding classes to the list more than once. 334 // adding classes to the list more than once.
335 GrowableObjectArray& pending_classes = GrowableObjectArray::Handle( 335 GrowableObjectArray& pending_classes = GrowableObjectArray::Handle(
336 zone, isolate->object_store()->pending_classes()); 336 zone, isolate->object_store()->pending_classes());
337 dart::Class& pending = dart::Class::Handle(zone); 337 dart::Class& pending = dart::Class::Handle(zone);
338 for (intptr_t i = 0; i < pending_classes.Length(); ++i) { 338 for (intptr_t i = 0; i < pending_classes.Length(); ++i) {
339 pending ^= pending_classes.At(i); 339 pending ^= pending_classes.At(i);
340 pending.set_is_marked_for_parsing(); 340 pending.set_is_marked_for_parsing();
341 } 341 }
342 342
343 Library& library = Library::Handle(zone); 343 Library& library = Library::Handle(zone);
344 String& dart_name = String::Handle(zone); 344 String& dart_name = String::Handle(zone);
345 String& kernel_name = String::Handle(zone); 345 String& kernel_name = String::Handle(zone);
346 kernel::KernelReader reader(NULL, -1, true);
346 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) { 347 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) {
347 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index; 348 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
348 library = isolate->object_store()->bootstrap_library(id); 349 library = isolate->object_store()->bootstrap_library(id);
349 dart_name = library.url(); 350 dart_name = library.url();
350 for (intptr_t j = 0; j < program->libraries().length(); ++j) { 351 for (intptr_t j = 0; j < program->libraries().length(); ++j) {
351 kernel::Library* kernel_library = program->libraries()[j]; 352 kernel::Library* kernel_library = program->libraries()[j];
352 kernel::String* uri = kernel_library->import_uri(); 353 kernel::String* uri = kernel_library->import_uri();
353 kernel_name = Symbols::FromUTF8(thread, uri->buffer(), uri->size()); 354 kernel_name = Symbols::FromUTF8(thread, uri->buffer(), uri->size());
354 if (kernel_name.Equals(dart_name)) { 355 if (kernel_name.Equals(dart_name)) {
355 reader.ReadLibrary(kernel_library); 356 reader.ReadLibrary(kernel_library);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 isolate->object_store()->set_bootstrap_library(id, lib); 396 isolate->object_store()->set_bootstrap_library(id, lib);
396 } 397 }
397 } 398 }
398 399
399 return (kernel_buffer == NULL) 400 return (kernel_buffer == NULL)
400 ? BootstrapFromSource(thread) 401 ? BootstrapFromSource(thread)
401 : BootstrapFromKernel(thread, kernel_buffer, kernel_buffer_length); 402 : BootstrapFromKernel(thread, kernel_buffer, kernel_buffer_length);
402 } 403 }
403 404
404 } // namespace dart 405 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/bootstrap_nocore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698