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

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

Issue 2160953002: Add a verification step which iterates over the heap and verifies that all canonical objects are co… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review comments. Created 4 years, 4 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 | « runtime/vm/raw_object.h ('k') | runtime/vm/verifier.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/native_entry.h" 5 #include "vm/native_entry.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 bool as_reference) { 224 bool as_reference) {
225 ASSERT(reader != NULL); 225 ASSERT(reader != NULL);
226 226
227 // Determine if the type class of this type is in the full snapshot. 227 // Determine if the type class of this type is in the full snapshot.
228 bool typeclass_is_in_fullsnapshot = reader->Read<bool>(); 228 bool typeclass_is_in_fullsnapshot = reader->Read<bool>();
229 229
230 // Allocate type object. 230 // Allocate type object.
231 Type& type = Type::ZoneHandle(reader->zone(), NEW_OBJECT(Type)); 231 Type& type = Type::ZoneHandle(reader->zone(), NEW_OBJECT(Type));
232 bool is_canonical = RawObject::IsCanonical(tags); 232 bool is_canonical = RawObject::IsCanonical(tags);
233 bool defer_canonicalization = is_canonical && 233 bool defer_canonicalization = is_canonical &&
234 (!Snapshot::IsFull(kind) && typeclass_is_in_fullsnapshot); 234 ((kind == Snapshot::kMessage) ||
235 (!Snapshot::IsFull(kind) && typeclass_is_in_fullsnapshot));
235 reader->AddBackRef(object_id, &type, kIsDeserialized, defer_canonicalization); 236 reader->AddBackRef(object_id, &type, kIsDeserialized, defer_canonicalization);
236 237
237 // Set all non object fields. 238 // Set all non object fields.
238 type.set_token_pos(TokenPosition::SnapshotDecode(reader->Read<int32_t>())); 239 type.set_token_pos(TokenPosition::SnapshotDecode(reader->Read<int32_t>()));
239 type.set_type_state(reader->Read<int8_t>()); 240 type.set_type_state(reader->Read<int8_t>());
240 241
241 // Set all the object fields. 242 // Set all the object fields.
242 READ_OBJECT_FIELDS(type, type.raw()->from(), type.raw()->to(), kAsReference); 243 READ_OBJECT_FIELDS(type, type.raw()->from(), type.raw()->to(), kAsReference);
243 244
244 // Read in the type class. 245 // Read in the type class.
(...skipping 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 // We do not allow objects with native fields in an isolate message. 3320 // We do not allow objects with native fields in an isolate message.
3320 writer->SetWriteException(Exceptions::kArgument, 3321 writer->SetWriteException(Exceptions::kArgument,
3321 "Illegal argument in isolate message" 3322 "Illegal argument in isolate message"
3322 " : (object is a UserTag)"); 3323 " : (object is a UserTag)");
3323 } else { 3324 } else {
3324 UNREACHABLE(); 3325 UNREACHABLE();
3325 } 3326 }
3326 } 3327 }
3327 3328
3328 } // namespace dart 3329 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698