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

Side by Side Diff: vm/snapshot.cc

Issue 9580036: - Always write a Null Object for Code objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | 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) 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/snapshot.h" 5 #include "vm/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/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 WriteIndexedObject(ObjectStore::kTrueValue); 487 WriteIndexedObject(ObjectStore::kTrueValue);
488 return; 488 return;
489 } 489 }
490 490
491 // Check if it is a singleton boolean false value. 491 // Check if it is a singleton boolean false value.
492 if (rawobj == object_store()->false_value()) { 492 if (rawobj == object_store()->false_value()) {
493 WriteIndexedObject(ObjectStore::kFalseValue); 493 WriteIndexedObject(ObjectStore::kFalseValue);
494 return; 494 return;
495 } 495 }
496 496
497 // Check if it is a code object in that case just write a Null object
498 // as we do not want code objects in the snapshot.
499 if (rawobj->ptr()->class_ == Object::code_class()) {
500 WriteIndexedObject(Object::kNullObject);
501 return;
502 }
503
497 // Check if classes are not being serialized and it is preinitialized type. 504 // Check if classes are not being serialized and it is preinitialized type.
498 if (kind_ != Snapshot::kFull) { 505 if (kind_ != Snapshot::kFull) {
499 RawType* raw_type = reinterpret_cast<RawType*>(rawobj); 506 RawType* raw_type = reinterpret_cast<RawType*>(rawobj);
500 index = object_store()->GetTypeIndex(raw_type); 507 index = object_store()->GetTypeIndex(raw_type);
501 if (index != ObjectStore::kInvalidIndex) { 508 if (index != ObjectStore::kInvalidIndex) {
502 WriteIndexedObject(index); 509 WriteIndexedObject(index);
503 return; 510 return;
504 } 511 }
505 } 512 }
506 513
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 652
646 653
647 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) { 654 void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
648 for (RawObject** current = first; current <= last; current++) { 655 for (RawObject** current = first; current <= last; current++) {
649 RawObject* raw_obj = *current; 656 RawObject* raw_obj = *current;
650 writer_->WriteObject(raw_obj); 657 writer_->WriteObject(raw_obj);
651 } 658 }
652 } 659 }
653 660
654 } // namespace dart 661 } // namespace dart
OLDNEW
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698