| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 | 42 |
| 43 static intptr_t ClassIdFromObjectId(intptr_t object_id) { | 43 static intptr_t ClassIdFromObjectId(intptr_t object_id) { |
| 44 ASSERT(object_id > kClassIdsOffset); | 44 ASSERT(object_id > kClassIdsOffset); |
| 45 intptr_t class_id = (object_id - kClassIdsOffset); | 45 intptr_t class_id = (object_id - kClassIdsOffset); |
| 46 return class_id; | 46 return class_id; |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 static intptr_t ObjectIdFromClassId(intptr_t class_id) { | 50 static intptr_t ObjectIdFromClassId(intptr_t class_id) { |
| 51 ASSERT((class_id > kIllegalCid) && (class_id < kNumPredefinedCids)); | 51 ASSERT(class_id > kIllegalCid && class_id < kNumPredefinedCids); |
| 52 return (class_id + kClassIdsOffset); | 52 return (class_id + kClassIdsOffset); |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 static RawType* GetType(ObjectStore* object_store, int index) { | 56 static RawType* GetType(ObjectStore* object_store, int index) { |
| 57 switch (index) { | 57 switch (index) { |
| 58 case kObjectType: return object_store->object_type(); | 58 case kObjectType: return object_store->object_type(); |
| 59 case kNullType: return object_store->null_type(); | 59 case kNullType: return object_store->null_type(); |
| 60 case kDynamicType: return object_store->dynamic_type(); | 60 case kDynamicType: return object_store->dynamic_type(); |
| 61 case kVoidType: return object_store->void_type(); | 61 case kVoidType: return object_store->void_type(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); | 407 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); |
| 408 obj->ptr()->num_variables_ = num_variables; | 408 obj->ptr()->num_variables_ = num_variables; |
| 409 return obj; | 409 return obj; |
| 410 } | 410 } |
| 411 | 411 |
| 412 | 412 |
| 413 RawClass* SnapshotReader::NewClass(intptr_t class_id, bool is_signature_class) { | 413 RawClass* SnapshotReader::NewClass(intptr_t class_id, bool is_signature_class) { |
| 414 ASSERT(kind_ == Snapshot::kFull); | 414 ASSERT(kind_ == Snapshot::kFull); |
| 415 ASSERT(isolate()->no_gc_scope_depth() != 0); | 415 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| 416 if (class_id < kNumPredefinedCids) { | 416 if (class_id < kNumPredefinedCids) { |
| 417 ASSERT((class_id >= kInstanceCid) && (class_id <= kWeakPropertyCid)); | 417 return Class::GetClass(class_id, is_signature_class); |
| 418 return isolate()->class_table()->At(class_id); | |
| 419 } | 418 } |
| 420 cls_ = Object::class_class(); | 419 cls_ = Object::class_class(); |
| 421 RawClass* obj = reinterpret_cast<RawClass*>( | 420 RawClass* obj = reinterpret_cast<RawClass*>( |
| 422 AllocateUninitialized(cls_, Class::InstanceSize())); | 421 AllocateUninitialized(cls_, Class::InstanceSize())); |
| 423 if (is_signature_class) { | 422 if (is_signature_class) { |
| 424 Closure fake; | 423 Closure fake; |
| 425 obj->ptr()->handle_vtable_ = fake.vtable(); | 424 obj->ptr()->handle_vtable_ = fake.vtable(); |
| 426 } else { | 425 } else { |
| 427 Instance fake; | 426 Instance fake; |
| 428 obj->ptr()->handle_vtable_ = fake.vtable(); | 427 obj->ptr()->handle_vtable_ = fake.vtable(); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 RawObject* raw_obj = *current; | 1120 RawObject* raw_obj = *current; |
| 1122 if (as_references_) { | 1121 if (as_references_) { |
| 1123 writer_->WriteObjectRef(raw_obj); | 1122 writer_->WriteObjectRef(raw_obj); |
| 1124 } else { | 1123 } else { |
| 1125 writer_->WriteObjectImpl(raw_obj); | 1124 writer_->WriteObjectImpl(raw_obj); |
| 1126 } | 1125 } |
| 1127 } | 1126 } |
| 1128 } | 1127 } |
| 1129 | 1128 |
| 1130 } // namespace dart | 1129 } // namespace dart |
| OLD | NEW |