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

Unified Diff: runtime/vm/dart.cc

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart.cc
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index bf490bfa0ed5a50ced76b639d79a50fb98136912..a3d3da68fce35bfd974c2699c8a87779c25978cb 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -491,7 +491,10 @@ Isolate* Dart::CreateIsolate(const char* name_prefix,
}
-RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
+RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer,
+ intptr_t snapshot_length,
+ bool from_kernel,
+ void* data) {
// Initialize the new isolate.
Thread* T = Thread::Current();
Isolate* I = T->isolate();
@@ -508,11 +511,18 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
ObjectStore::Init(I);
}
- const Error& error = Error::Handle(Object::Init(I));
+ Error& error = Error::Handle(T->zone());
+ if (from_kernel) {
+ ASSERT(snapshot_buffer != NULL);
+ ASSERT(snapshot_length > 0);
+ error = Object::Init(I, snapshot_buffer, snapshot_length);
+ } else {
+ error = Object::Init(I, NULL, -1);
+ }
if (!error.IsNull()) {
return error.raw();
}
- if (snapshot_buffer != NULL) {
+ if ((snapshot_buffer != NULL) && !from_kernel) {
// Read the snapshot and setup the initial state.
NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
"IsolateSnapshotReader"));
@@ -553,7 +563,7 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
MegamorphicCacheTable::PrintSizes(I);
}
} else {
- if (snapshot_kind_ != Snapshot::kNone) {
+ if ((snapshot_kind_ != Snapshot::kNone) && !from_kernel) {
const String& message =
String::Handle(String::New("Missing isolate snapshot"));
return ApiError::New(message);
@@ -581,7 +591,7 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
Code::Handle(I->object_store()->megamorphic_miss_code());
I->set_ic_miss_code(miss_code);
- if (snapshot_buffer == NULL) {
+ if ((snapshot_buffer == NULL) || from_kernel) {
const Error& error = Error::Handle(I->object_store()->PreallocateObjects());
if (!error.IsNull()) {
return error.raw();

Powered by Google App Engine
This is Rietveld 408576698