| OLD | NEW |
| 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/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { | 575 RawObject* SnapshotReader::ReadVMIsolateObject(intptr_t header_value) { |
| 576 intptr_t object_id = GetVMIsolateObjectId(header_value); | 576 intptr_t object_id = GetVMIsolateObjectId(header_value); |
| 577 if (object_id == kNullObject) { | 577 if (object_id == kNullObject) { |
| 578 // This is a singleton null object, return it. | 578 // This is a singleton null object, return it. |
| 579 return Object::null(); | 579 return Object::null(); |
| 580 } | 580 } |
| 581 if (object_id == kSentinelObject) { | 581 if (object_id == kSentinelObject) { |
| 582 return Object::sentinel(); | 582 return Object::sentinel(); |
| 583 } | 583 } |
| 584 if (object_id == kEmptyArrayObject) { |
| 585 return Object::empty_array(); |
| 586 } |
| 584 intptr_t class_id = ClassIdFromObjectId(object_id); | 587 intptr_t class_id = ClassIdFromObjectId(object_id); |
| 585 if (IsSingletonClassId(class_id)) { | 588 if (IsSingletonClassId(class_id)) { |
| 586 return isolate()->class_table()->At(class_id); // get singleton class. | 589 return isolate()->class_table()->At(class_id); // get singleton class. |
| 587 } else { | 590 } else { |
| 588 ASSERT(Symbols::IsVMSymbolId(object_id)); | 591 ASSERT(Symbols::IsVMSymbolId(object_id)); |
| 589 return Symbols::GetVMSymbol(object_id); // return VM symbol. | 592 return Symbols::GetVMSymbol(object_id); // return VM symbol. |
| 590 } | 593 } |
| 591 UNREACHABLE(); | 594 UNREACHABLE(); |
| 592 return Object::null(); | 595 return Object::null(); |
| 593 } | 596 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 WriteVMIsolateObject(kNullObject); | 705 WriteVMIsolateObject(kNullObject); |
| 703 return; | 706 return; |
| 704 } | 707 } |
| 705 | 708 |
| 706 // Check if it is a singleton sentinel object. | 709 // Check if it is a singleton sentinel object. |
| 707 if (rawobj == Object::sentinel()) { | 710 if (rawobj == Object::sentinel()) { |
| 708 WriteVMIsolateObject(kSentinelObject); | 711 WriteVMIsolateObject(kSentinelObject); |
| 709 return; | 712 return; |
| 710 } | 713 } |
| 711 | 714 |
| 715 // Check if it is a singleton empty array object. |
| 716 if (rawobj == Object::empty_array()) { |
| 717 WriteVMIsolateObject(kEmptyArrayObject); |
| 718 return; |
| 719 } |
| 720 |
| 712 // Check if it is a singleton class object which is shared by | 721 // Check if it is a singleton class object which is shared by |
| 713 // all isolates. | 722 // all isolates. |
| 714 intptr_t id = rawobj->GetClassId(); | 723 intptr_t id = rawobj->GetClassId(); |
| 715 if (id == kClassCid) { | 724 if (id == kClassCid) { |
| 716 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj); | 725 RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj); |
| 717 intptr_t class_id = raw_class->ptr()->id_; | 726 intptr_t class_id = raw_class->ptr()->id_; |
| 718 if (IsSingletonClassId(class_id)) { | 727 if (IsSingletonClassId(class_id)) { |
| 719 intptr_t object_id = ObjectIdFromClassId(class_id); | 728 intptr_t object_id = ObjectIdFromClassId(class_id); |
| 720 WriteVMIsolateObject(object_id); | 729 WriteVMIsolateObject(object_id); |
| 721 return; | 730 return; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 RawObject* raw_obj = *current; | 1115 RawObject* raw_obj = *current; |
| 1107 if (as_references_) { | 1116 if (as_references_) { |
| 1108 writer_->WriteObjectRef(raw_obj); | 1117 writer_->WriteObjectRef(raw_obj); |
| 1109 } else { | 1118 } else { |
| 1110 writer_->WriteObjectImpl(raw_obj); | 1119 writer_->WriteObjectImpl(raw_obj); |
| 1111 } | 1120 } |
| 1112 } | 1121 } |
| 1113 } | 1122 } |
| 1114 | 1123 |
| 1115 } // namespace dart | 1124 } // namespace dart |
| OLD | NEW |