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

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

Issue 1336763002: Last snapshot bits to get working precompiled hello_world on x64. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/dart.h" 5 #include "vm/dart.h"
6 6
7 #include "vm/code_observers.h" 7 #include "vm/code_observers.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/dart_api_state.h" 9 #include "vm/dart_api_state.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 26 matching lines...) Expand all
37 DECLARE_FLAG(bool, trace_isolates); 37 DECLARE_FLAG(bool, trace_isolates);
38 DECLARE_FLAG(bool, trace_time_all); 38 DECLARE_FLAG(bool, trace_time_all);
39 DEFINE_FLAG(bool, keep_code, false, 39 DEFINE_FLAG(bool, keep_code, false,
40 "Keep deoptimized code for profiling."); 40 "Keep deoptimized code for profiling.");
41 DEFINE_FLAG(bool, shutdown, true, "Do a clean shutdown of the VM"); 41 DEFINE_FLAG(bool, shutdown, true, "Do a clean shutdown of the VM");
42 42
43 Isolate* Dart::vm_isolate_ = NULL; 43 Isolate* Dart::vm_isolate_ = NULL;
44 ThreadPool* Dart::thread_pool_ = NULL; 44 ThreadPool* Dart::thread_pool_ = NULL;
45 DebugInfo* Dart::pprof_symbol_generator_ = NULL; 45 DebugInfo* Dart::pprof_symbol_generator_ = NULL;
46 ReadOnlyHandles* Dart::predefined_handles_ = NULL; 46 ReadOnlyHandles* Dart::predefined_handles_ = NULL;
47 const uint8_t* Dart::instructions_snapshot_buffer_ = NULL;
47 48
48 // Structure for managing read-only global handles allocation used for 49 // Structure for managing read-only global handles allocation used for
49 // creating global read-only handles that are pre created and initialized 50 // creating global read-only handles that are pre created and initialized
50 // for use across all isolates. Having these global pre created handles 51 // for use across all isolates. Having these global pre created handles
51 // stored in the vm isolate ensures that we don't constantly create and 52 // stored in the vm isolate ensures that we don't constantly create and
52 // destroy handles for read-only objects referred in the VM code 53 // destroy handles for read-only objects referred in the VM code
53 // (e.g: symbols, null object, empty array etc.) 54 // (e.g: symbols, null object, empty array etc.)
54 // The ReadOnlyHandles C++ Wrapper around VMHandles which is a ValueObject is 55 // The ReadOnlyHandles C++ Wrapper around VMHandles which is a ValueObject is
55 // to ensure that the handles area is not trashed by automatic running of C++ 56 // to ensure that the handles area is not trashed by automatic running of C++
56 // static destructors when 'exit()" is called by any isolate. There might be 57 // static destructors when 'exit()" is called by any isolate. There might be
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Object::InitNull(vm_isolate_); 138 Object::InitNull(vm_isolate_);
138 ObjectStore::Init(vm_isolate_); 139 ObjectStore::Init(vm_isolate_);
139 TargetCPUFeatures::InitOnce(); 140 TargetCPUFeatures::InitOnce();
140 Object::InitOnce(vm_isolate_); 141 Object::InitOnce(vm_isolate_);
141 ArgumentsDescriptor::InitOnce(); 142 ArgumentsDescriptor::InitOnce();
142 // When precompiled the stub code is initialized from the snapshot. 143 // When precompiled the stub code is initialized from the snapshot.
143 if (!precompiled) { 144 if (!precompiled) {
144 StubCode::InitOnce(); 145 StubCode::InitOnce();
145 } 146 }
146 if (vm_isolate_snapshot != NULL) { 147 if (vm_isolate_snapshot != NULL) {
148 if (instructions_snapshot != NULL) {
149 vm_isolate_->SetupInstructionsSnapshotPage(instructions_snapshot);
150 }
147 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot); 151 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot);
148 if (snapshot == NULL) { 152 if (snapshot == NULL) {
149 return "Invalid vm isolate snapshot seen."; 153 return "Invalid vm isolate snapshot seen.";
150 } 154 }
151 ASSERT(snapshot->kind() == Snapshot::kFull); 155 ASSERT(snapshot->kind() == Snapshot::kFull);
152 VmIsolateSnapshotReader reader(snapshot->content(), 156 VmIsolateSnapshotReader reader(snapshot->content(),
153 snapshot->length(), 157 snapshot->length(),
154 instructions_snapshot, 158 instructions_snapshot,
155 T); 159 T);
156 const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot()); 160 const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot());
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const String& message = String::Handle( 311 const String& message = String::Handle(
308 String::New("Invalid snapshot.")); 312 String::New("Invalid snapshot."));
309 return ApiError::New(message); 313 return ApiError::New(message);
310 } 314 }
311 ASSERT(snapshot->kind() == Snapshot::kFull); 315 ASSERT(snapshot->kind() == Snapshot::kFull);
312 if (FLAG_trace_isolates) { 316 if (FLAG_trace_isolates) {
313 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); 317 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length());
314 } 318 }
315 IsolateSnapshotReader reader(snapshot->content(), 319 IsolateSnapshotReader reader(snapshot->content(),
316 snapshot->length(), 320 snapshot->length(),
317 Object::instructions_snapshot_buffer(), 321 Dart::instructions_snapshot_buffer(),
318 T); 322 T);
319 const Error& error = Error::Handle(reader.ReadFullSnapshot()); 323 const Error& error = Error::Handle(reader.ReadFullSnapshot());
320 if (!error.IsNull()) { 324 if (!error.IsNull()) {
321 return error.raw(); 325 return error.raw();
322 } 326 }
323 if (FLAG_trace_isolates) { 327 if (FLAG_trace_isolates) {
324 I->heap()->PrintSizes(); 328 I->heap()->PrintSizes();
325 MegamorphicCacheTable::PrintSizes(I); 329 MegamorphicCacheTable::PrintSizes(I);
326 } 330 }
327 } else { 331 } else {
328 // Populate the isolate's symbol table with all symbols from the 332 // Populate the isolate's symbol table with all symbols from the
329 // VM isolate. We do this so that when we generate a full snapshot 333 // VM isolate. We do this so that when we generate a full snapshot
330 // for the isolate we have a unified symbol table that we can then 334 // for the isolate we have a unified symbol table that we can then
331 // read into the VM isolate. 335 // read into the VM isolate.
332 Symbols::AddPredefinedSymbolsToIsolate(); 336 Symbols::AddPredefinedSymbolsToIsolate();
333 } 337 }
334 338
335 Object::VerifyBuiltinVtables(); 339 Object::VerifyBuiltinVtables();
340 #if defined(DEBUG)
341 I->heap()->Verify(kForbidMarked);
342 #endif
336 343
337 { 344 {
338 TimelineDurationScope tds(I, I->GetIsolateStream(), "StubCode::Init"); 345 TimelineDurationScope tds(I, I->GetIsolateStream(), "StubCode::Init");
339 StubCode::Init(I); 346 StubCode::Init(I);
340 } 347 }
341 348
342 MegamorphicCacheTable::InitMissHandler(I); 349 // When running precompiled, the megamorphic miss function/code come from the
siva 2015/09/16 16:45:41 function/code comes from
rmacnak 2015/09/16 18:17:18 Done.
350 // snapshot.
351 if (!Dart::IsRunningPrecompiledCode()) {
352 MegamorphicCacheTable::InitMissHandler(I);
353 }
343 if (snapshot_buffer == NULL) { 354 if (snapshot_buffer == NULL) {
344 if (!I->object_store()->PreallocateObjects()) { 355 if (!I->object_store()->PreallocateObjects()) {
345 return I->object_store()->sticky_error(); 356 return I->object_store()->sticky_error();
346 } 357 }
347 } 358 }
348 359
349 I->heap()->EnableGrowthControl(); 360 I->heap()->EnableGrowthControl();
350 I->set_init_callback_data(data); 361 I->set_init_callback_data(data);
351 Api::SetupAcquiredError(I); 362 Api::SetupAcquiredError(I);
352 if (FLAG_print_class_table) { 363 if (FLAG_print_class_table) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 return predefined_handles_->handles_.IsValidScopedHandle(address); 420 return predefined_handles_->handles_.IsValidScopedHandle(address);
410 } 421 }
411 422
412 423
413 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 424 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
414 ASSERT(predefined_handles_ != NULL); 425 ASSERT(predefined_handles_ != NULL);
415 return predefined_handles_->api_handles_.IsValidHandle(handle); 426 return predefined_handles_->api_handles_.IsValidHandle(handle);
416 } 427 }
417 428
418 } // namespace dart 429 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/heap.h » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698