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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5189 | 5187 |
5190 Symbols::InitOnceFromSnapshot(isolate()); | 5188 Symbols::InitOnceFromSnapshot(isolate()); |
5191 | 5189 |
5192 Object::set_vm_isolate_snapshot_object_table(refs); | 5190 Object::set_vm_isolate_snapshot_object_table(refs); |
5193 | 5191 |
5194 #if defined(DEBUG) | 5192 #if defined(DEBUG) |
5195 isolate()->ValidateClassTable(); | 5193 isolate()->ValidateClassTable(); |
5196 #endif | 5194 #endif |
5197 } | 5195 } |
5198 | 5196 |
5199 void Deserializer::ReadFullSnapshot(ObjectStore* object_store) { | 5197 void Deserializer::ReadIsolateSnapshot(ObjectStore* object_store) { |
5200 Array& refs = Array::Handle(); | 5198 Array& refs = Array::Handle(); |
5201 Prepare(); | 5199 Prepare(); |
5202 | 5200 |
5203 { | 5201 { |
5204 NoSafepointScope no_safepoint; | 5202 NoSafepointScope no_safepoint; |
5205 HeapLocker hl(thread(), heap_->old_space()); | 5203 HeapLocker hl(thread(), heap_->old_space()); |
5206 | 5204 |
5207 // N.B.: Skipping index 0 because ref 0 is illegal. | 5205 // N.B.: Skipping index 0 because ref 0 is illegal. |
5208 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); | 5206 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); |
5209 for (intptr_t i = 1; i < base_objects.Length(); i++) { | 5207 for (intptr_t i = 1; i < base_objects.Length(); i++) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5275 | 5273 |
5276 intptr_t count() const { return count_; } | 5274 intptr_t count() const { return count_; } |
5277 | 5275 |
5278 private: | 5276 private: |
5279 Object& objHandle_; | 5277 Object& objHandle_; |
5280 intptr_t count_; | 5278 intptr_t count_; |
5281 const Array* token_streams_; | 5279 const Array* token_streams_; |
5282 }; | 5280 }; |
5283 | 5281 |
5284 | 5282 |
5285 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind, | 5283 FullSnapshotWriter::FullSnapshotWriter( |
5286 uint8_t** vm_isolate_snapshot_buffer, | 5284 Snapshot::Kind kind, |
5287 uint8_t** isolate_snapshot_buffer, | 5285 uint8_t** vm_snapshot_data_buffer, |
5288 ReAlloc alloc, | 5286 uint8_t** isolate_snapshot_data_buffer, |
5289 InstructionsWriter* instructions_writer) | 5287 ReAlloc alloc, |
| 5288 InstructionsWriter* vm_instructions_writer, |
| 5289 InstructionsWriter* isolate_instructions_writer) |
5290 : thread_(Thread::Current()), | 5290 : thread_(Thread::Current()), |
5291 kind_(kind), | 5291 kind_(kind), |
5292 vm_isolate_snapshot_buffer_(vm_isolate_snapshot_buffer), | 5292 vm_snapshot_data_buffer_(vm_snapshot_data_buffer), |
5293 isolate_snapshot_buffer_(isolate_snapshot_buffer), | 5293 isolate_snapshot_data_buffer_(isolate_snapshot_data_buffer), |
5294 alloc_(alloc), | 5294 alloc_(alloc), |
5295 vm_isolate_snapshot_size_(0), | 5295 vm_isolate_snapshot_size_(0), |
5296 isolate_snapshot_size_(0), | 5296 isolate_snapshot_size_(0), |
5297 instructions_writer_(instructions_writer), | 5297 vm_instructions_writer_(vm_instructions_writer), |
| 5298 isolate_instructions_writer_(isolate_instructions_writer), |
5298 token_streams_(Array::Handle(zone())), | 5299 token_streams_(Array::Handle(zone())), |
5299 saved_symbol_table_(Array::Handle(zone())), | 5300 saved_symbol_table_(Array::Handle(zone())), |
5300 new_vm_symbol_table_(Array::Handle(zone())) { | 5301 new_vm_symbol_table_(Array::Handle(zone())), |
5301 ASSERT(isolate_snapshot_buffer_ != NULL); | 5302 clustered_vm_size_(0), |
| 5303 clustered_isolate_size_(0), |
| 5304 mapped_data_size_(0), |
| 5305 mapped_instructions_size_(0) { |
| 5306 ASSERT(isolate_snapshot_data_buffer_ != NULL); |
5302 ASSERT(alloc_ != NULL); | 5307 ASSERT(alloc_ != NULL); |
5303 ASSERT(isolate() != NULL); | 5308 ASSERT(isolate() != NULL); |
5304 ASSERT(ClassFinalizer::AllClassesFinalized()); | 5309 ASSERT(ClassFinalizer::AllClassesFinalized()); |
5305 ASSERT(isolate() != NULL); | 5310 ASSERT(isolate() != NULL); |
5306 ASSERT(heap() != NULL); | 5311 ASSERT(heap() != NULL); |
5307 ObjectStore* object_store = isolate()->object_store(); | 5312 ObjectStore* object_store = isolate()->object_store(); |
5308 ASSERT(object_store != NULL); | 5313 ASSERT(object_store != NULL); |
5309 | 5314 |
5310 #if defined(DEBUG) | 5315 #if defined(DEBUG) |
5311 // Ensure the class table is valid. | 5316 // Ensure the class table is valid. |
5312 isolate()->ValidateClassTable(); | 5317 isolate()->ValidateClassTable(); |
5313 #endif | 5318 #endif |
5314 // Can't have any mutation happening while we're serializing. | 5319 // Can't have any mutation happening while we're serializing. |
5315 ASSERT(isolate()->background_compiler() == NULL); | 5320 ASSERT(isolate()->background_compiler() == NULL); |
5316 | 5321 |
5317 if (vm_isolate_snapshot_buffer != NULL) { | 5322 if (vm_snapshot_data_buffer != NULL) { |
5318 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5323 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5319 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); | 5324 thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate")); |
5320 | 5325 |
5321 // Collect all the token stream objects into an array so that we can write | 5326 // Collect all the token stream objects into an array so that we can write |
5322 // it out as part of the VM isolate snapshot. We first count the number of | 5327 // it out as part of the VM isolate snapshot. We first count the number of |
5323 // token streams, allocate an array and then fill it up with the token | 5328 // token streams, allocate an array and then fill it up with the token |
5324 // streams. | 5329 // streams. |
5325 SnapshotTokenStreamVisitor token_streams_counter(thread()); | 5330 SnapshotTokenStreamVisitor token_streams_counter(thread()); |
5326 heap()->IterateOldObjects(&token_streams_counter); | 5331 heap()->IterateOldObjects(&token_streams_counter); |
5327 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); | 5332 Dart::vm_isolate()->heap()->IterateOldObjects(&token_streams_counter); |
(...skipping 23 matching lines...) Expand all Loading... |
5351 // We may run Dart code afterwards, restore the symbol table if needed. | 5356 // We may run Dart code afterwards, restore the symbol table if needed. |
5352 if (!saved_symbol_table_.IsNull()) { | 5357 if (!saved_symbol_table_.IsNull()) { |
5353 isolate()->object_store()->set_symbol_table(saved_symbol_table_); | 5358 isolate()->object_store()->set_symbol_table(saved_symbol_table_); |
5354 saved_symbol_table_ = Array::null(); | 5359 saved_symbol_table_ = Array::null(); |
5355 } | 5360 } |
5356 new_vm_symbol_table_ = Array::null(); | 5361 new_vm_symbol_table_ = Array::null(); |
5357 token_streams_ = Array::null(); | 5362 token_streams_ = Array::null(); |
5358 } | 5363 } |
5359 | 5364 |
5360 | 5365 |
5361 intptr_t FullSnapshotWriter::WriteVmIsolateSnapshot() { | 5366 intptr_t FullSnapshotWriter::WriteVMSnapshot() { |
5362 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5367 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5363 thread(), Timeline::GetIsolateStream(), "WriteVmIsolateSnapshot")); | 5368 thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot")); |
5364 | 5369 |
5365 ASSERT(vm_isolate_snapshot_buffer_ != NULL); | 5370 ASSERT(vm_snapshot_data_buffer_ != NULL); |
5366 Serializer serializer(thread(), kind_, vm_isolate_snapshot_buffer_, alloc_, | 5371 Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_, |
5367 kInitialSize, instructions_writer_); | 5372 kInitialSize, vm_instructions_writer_); |
5368 | 5373 |
5369 serializer.ReserveHeader(); | 5374 serializer.ReserveHeader(); |
5370 serializer.WriteVersionAndFeatures(); | 5375 serializer.WriteVersionAndFeatures(); |
5371 /* | 5376 // VM snapshot roots are: |
5372 * Now Write out the following | 5377 // - the symbol table |
5373 * - the symbol table | 5378 // - all the token streams |
5374 * - all the token streams | 5379 // - the stub code (precompiled snapshots only) |
5375 * - the stub code (precompiled snapshots only) | |
5376 **/ | |
5377 intptr_t num_objects = | 5380 intptr_t num_objects = |
5378 serializer.WriteVMSnapshot(new_vm_symbol_table_, token_streams_); | 5381 serializer.WriteVMSnapshot(new_vm_symbol_table_, token_streams_); |
5379 serializer.FillHeader(serializer.kind()); | 5382 serializer.FillHeader(serializer.kind()); |
| 5383 clustered_vm_size_ = serializer.bytes_written(); |
5380 | 5384 |
| 5385 if (Snapshot::IncludesCode(kind_)) { |
| 5386 vm_instructions_writer_->Write(serializer.stream(), true); |
| 5387 mapped_data_size_ += vm_instructions_writer_->data_size(); |
| 5388 mapped_instructions_size_ += vm_instructions_writer_->text_size(); |
| 5389 vm_instructions_writer_->ResetOffsets(); |
| 5390 } |
| 5391 |
| 5392 // The clustered part + the direct mapped data part. |
5381 vm_isolate_snapshot_size_ = serializer.bytes_written(); | 5393 vm_isolate_snapshot_size_ = serializer.bytes_written(); |
5382 return num_objects; | 5394 return num_objects; |
5383 } | 5395 } |
5384 | 5396 |
5385 | 5397 |
5386 void FullSnapshotWriter::WriteIsolateFullSnapshot(intptr_t num_base_objects) { | 5398 void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) { |
5387 NOT_IN_PRODUCT(TimelineDurationScope tds( | 5399 NOT_IN_PRODUCT(TimelineDurationScope tds( |
5388 thread(), Timeline::GetIsolateStream(), "WriteIsolateFullSnapshot")); | 5400 thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot")); |
5389 | 5401 |
5390 Serializer serializer(thread(), kind_, isolate_snapshot_buffer_, alloc_, | 5402 Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_, |
5391 kInitialSize, instructions_writer_); | 5403 kInitialSize, isolate_instructions_writer_); |
5392 ObjectStore* object_store = isolate()->object_store(); | 5404 ObjectStore* object_store = isolate()->object_store(); |
5393 ASSERT(object_store != NULL); | 5405 ASSERT(object_store != NULL); |
5394 | 5406 |
5395 serializer.ReserveHeader(); | 5407 serializer.ReserveHeader(); |
5396 serializer.WriteVersionAndFeatures(); | 5408 serializer.WriteVersionAndFeatures(); |
5397 serializer.WriteFullSnapshot(num_base_objects, object_store); | 5409 // Isolate snapshot roots are: |
| 5410 // - the object store |
| 5411 serializer.WriteIsolateSnapshot(num_base_objects, object_store); |
5398 serializer.FillHeader(serializer.kind()); | 5412 serializer.FillHeader(serializer.kind()); |
| 5413 clustered_isolate_size_ = serializer.bytes_written(); |
5399 | 5414 |
| 5415 if (Snapshot::IncludesCode(kind_)) { |
| 5416 isolate_instructions_writer_->Write(serializer.stream(), false); |
| 5417 mapped_data_size_ += isolate_instructions_writer_->data_size(); |
| 5418 mapped_instructions_size_ += isolate_instructions_writer_->text_size(); |
| 5419 isolate_instructions_writer_->ResetOffsets(); |
| 5420 } |
| 5421 |
| 5422 // The clustered part + the direct mapped data part. |
5400 isolate_snapshot_size_ = serializer.bytes_written(); | 5423 isolate_snapshot_size_ = serializer.bytes_written(); |
5401 } | 5424 } |
5402 | 5425 |
5403 | 5426 |
5404 void FullSnapshotWriter::WriteFullSnapshot() { | 5427 void FullSnapshotWriter::WriteFullSnapshot() { |
5405 intptr_t num_base_objects; | 5428 intptr_t num_base_objects; |
5406 if (vm_isolate_snapshot_buffer() != NULL) { | 5429 if (vm_snapshot_data_buffer() != NULL) { |
5407 num_base_objects = WriteVmIsolateSnapshot(); | 5430 num_base_objects = WriteVMSnapshot(); |
5408 ASSERT(num_base_objects != 0); | 5431 ASSERT(num_base_objects != 0); |
5409 } else { | 5432 } else { |
5410 num_base_objects = 0; | 5433 num_base_objects = 0; |
5411 } | 5434 } |
5412 | 5435 |
5413 WriteIsolateFullSnapshot(num_base_objects); | 5436 WriteIsolateSnapshot(num_base_objects); |
5414 | 5437 |
5415 if (FLAG_print_snapshot_sizes) { | 5438 if (FLAG_print_snapshot_sizes) { |
5416 OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize()); | 5439 OS::Print("VMIsolate(CodeSize): %" Pd "\n", clustered_vm_size_); |
5417 OS::Print("Isolate(CodeSize): %" Pd "\n", IsolateSnapshotSize()); | 5440 OS::Print("Isolate(CodeSize): %" Pd "\n", clustered_isolate_size_); |
5418 } | 5441 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", mapped_data_size_); |
5419 intptr_t total_size = VmIsolateSnapshotSize() + IsolateSnapshotSize(); | 5442 OS::Print("Instructions(CodeSize): %" Pd "\n", mapped_instructions_size_); |
5420 | 5443 OS::Print("Total(CodeSize): %" Pd "\n", |
5421 if (Snapshot::IncludesCode(kind_)) { | 5444 clustered_vm_size_ + clustered_isolate_size_ + mapped_data_size_ + |
5422 instructions_writer_->Write( | 5445 mapped_instructions_size_); |
5423 vm_isolate_snapshot_buffer_ == NULL ? NULL | |
5424 : *vm_isolate_snapshot_buffer_, | |
5425 vm_isolate_snapshot_size_, *isolate_snapshot_buffer_, | |
5426 isolate_snapshot_size_); | |
5427 | |
5428 if (FLAG_print_snapshot_sizes) { | |
5429 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", | |
5430 instructions_writer_->data_size()); | |
5431 OS::Print("Instructions(CodeSize): %" Pd "\n", | |
5432 instructions_writer_->text_size()); | |
5433 } | |
5434 total_size += | |
5435 instructions_writer_->data_size() + instructions_writer_->text_size(); | |
5436 } | |
5437 | |
5438 if (FLAG_print_snapshot_sizes) { | |
5439 OS::Print("Total(CodeSize): %" Pd "\n", total_size); | |
5440 } | 5446 } |
5441 } | 5447 } |
5442 | 5448 |
5443 | 5449 |
5444 RawApiError* IsolateSnapshotReader::ReadFullSnapshot() { | 5450 static const uint8_t* DataBuffer(const Snapshot* snapshot) { |
| 5451 if (Snapshot::IncludesCode(snapshot->kind())) { |
| 5452 uword offset = |
| 5453 Utils::RoundUp(snapshot->length(), OS::kMaxPreferredCodeAlignment); |
| 5454 return snapshot->Addr() + offset; |
| 5455 } |
| 5456 return NULL; |
| 5457 } |
| 5458 |
| 5459 |
| 5460 FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot, |
| 5461 const uint8_t* instructions_buffer, |
| 5462 Thread* thread) |
| 5463 : kind_(snapshot->kind()), |
| 5464 thread_(thread), |
| 5465 buffer_(snapshot->content()), |
| 5466 size_(snapshot->length()), |
| 5467 instructions_buffer_(instructions_buffer), |
| 5468 data_buffer_(DataBuffer(snapshot)) { |
| 5469 thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kAppAOT); |
| 5470 } |
| 5471 |
| 5472 |
| 5473 RawApiError* FullSnapshotReader::ReadVMSnapshot() { |
5445 Deserializer deserializer(thread_, kind_, buffer_, size_, | 5474 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5446 instructions_buffer_, data_buffer_); | 5475 instructions_buffer_, data_buffer_); |
5447 | 5476 |
5448 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5477 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5449 if (error != ApiError::null()) { | 5478 if (error != ApiError::null()) { |
5450 return error; | 5479 return error; |
5451 } | 5480 } |
5452 | 5481 |
5453 deserializer.ReadFullSnapshot(thread_->isolate()->object_store()); | 5482 if (instructions_buffer_ != NULL) { |
| 5483 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_); |
| 5484 } |
| 5485 if (data_buffer_ != NULL) { |
| 5486 thread_->isolate()->SetupDataSnapshotPage(data_buffer_); |
| 5487 } |
| 5488 |
| 5489 deserializer.ReadVMSnapshot(); |
5454 | 5490 |
5455 return ApiError::null(); | 5491 return ApiError::null(); |
5456 } | 5492 } |
5457 | 5493 |
5458 | 5494 |
5459 RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() { | 5495 RawApiError* FullSnapshotReader::ReadIsolateSnapshot() { |
5460 Deserializer deserializer(thread_, kind_, buffer_, size_, | 5496 Deserializer deserializer(thread_, kind_, buffer_, size_, |
5461 instructions_buffer_, data_buffer_); | 5497 instructions_buffer_, data_buffer_); |
5462 | 5498 |
5463 RawApiError* error = deserializer.VerifyVersionAndFeatures(); | 5499 RawApiError* error = deserializer.VerifyVersionAndFeatures(); |
5464 if (error != ApiError::null()) { | 5500 if (error != ApiError::null()) { |
5465 return error; | 5501 return error; |
5466 } | 5502 } |
5467 | 5503 |
5468 deserializer.ReadVMSnapshot(); | 5504 if (instructions_buffer_ != NULL) { |
| 5505 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_); |
| 5506 } |
| 5507 if (data_buffer_ != NULL) { |
| 5508 thread_->isolate()->SetupDataSnapshotPage(data_buffer_); |
| 5509 } |
5469 | 5510 |
5470 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5511 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
5471 Dart::set_data_snapshot_buffer(data_buffer_); | |
5472 | 5512 |
5473 return ApiError::null(); | 5513 return ApiError::null(); |
5474 } | 5514 } |
5475 | 5515 |
5476 } // namespace dart | 5516 } // namespace dart |
OLD | NEW |