| Index: runtime/vm/dart.cc
|
| diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
|
| index 579691ec6714e39e4bd61ad73e82ef08cacc7460..357423255bc3ae3bbd20abe715e7560888c0c5fb 100644
|
| --- a/runtime/vm/dart.cc
|
| +++ b/runtime/vm/dart.cc
|
| @@ -495,7 +495,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();
|
| @@ -515,11 +518,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"));
|
| @@ -556,7 +566,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);
|
| @@ -584,7 +594,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();
|
|
|