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

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
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/heap.h » ('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) 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 const String& message = String::Handle( 310 const String& message = String::Handle(
307 String::New("Invalid snapshot.")); 311 String::New("Invalid snapshot."));
308 return ApiError::New(message); 312 return ApiError::New(message);
309 } 313 }
310 ASSERT(snapshot->kind() == Snapshot::kFull); 314 ASSERT(snapshot->kind() == Snapshot::kFull);
311 if (FLAG_trace_isolates) { 315 if (FLAG_trace_isolates) {
312 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); 316 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length());
313 } 317 }
314 IsolateSnapshotReader reader(snapshot->content(), 318 IsolateSnapshotReader reader(snapshot->content(),
315 snapshot->length(), 319 snapshot->length(),
316 Object::instructions_snapshot_buffer(), 320 Dart::instructions_snapshot_buffer(),
317 T); 321 T);
318 const Error& error = Error::Handle(reader.ReadFullSnapshot()); 322 const Error& error = Error::Handle(reader.ReadFullSnapshot());
319 if (!error.IsNull()) { 323 if (!error.IsNull()) {
320 return error.raw(); 324 return error.raw();
321 } 325 }
322 if (FLAG_trace_isolates) { 326 if (FLAG_trace_isolates) {
323 I->heap()->PrintSizes(); 327 I->heap()->PrintSizes();
324 MegamorphicCacheTable::PrintSizes(I); 328 MegamorphicCacheTable::PrintSizes(I);
325 } 329 }
326 } else { 330 } else {
327 // Populate the isolate's symbol table with all symbols from the 331 // Populate the isolate's symbol table with all symbols from the
328 // VM isolate. We do this so that when we generate a full snapshot 332 // VM isolate. We do this so that when we generate a full snapshot
329 // for the isolate we have a unified symbol table that we can then 333 // for the isolate we have a unified symbol table that we can then
330 // read into the VM isolate. 334 // read into the VM isolate.
331 Symbols::AddPredefinedSymbolsToIsolate(); 335 Symbols::AddPredefinedSymbolsToIsolate();
332 } 336 }
333 337
334 Object::VerifyBuiltinVtables(); 338 Object::VerifyBuiltinVtables();
339 #if defined(DEBUG)
340 I->heap()->Verify(kForbidMarked);
341 #endif
335 342
336 { 343 {
337 TimelineDurationScope tds(I, I->GetIsolateStream(), "StubCode::Init"); 344 TimelineDurationScope tds(I, I->GetIsolateStream(), "StubCode::Init");
338 StubCode::Init(I); 345 StubCode::Init(I);
339 } 346 }
340 347
341 MegamorphicCacheTable::InitMissHandler(I); 348 // When running precompiled, the megamorphic miss function/code comes from the
349 // snapshot.
350 if (!Dart::IsRunningPrecompiledCode()) {
351 MegamorphicCacheTable::InitMissHandler(I);
352 }
342 if (snapshot_buffer == NULL) { 353 if (snapshot_buffer == NULL) {
343 if (!I->object_store()->PreallocateObjects()) { 354 if (!I->object_store()->PreallocateObjects()) {
344 return I->object_store()->sticky_error(); 355 return I->object_store()->sticky_error();
345 } 356 }
346 } 357 }
347 358
348 I->heap()->EnableGrowthControl(); 359 I->heap()->EnableGrowthControl();
349 I->set_init_callback_data(data); 360 I->set_init_callback_data(data);
350 Api::SetupAcquiredError(I); 361 Api::SetupAcquiredError(I);
351 if (FLAG_print_class_table) { 362 if (FLAG_print_class_table) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 return predefined_handles_->handles_.IsValidScopedHandle(address); 419 return predefined_handles_->handles_.IsValidScopedHandle(address);
409 } 420 }
410 421
411 422
412 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 423 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
413 ASSERT(predefined_handles_ != NULL); 424 ASSERT(predefined_handles_ != NULL);
414 return predefined_handles_->api_handles_.IsValidHandle(handle); 425 return predefined_handles_->api_handles_.IsValidHandle(handle);
415 } 426 }
416 427
417 } // namespace dart 428 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698