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

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

Issue 2441193002: Complain if an embedder fails to provide a vm isolate or isolate snapshot to a VM built without DAR… (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | 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/become.h" 7 #include "vm/become.h"
8 #include "vm/clustered_snapshot.h" 8 #include "vm/clustered_snapshot.h"
9 #include "vm/code_observers.h" 9 #include "vm/code_observers.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 MegamorphicCacheTable::PrintSizes(vm_isolate_); 263 MegamorphicCacheTable::PrintSizes(vm_isolate_);
264 intptr_t size; 264 intptr_t size;
265 intptr_t capacity; 265 intptr_t capacity;
266 Symbols::GetStats(vm_isolate_, &size, &capacity); 266 Symbols::GetStats(vm_isolate_, &size, &capacity);
267 OS::Print("VM Isolate: Number of symbols : %" Pd "\n", size); 267 OS::Print("VM Isolate: Number of symbols : %" Pd "\n", size);
268 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); 268 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity);
269 } 269 }
270 } else { 270 } else {
271 #if defined(DART_PRECOMPILED_RUNTIME) 271 #if defined(DART_PRECOMPILED_RUNTIME)
272 return strdup("Precompiled runtime requires a precompiled snapshot"); 272 return strdup("Precompiled runtime requires a precompiled snapshot");
273 #elif !defined(DART_NO_SNAPSHOT)
274 return strdup("Missing vm isolate snapshot");
273 #else 275 #else
274 snapshot_kind_ = Snapshot::kNone; 276 snapshot_kind_ = Snapshot::kNone;
275 StubCode::InitOnce(); 277 StubCode::InitOnce();
276 Symbols::InitOnce(vm_isolate_); 278 Symbols::InitOnce(vm_isolate_);
277 #endif 279 #endif
278 } 280 }
279 // We need to initialize the constants here for the vm isolate thread due to 281 // We need to initialize the constants here for the vm isolate thread due to
280 // bootstrapping issues. 282 // bootstrapping issues.
281 T->InitVMConstants(); 283 T->InitVMConstants();
282 Scanner::InitOnce(); 284 Scanner::InitOnce();
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return error.raw(); 517 return error.raw();
516 } 518 }
517 if (snapshot_buffer != NULL) { 519 if (snapshot_buffer != NULL) {
518 // Read the snapshot and setup the initial state. 520 // Read the snapshot and setup the initial state.
519 NOT_IN_PRODUCT(TimelineDurationScope tds(T, 521 NOT_IN_PRODUCT(TimelineDurationScope tds(T,
520 Timeline::GetIsolateStream(), "IsolateSnapshotReader")); 522 Timeline::GetIsolateStream(), "IsolateSnapshotReader"));
521 // TODO(turnidge): Remove once length is not part of the snapshot. 523 // TODO(turnidge): Remove once length is not part of the snapshot.
522 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); 524 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer);
523 if (snapshot == NULL) { 525 if (snapshot == NULL) {
524 const String& message = String::Handle( 526 const String& message = String::Handle(
525 String::New("Invalid snapshot.")); 527 String::New("Invalid snapshot"));
526 return ApiError::New(message); 528 return ApiError::New(message);
527 } 529 }
528 ASSERT(Snapshot::IsFull(snapshot->kind())); 530 ASSERT(Snapshot::IsFull(snapshot->kind()));
529 ASSERT(snapshot->kind() == snapshot_kind_); 531 ASSERT(snapshot->kind() == snapshot_kind_);
530 if (FLAG_trace_isolates) { 532 if (FLAG_trace_isolates) {
531 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); 533 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length());
532 } 534 }
533 IsolateSnapshotReader reader(snapshot->kind(), 535 IsolateSnapshotReader reader(snapshot->kind(),
534 snapshot->content(), 536 snapshot->content(),
535 snapshot->length(), 537 snapshot->length(),
536 Dart::instructions_snapshot_buffer(), 538 Dart::instructions_snapshot_buffer(),
537 Dart::data_snapshot_buffer(), 539 Dart::data_snapshot_buffer(),
538 T); 540 T);
539 const Error& error = Error::Handle(reader.ReadFullSnapshot()); 541 const Error& error = Error::Handle(reader.ReadFullSnapshot());
540 if (!error.IsNull()) { 542 if (!error.IsNull()) {
541 return error.raw(); 543 return error.raw();
542 } 544 }
543 NOT_IN_PRODUCT(if (tds.enabled()) { 545 NOT_IN_PRODUCT(if (tds.enabled()) {
544 tds.SetNumArguments(2); 546 tds.SetNumArguments(2);
545 tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length()); 547 tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length());
546 tds.FormatArgument(1, "heapSize", "%" Pd64, 548 tds.FormatArgument(1, "heapSize", "%" Pd64,
547 I->heap()->UsedInWords(Heap::kOld) * kWordSize); 549 I->heap()->UsedInWords(Heap::kOld) * kWordSize);
548 }); 550 });
549 if (FLAG_trace_isolates) { 551 if (FLAG_trace_isolates) {
550 I->heap()->PrintSizes(); 552 I->heap()->PrintSizes();
551 MegamorphicCacheTable::PrintSizes(I); 553 MegamorphicCacheTable::PrintSizes(I);
552 } 554 }
553 } else { 555 } else {
554 ASSERT(snapshot_kind_ == Snapshot::kNone); 556 if (snapshot_kind_ != Snapshot::kNone) {
557 const String& message = String::Handle(
558 String::New("Missing isolate snapshot"));
559 return ApiError::New(message);
560 }
555 } 561 }
556 562
557 Object::VerifyBuiltinVtables(); 563 Object::VerifyBuiltinVtables();
558 DEBUG_ONLY(I->heap()->Verify(kForbidMarked)); 564 DEBUG_ONLY(I->heap()->Verify(kForbidMarked));
559 565
560 { 566 {
561 NOT_IN_PRODUCT(TimelineDurationScope tds(T, 567 NOT_IN_PRODUCT(TimelineDurationScope tds(T,
562 Timeline::GetIsolateStream(), "StubCode::Init")); 568 Timeline::GetIsolateStream(), "StubCode::Init"));
563 StubCode::Init(I); 569 StubCode::Init(I);
564 } 570 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 return predefined_handles_->handles_.IsValidScopedHandle(address); 726 return predefined_handles_->handles_.IsValidScopedHandle(address);
721 } 727 }
722 728
723 729
724 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 730 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
725 ASSERT(predefined_handles_ != NULL); 731 ASSERT(predefined_handles_ != NULL);
726 return predefined_handles_->api_handles_.IsValidHandle(handle); 732 return predefined_handles_->api_handles_.IsValidHandle(handle);
727 } 733 }
728 734
729 } // namespace dart 735 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698