OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 | 1655 |
1656 void ReadFill(Deserializer* d) { | 1656 void ReadFill(Deserializer* d) { |
1657 bool is_vm_object = d->isolate() == Dart::vm_isolate(); | 1657 bool is_vm_object = d->isolate() == Dart::vm_isolate(); |
1658 | 1658 |
1659 for (intptr_t id = start_index_; id < stop_index_; id++) { | 1659 for (intptr_t id = start_index_; id < stop_index_; id++) { |
1660 RawCode* code = reinterpret_cast<RawCode*>(d->Ref(id)); | 1660 RawCode* code = reinterpret_cast<RawCode*>(d->Ref(id)); |
1661 Deserializer::InitializeHeader(code, kCodeCid, Code::InstanceSize(0), | 1661 Deserializer::InitializeHeader(code, kCodeCid, Code::InstanceSize(0), |
1662 is_vm_object); | 1662 is_vm_object); |
1663 | 1663 |
1664 int32_t text_offset = d->Read<int32_t>(); | 1664 int32_t text_offset = d->Read<int32_t>(); |
1665 RawInstructions* instr = reinterpret_cast<RawInstructions*>( | 1665 RawInstructions* instr = d->GetInstructionsAt(text_offset); |
1666 d->GetInstructionsAt(text_offset) + kHeapObjectTag); | |
1667 | 1666 |
1668 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); | 1667 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); |
1669 code->ptr()->checked_entry_point_ = | 1668 code->ptr()->checked_entry_point_ = |
1670 Instructions::CheckedEntryPoint(instr); | 1669 Instructions::CheckedEntryPoint(instr); |
1671 NOT_IN_PRECOMPILED(code->ptr()->active_instructions_ = instr); | 1670 NOT_IN_PRECOMPILED(code->ptr()->active_instructions_ = instr); |
1672 code->ptr()->instructions_ = instr; | 1671 code->ptr()->instructions_ = instr; |
1673 | 1672 |
1674 #if !defined(DART_PRECOMPILED_RUNTIME) | 1673 #if !defined(DART_PRECOMPILED_RUNTIME) |
1675 if (d->kind() == Snapshot::kAppJIT) { | 1674 if (d->kind() == Snapshot::kAppJIT) { |
1676 int32_t text_offset = d->Read<int32_t>(); | 1675 int32_t text_offset = d->Read<int32_t>(); |
1677 RawInstructions* instr = reinterpret_cast<RawInstructions*>( | 1676 RawInstructions* instr = d->GetInstructionsAt(text_offset); |
1678 d->GetInstructionsAt(text_offset) + kHeapObjectTag); | |
1679 code->ptr()->active_instructions_ = instr; | 1677 code->ptr()->active_instructions_ = instr; |
1680 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); | 1678 code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr); |
1681 code->ptr()->checked_entry_point_ = | 1679 code->ptr()->checked_entry_point_ = |
1682 Instructions::CheckedEntryPoint(instr); | 1680 Instructions::CheckedEntryPoint(instr); |
1683 } | 1681 } |
1684 #endif // !DART_PRECOMPILED_RUNTIME | 1682 #endif // !DART_PRECOMPILED_RUNTIME |
1685 | 1683 |
1686 code->ptr()->object_pool_ = | 1684 code->ptr()->object_pool_ = |
1687 reinterpret_cast<RawObjectPool*>(d->ReadRef()); | 1685 reinterpret_cast<RawObjectPool*>(d->ReadRef()); |
1688 code->ptr()->owner_ = d->ReadRef(); | 1686 code->ptr()->owner_ = d->ReadRef(); |
(...skipping 3099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4788 | 4786 |
4789 // Note we are not clearing the object id table. The full ref table | 4787 // Note we are not clearing the object id table. The full ref table |
4790 // of the vm isolate snapshot serves as the base objects for the | 4788 // of the vm isolate snapshot serves as the base objects for the |
4791 // regular isolate snapshot. | 4789 // regular isolate snapshot. |
4792 | 4790 |
4793 // Return the number of objects, -1 accounts for unused ref 0. | 4791 // Return the number of objects, -1 accounts for unused ref 0. |
4794 return next_ref_index_ - 1; | 4792 return next_ref_index_ - 1; |
4795 } | 4793 } |
4796 | 4794 |
4797 | 4795 |
4798 void Serializer::WriteFullSnapshot(intptr_t num_base_objects, | 4796 void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects, |
4799 ObjectStore* object_store) { | 4797 ObjectStore* object_store) { |
4800 NoSafepointScope no_safepoint; | 4798 NoSafepointScope no_safepoint; |
4801 | 4799 |
4802 if (num_base_objects == 0) { | 4800 if (num_base_objects == 0) { |
4803 // Units tests not writing a new vm isolate. | 4801 // Units tests not writing a new vm isolate. |
4804 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); | 4802 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); |
4805 for (intptr_t i = 1; i < base_objects.Length(); i++) { | 4803 for (intptr_t i = 1; i < base_objects.Length(); i++) { |
4806 AddBaseObject(base_objects.At(i)); | 4804 AddBaseObject(base_objects.At(i)); |
4807 } | 4805 } |
4808 } else { | 4806 } else { |
4809 // Base objects carried over from WriteVMIsolateSnapshot. | 4807 // Base objects carried over from WriteVMIsolateSnapshot. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5188 | 5186 |
5189 Symbols::InitOnceFromSnapshot(isolate()); | 5187 Symbols::InitOnceFromSnapshot(isolate()); |
5190 | 5188 |
5191 Object::set_vm_isolate_snapshot_object_table(refs); | 5189 Object::set_vm_isolate_snapshot_object_table(refs); |
5192 | 5190 |
5193 #if defined(DEBUG) | 5191 #if defined(DEBUG) |
5194 isolate()->ValidateClassTable(); | 5192 isolate()->ValidateClassTable(); |
5195 #endif | 5193 #endif |
5196 } | 5194 } |
5197 | 5195 |
5198 void Deserializer::ReadFullSnapshot(ObjectStore* object_store) { | 5196 void Deserializer::ReadIsolateSnapshot(ObjectStore* object_store) { |
5199 Array& refs = Array::Handle(); | 5197 Array& refs = Array::Handle(); |
5200 Prepare(); | 5198 Prepare(); |
5201 | 5199 |
5202 { | 5200 { |
5203 NoSafepointScope no_safepoint; | 5201 NoSafepointScope no_safepoint; |
5204 HeapLocker hl(thread(), heap_->old_space()); | 5202 HeapLocker hl(thread(), heap_->old_space()); |
5205 | 5203 |
5206 // N.B.: Skipping index 0 because ref 0 is illegal. | 5204 // N.B.: Skipping index 0 because ref 0 is illegal. |
5207 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); | 5205 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); |
5208 for (intptr_t i = 1; i < base_objects.Length(); i++) { | 5206 for (intptr_t i = 1; i < base_objects.Length(); i++) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5274 | 5272 |
5275 intptr_t count() const { return count_; } | 5273 intptr_t count() const { return count_; } |
5276 | 5274 |
5277 private: | 5275 private: |
5278 Object& objHandle_; | 5276 Object& objHandle_; |
5279 intptr_t count_; | 5277 intptr_t count_; |
5280 const Array* token_streams_; | 5278 const Array* token_streams_; |
5281 }; | 5279 }; |
5282 | 5280 |
5283 | 5281 |
5284 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind, | 5282 FullSnapshotWriter::FullSnapshotWriter( |
5285 uint8_t** vm_isolate_snapshot_buffer, | 5283 Snapshot::Kind kind, |
5286 uint8_t** isolate_snapshot_buffer, | 5284 uint8_t** vm_snapshot_data_buffer, |
5287 ReAlloc alloc, | 5285 uint8_t** isolate_snapshot_data_buffer, |
5288 InstructionsWriter* instructions_writer) | 5286 ReAlloc alloc, |
| 5287 InstructionsWriter* vm_instructions_writer, |
| 5288 InstructionsWriter* isolate_instructions_writer) |
5289 : thread_(Thread::Current()), | 5289 : thread_(Thread::Current()), |
5290 kind_(kind), | 5290 kind_(kind), |
5291 vm_isolate_snapshot_buffer_(vm_isolate_snapshot_buffer), | 5291 vm_snapshot_data_buffer_(vm_snapshot_data_buffer), |
5292 isolate_snapshot_buffer_(isolate_snapshot_buffer), | 5292 isolate_snapshot_data_buffer_(isolate_snapshot_data_buffer), |
5293 alloc_(alloc), | 5293 alloc_(alloc), |
5294 vm_isolate_snapshot_size_(0), | 5294 vm_isolate_snapshot_size_(0), |
5295 isolate_snapshot_size_(0), | 5295 isolate_snapshot_size_(0), |
5296 instructions_writer_(instructions_writer), | 5296 vm_instructions_writer_(vm_instructions_writer), |
| 5297 isolate_instructions_writer_(isolate_instructions_writer), |
5297 token_streams_(Array::Handle(zone())), | 5298 token_streams_(Array::Handle(zone())), |
5298 saved_symbol_table_(Array::Handle(zone())), | 5299 saved_symbol_table_(Array::Handle(zone())), |
5299 new_vm_symbol_table_(Array::Handle(zone())) { | 5300 new_vm_symbol_table_(Array::Handle(zone())), |
5300 ASSERT(isolate_snapshot_buffer_ != NULL); | 5301 clustered_vm_size_(0), |
| 5302 clustered_isolate_size_(0), |
| 5303 mapped_data_size_(0), |
| 5304 mapped_instructions_size_(0) { |
| 5305 ASSERT(isolate_snapshot_data_buffer_ != NULL); |
5301 ASSERT(alloc_ != NULL); | 5306 ASSERT(alloc_ != NULL); |
5302 ASSERT(isolate() != NULL); | 5307 ASSERT(isolate() != NULL); |
5303 ASSERT(ClassFinalizer::AllClassesFinalized()); | 5308 ASSERT(ClassFinalizer::AllClassesFinalized()); |
5304 ASSERT(isolate() != NULL); | 5309 ASSERT(isolate() != NULL); |
5305 ASSERT(heap() != NULL); | 5310 ASSERT(heap() != NULL); |
5306 ObjectStore* object_store = isolate()->object_store(); | 5311 ObjectStore* object_store = isolate()->object_store(); |
5307 ASSERT(object_store != NULL); | 5312 ASSERT(object_store != NULL); |
5308 | 5313 |
5309 #if defined(DEBUG) | 5314 #if defined(DEBUG) |
5310 // Ensure the class table is valid. | 5315 // Ensure the class table is valid. |
5311 isolate()->ValidateClassTable(); | 5316 isolate()->ValidateClassTable(); |
5312 #endif | 5317 #endif |
5313 // Can't have any mutation happening while we're serializing. | 5318 // Can't have any mutation happening while we're serializing. |
5314 ASSERT(isolate()->background_compiler() == NULL); | 5319 ASSERT(isolate()->background_compiler() == NULL); |
5315 | 5320 |
5316 if (vm_isolate_snapshot_buffer != NULL) { | 5321 if (vm_snapshot_data_buffer != NULL) { |
5317 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5322 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5318 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); | 5323 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); |
5319 | 5324 |
5320 // Collect all the token stream objects into an array so that we can write | 5325 // Collect all the token stream objects into an array so that we can write |
5321 // it out as part of the VM isolate snapshot. We first count the number of | 5326 // it out as part of the VM isolate snapshot. We first count the number of |
5322 // token streams, allocate an array and then fill it up with the token | 5327 // token streams, allocate an array and then fill it up with the token |
5323 // streams. | 5328 // streams. |
5324 SnapshotTokenStreamVisitor token_streams_counter(thread()); | 5329 SnapshotTokenStreamVisitor token_streams_counter(thread()); |
5325 heap()->IterateOldObjects(&token_streams_counter); | 5330 heap()->IterateOldObjects(&token_streams_counter); |
5326 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); | 5331 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); |
(...skipping 23 matching lines...) Expand all Loading... |
5350 // We may run Dart code afterwards, restore the symbol table if needed. | 5355 // We may run Dart code afterwards, restore the symbol table if needed. |
5351 if (!saved_symbol_table_.IsNull()) { | 5356 if (!saved_symbol_table_.IsNull()) { |
5352 isolate()->object_store()->set_symbol_table(saved_symbol_table_); | 5357 isolate()->object_store()->set_symbol_table(saved_symbol_table_); |
5353 saved_symbol_table_ = Array::null(); | 5358 saved_symbol_table_ = Array::null(); |
5354 } | 5359 } |
5355 new_vm_symbol_table_ = Array::null(); | 5360 new_vm_symbol_table_ = Array::null(); |
5356 token_streams_ = Array::null(); | 5361 token_streams_ = Array::null(); |
5357 } | 5362 } |
5358 | 5363 |
5359 | 5364 |
5360 intptr_t FullSnapshotWriter::WriteVmIsolateSnapshot() { | 5365 intptr_t FullSnapshotWriter::WriteVMSnapshot() { |
5361 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5366 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5362 thread(), Timeline::GetIsolateStream(), "WriteVmIsolateSnapshot")); | 5367 thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot")); |
5363 | 5368 |
5364 ASSERT(vm_isolate_snapshot_buffer_ != NULL); | 5369 ASSERT(vm_snapshot_data_buffer_ != NULL); |
5365 Serializer serializer(thread(), kind_, vm_isolate_snapshot_buffer_, alloc_, | 5370 Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_, |
5366 kInitialSize, instructions_writer_); | 5371 kInitialSize, vm_instructions_writer_); |
5367 | 5372 |
5368 serializer.ReserveHeader(); | 5373 serializer.ReserveHeader(); |
5369 serializer.WriteVersionAndFeatures(); | 5374 serializer.WriteVersionAndFeatures(); |
5370 /* | 5375 // VM snapshot roots are: |
5371 * Now Write out the following | 5376 // - the symbol table |
5372 * - the symbol table | 5377 // - all the token streams |
5373 * - all the token streams | 5378 // - the stub code (precompiled snapshots only) |
5374 * - the stub code (precompiled snapshots only) | |
5375 **/ | |
5376 intptr_t num_objects = | 5379 intptr_t num_objects = |
5377 serializer.WriteVMSnapshot(new_vm_symbol_table_, token_streams_); | 5380 serializer.WriteVMSnapshot(new_vm_symbol_table_, token_streams_); |
5378 serializer.FillHeader(serializer.kind()); | 5381 serializer.FillHeader(serializer.kind()); |
| 5382 clustered_vm_size_ = serializer.bytes_written(); |
5379 | 5383 |
| 5384 if (Snapshot::IncludesCode(kind_)) { |
| 5385 vm_instructions_writer_->Write(serializer.stream(), true); |
| 5386 mapped_data_size_ += vm_instructions_writer_->data_size(); |
| 5387 mapped_instructions_size_ += vm_instructions_writer_->text_size(); |
| 5388 vm_instructions_writer_->ResetOffsets(); |
| 5389 } |
| 5390 |
| 5391 // The clustered part + the direct mapped data part. |
5380 vm_isolate_snapshot_size_ = serializer.bytes_written(); | 5392 vm_isolate_snapshot_size_ = serializer.bytes_written(); |
5381 return num_objects; | 5393 return num_objects; |
5382 } | 5394 } |
5383 | 5395 |
5384 | 5396 |
5385 void FullSnapshotWriter::WriteIsolateFullSnapshot(intptr_t num_base_objects) { | 5397 void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) { |
5386 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5398 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5387 thread(), Timeline::GetIsolateStream(), "WriteIsolateFullSnapshot")); | 5399 thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot")); |
5388 | 5400 |
5389 Serializer serializer(thread(), kind_, isolate_snapshot_buffer_, alloc_, | 5401 Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_, |
5390 kInitialSize, instructions_writer_); | 5402 kInitialSize, isolate_instructions_writer_); |
5391 ObjectStore* object_store = isolate()->object_store(); | 5403 ObjectStore* object_store = isolate()->object_store(); |
5392 ASSERT(object_store != NULL); | 5404 ASSERT(object_store != NULL); |
5393 | 5405 |
5394 serializer.ReserveHeader(); | 5406 serializer.ReserveHeader(); |
5395 serializer.WriteVersionAndFeatures(); | 5407 serializer.WriteVersionAndFeatures(); |
5396 serializer.WriteFullSnapshot(num_base_objects, object_store); | 5408 // Isolate snapshot roots are: |
| 5409 // - the object store |
| 5410 serializer.WriteIsolateSnapshot(num_base_objects, object_store); |
5397 serializer.FillHeader(serializer.kind()); | 5411 serializer.FillHeader(serializer.kind()); |
| 5412 clustered_isolate_size_ = serializer.bytes_written(); |
5398 | 5413 |
| 5414 if (Snapshot::IncludesCode(kind_)) { |
| 5415 isolate_instructions_writer_->Write(serializer.stream(), false); |
| 5416 mapped_data_size_ += isolate_instructions_writer_->data_size(); |
| 5417 mapped_instructions_size_ += isolate_instructions_writer_->text_size(); |
| 5418 isolate_instructions_writer_->ResetOffsets(); |
| 5419 } |
| 5420 |
| 5421 // The clustered part + the direct mapped data part. |
5399 isolate_snapshot_size_ = serializer.bytes_written(); | 5422 isolate_snapshot_size_ = serializer.bytes_written(); |
5400 } | 5423 } |
5401 | 5424 |
5402 | 5425 |
5403 void FullSnapshotWriter::WriteFullSnapshot() { | 5426 void FullSnapshotWriter::WriteFullSnapshot() { |
5404 intptr_t num_base_objects; | 5427 intptr_t num_base_objects; |
5405 if (vm_isolate_snapshot_buffer() != NULL) { | 5428 if (vm_snapshot_data_buffer() != NULL) { |
5406 num_base_objects = WriteVmIsolateSnapshot(); | 5429 num_base_objects = WriteVMSnapshot(); |
5407 ASSERT(num_base_objects != 0); | 5430 ASSERT(num_base_objects != 0); |
5408 } else { | 5431 } else { |
5409 num_base_objects = 0; | 5432 num_base_objects = 0; |
5410 } | 5433 } |
5411 | 5434 |
5412 WriteIsolateFullSnapshot(num_base_objects); | 5435 WriteIsolateSnapshot(num_base_objects); |
5413 | 5436 |
5414 if (FLAG_print_snapshot_sizes) { | 5437 if (FLAG_print_snapshot_sizes) { |
5415 OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize()); | 5438 OS::Print("VMIsolate(CodeSize): %" Pd "\n", clustered_vm_size_); |
5416 OS::Print("Isolate(CodeSize): %" Pd "\n", IsolateSnapshotSize()); | 5439 OS::Print("Isolate(CodeSize): %" Pd "\n", clustered_isolate_size_); |
5417 } | 5440 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", mapped_data_size_); |
5418 intptr_t total_size = VmIsolateSnapshotSize() + IsolateSnapshotSize(); | 5441 OS::Print("Instructions(CodeSize): %" Pd "\n", mapped_instructions_size_); |
5419 | 5442 OS::Print("Total(CodeSize): %" Pd "\n", |
5420 if (Snapshot::IncludesCode(kind_)) { | 5443 clustered_vm_size_ + clustered_isolate_size_ + mapped_data_size_ + |
5421 instructions_writer_->Write( | 5444 mapped_instructions_size_); |
5422 vm_isolate_snapshot_buffer_ == NULL ? NULL | |
5423 : *vm_isolate_snapshot_buffer_, | |
5424 vm_isolate_snapshot_size_, *isolate_snapshot_buffer_, | |
5425 isolate_snapshot_size_); | |
5426 | |
5427 if (FLAG_print_snapshot_sizes) { | |
5428 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", | |
5429 instructions_writer_->data_size()); | |
5430 OS::Print("Instructions(CodeSize): %" Pd "\n", | |
5431 instructions_writer_->text_size()); | |
5432 } | |
5433 total_size += | |
5434 instructions_writer_->data_size() + instructions_writer_->text_size(); | |
5435 } | |
5436 | |
5437 if (FLAG_print_snapshot_sizes) { | |
5438 OS::Print("Total(CodeSize): %" Pd "\n", total_size); | |
5439 } | 5445 } |
5440 } | 5446 } |
5441 | 5447 |
5442 | 5448 |
5443 RawApiError* IsolateSnapshotReader::ReadFullSnapshot() { | 5449 static const uint8_t* DataBuffer(const Snapshot* snapshot) { |
| 5450 if (Snapshot::IncludesCode(snapshot->kind())) { |
| 5451 uword offset = |
| 5452 Utils::RoundUp(snapshot->length(), OS::kMaxPreferredCodeAlignment); |
| 5453 return snapshot->Addr() + offset; |
| 5454 } |
| 5455 return NULL; |
| 5456 } |
| 5457 |
| 5458 |
| 5459 FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot, |
| 5460 const uint8_t* instructions_buffer, |
| 5461 Thread* thread) |
| 5462 : kind_(snapshot->kind()), |
| 5463 thread_(thread), |
| 5464 buffer_(snapshot->content()), |
| 5465 size_(snapshot->length()), |
| 5466 instructions_buffer_(instructions_buffer), |
| 5467 data_buffer_(DataBuffer(snapshot)) { |
| 5468 thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kAppAOT); |
| 5469 } |
| 5470 |
| 5471 |
| 5472 RawApiError* FullSnapshotReader::ReadVMSnapshot() { |
5444 Deserializer deserializer(thread_, kind_, buffer_, size_, | 5473 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5445 instructions_buffer_, data_buffer_); | 5474 instructions_buffer_, data_buffer_); |
5446 | 5475 |
5447 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5476 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5448 if (error != ApiError::null()) { | 5477 if (error != ApiError::null()) { |
5449 return error; | 5478 return error; |
5450 } | 5479 } |
5451 | 5480 |
5452 deserializer.ReadFullSnapshot(thread_->isolate()->object_store()); | 5481 if (instructions_buffer_ != NULL) { |
| 5482 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_); |
| 5483 } |
| 5484 if (data_buffer_ != NULL) { |
| 5485 thread_->isolate()->SetupDataSnapshotPage(data_buffer_); |
| 5486 } |
| 5487 |
| 5488 deserializer.ReadVMSnapshot(); |
5453 | 5489 |
5454 return ApiError::null(); | 5490 return ApiError::null(); |
5455 } | 5491 } |
5456 | 5492 |
5457 | 5493 |
5458 RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() { | 5494 RawApiError* FullSnapshotReader::ReadIsolateSnapshot() { |
5459 Deserializer deserializer(thread_, kind_, buffer_, size_, | 5495 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5460 instructions_buffer_, data_buffer_); | 5496 instructions_buffer_, data_buffer_); |
5461 | 5497 |
5462 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5498 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5463 if (error != ApiError::null()) { | 5499 if (error != ApiError::null()) { |
5464 return error; | 5500 return error; |
5465 } | 5501 } |
5466 | 5502 |
5467 deserializer.ReadVMSnapshot(); | 5503 if (instructions_buffer_ != NULL) { |
| 5504 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_); |
| 5505 } |
| 5506 if (data_buffer_ != NULL) { |
| 5507 thread_->isolate()->SetupDataSnapshotPage(data_buffer_); |
| 5508 } |
5468 | 5509 |
5469 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5510 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
5470 Dart::set_data_snapshot_buffer(data_buffer_); | |
5471 | 5511 |
5472 return ApiError::null(); | 5512 return ApiError::null(); |
5473 } | 5513 } |
5474 | 5514 |
5475 } // namespace dart | 5515 } // namespace dart |
OLD | NEW |