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

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

Issue 2648383006: Make the VM resilient to a confusion between a NULL instructions snapshot and instructions snapshot… (Closed)
Patch Set: . Created 3 years, 11 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) 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 5461 matching lines...) Expand 10 before | Expand all | Expand 10 after
5472 5472
5473 RawApiError* FullSnapshotReader::ReadVMSnapshot() { 5473 RawApiError* FullSnapshotReader::ReadVMSnapshot() {
5474 Deserializer deserializer(thread_, kind_, buffer_, size_, 5474 Deserializer deserializer(thread_, kind_, buffer_, size_,
5475 instructions_buffer_, data_buffer_); 5475 instructions_buffer_, data_buffer_);
5476 5476
5477 RawApiError* error = deserializer.VerifyVersionAndFeatures(); 5477 RawApiError* error = deserializer.VerifyVersionAndFeatures();
5478 if (error != ApiError::null()) { 5478 if (error != ApiError::null()) {
5479 return error; 5479 return error;
5480 } 5480 }
5481 5481
5482 if (instructions_buffer_ != NULL) { 5482 if (Snapshot::IncludesCode(kind_)) {
5483 ASSERT(instructions_buffer_ != NULL);
5483 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_); 5484 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_);
5484 } 5485 ASSERT(data_buffer_ != NULL);
5485 if (data_buffer_ != NULL) {
5486 thread_->isolate()->SetupDataSnapshotPage(data_buffer_); 5486 thread_->isolate()->SetupDataSnapshotPage(data_buffer_);
5487 } 5487 }
5488 5488
5489 deserializer.ReadVMSnapshot(); 5489 deserializer.ReadVMSnapshot();
5490 5490
5491 return ApiError::null(); 5491 return ApiError::null();
5492 } 5492 }
5493 5493
5494 5494
5495 RawApiError* FullSnapshotReader::ReadIsolateSnapshot() { 5495 RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
5496 Deserializer deserializer(thread_, kind_, buffer_, size_, 5496 Deserializer deserializer(thread_, kind_, buffer_, size_,
5497 instructions_buffer_, data_buffer_); 5497 instructions_buffer_, data_buffer_);
5498 5498
5499 RawApiError* error = deserializer.VerifyVersionAndFeatures(); 5499 RawApiError* error = deserializer.VerifyVersionAndFeatures();
5500 if (error != ApiError::null()) { 5500 if (error != ApiError::null()) {
5501 return error; 5501 return error;
5502 } 5502 }
5503 5503
5504 if (instructions_buffer_ != NULL) { 5504 if (Snapshot::IncludesCode(kind_)) {
5505 ASSERT(instructions_buffer_ != NULL);
5505 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_); 5506 thread_->isolate()->SetupInstructionsSnapshotPage(instructions_buffer_);
5506 } 5507 ASSERT(data_buffer_ != NULL);
5507 if (data_buffer_ != NULL) {
5508 thread_->isolate()->SetupDataSnapshotPage(data_buffer_); 5508 thread_->isolate()->SetupDataSnapshotPage(data_buffer_);
5509 } 5509 }
5510 5510
5511 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); 5511 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store());
5512 5512
5513 return ApiError::null(); 5513 return ApiError::null();
5514 } 5514 }
5515 5515
5516 } // namespace dart 5516 } // 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