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

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

Issue 2381573002: Fix off-by-one issue in clustered snapshot implementation and api impl (Closed)
Patch Set: same in dart_api_impl Created 4 years, 2 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 | runtime/vm/dart_api_impl.cc » ('j') | 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 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 delete[] clusters_by_cid_; 4305 delete[] clusters_by_cid_;
4306 } 4306 }
4307 4307
4308 4308
4309 SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) { 4309 SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) {
4310 #if defined(DART_PRECOMPILED_RUNTIME) 4310 #if defined(DART_PRECOMPILED_RUNTIME)
4311 UNREACHABLE(); 4311 UNREACHABLE();
4312 return NULL; 4312 return NULL;
4313 #else 4313 #else
4314 Zone* Z = zone_; 4314 Zone* Z = zone_;
4315 if ((cid > kNumPredefinedCids) || 4315 if ((cid >= kNumPredefinedCids) ||
4316 (cid == kInstanceCid) || 4316 (cid == kInstanceCid) ||
4317 RawObject::IsTypedDataViewClassId(cid)) { 4317 RawObject::IsTypedDataViewClassId(cid)) {
4318 Push(isolate()->class_table()->At(cid)); 4318 Push(isolate()->class_table()->At(cid));
4319 return new (Z) InstanceSerializationCluster(cid); 4319 return new (Z) InstanceSerializationCluster(cid);
4320 } 4320 }
4321 if (RawObject::IsExternalTypedDataClassId(cid)) { 4321 if (RawObject::IsExternalTypedDataClassId(cid)) {
4322 return new (Z) ExternalTypedDataSerializationCluster(cid); 4322 return new (Z) ExternalTypedDataSerializationCluster(cid);
4323 } 4323 }
4324 if (RawObject::IsTypedDataClassId(cid)) { 4324 if (RawObject::IsTypedDataClassId(cid)) {
4325 return new (Z) TypedDataSerializationCluster(cid); 4325 return new (Z) TypedDataSerializationCluster(cid);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
4629 4629
4630 Deserializer::~Deserializer() { 4630 Deserializer::~Deserializer() {
4631 delete[] clusters_; 4631 delete[] clusters_;
4632 } 4632 }
4633 4633
4634 4634
4635 DeserializationCluster* Deserializer::ReadCluster() { 4635 DeserializationCluster* Deserializer::ReadCluster() {
4636 intptr_t cid = ReadCid(); 4636 intptr_t cid = ReadCid();
4637 4637
4638 Zone* Z = zone_; 4638 Zone* Z = zone_;
4639 if ((cid > kNumPredefinedCids) || 4639 if ((cid >= kNumPredefinedCids) ||
4640 (cid == kInstanceCid) || 4640 (cid == kInstanceCid) ||
4641 RawObject::IsTypedDataViewClassId(cid)) { 4641 RawObject::IsTypedDataViewClassId(cid)) {
4642 return new (Z) InstanceDeserializationCluster(cid); 4642 return new (Z) InstanceDeserializationCluster(cid);
4643 } 4643 }
4644 if (RawObject::IsExternalTypedDataClassId(cid)) { 4644 if (RawObject::IsExternalTypedDataClassId(cid)) {
4645 return new (Z) ExternalTypedDataDeserializationCluster(cid); 4645 return new (Z) ExternalTypedDataDeserializationCluster(cid);
4646 } 4646 }
4647 if (RawObject::IsTypedDataClassId(cid)) { 4647 if (RawObject::IsTypedDataClassId(cid)) {
4648 return new (Z) TypedDataDeserializationCluster(cid); 4648 return new (Z) TypedDataDeserializationCluster(cid);
4649 } 4649 }
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
5209 5209
5210 deserializer.ReadVMSnapshot(); 5210 deserializer.ReadVMSnapshot();
5211 5211
5212 Dart::set_instructions_snapshot_buffer(instructions_buffer_); 5212 Dart::set_instructions_snapshot_buffer(instructions_buffer_);
5213 Dart::set_data_snapshot_buffer(data_buffer_); 5213 Dart::set_data_snapshot_buffer(data_buffer_);
5214 5214
5215 return ApiError::null(); 5215 return ApiError::null();
5216 } 5216 }
5217 5217
5218 } // namespace dart 5218 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698