| 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 12 matching lines...) Expand all Loading... |
| 23 static bool IsSingletonClassId(intptr_t class_id) { | 23 static bool IsSingletonClassId(intptr_t class_id) { |
| 24 // Check if this is a singleton object class which is shared by all isolates. | 24 // Check if this is a singleton object class which is shared by all isolates. |
| 25 return ((class_id >= kClassCid && class_id <= kUnwindErrorCid) || | 25 return ((class_id >= kClassCid && class_id <= kUnwindErrorCid) || |
| 26 (class_id >= kNullCid && class_id <= kVoidCid)); | 26 (class_id >= kNullCid && class_id <= kVoidCid)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 | 29 |
| 30 static bool IsObjectStoreClassId(intptr_t class_id) { | 30 static bool IsObjectStoreClassId(intptr_t class_id) { |
| 31 // Check if this is a class which is stored in the object store. | 31 // Check if this is a class which is stored in the object store. |
| 32 return (class_id == kObjectCid || | 32 return (class_id == kObjectCid || |
| 33 (class_id >= kInstanceCid && class_id <= kWeakPropertyCid)); | 33 (class_id >= kInstanceCid && class_id <= kWeakPropertyCid) || |
| 34 RawObject::IsStringClassId(class_id)); |
| 34 } | 35 } |
| 35 | 36 |
| 36 | 37 |
| 37 static bool IsObjectStoreTypeId(intptr_t index) { | 38 static bool IsObjectStoreTypeId(intptr_t index) { |
| 38 // Check if this is a type which is stored in the object store. | 39 // Check if this is a type which is stored in the object store. |
| 39 return (index >= kObjectType && index <= kListInterface); | 40 return (index >= kObjectType && index <= kListInterface); |
| 40 } | 41 } |
| 41 | 42 |
| 42 | 43 |
| 43 static intptr_t ClassIdFromObjectId(intptr_t object_id) { | 44 static intptr_t ClassIdFromObjectId(intptr_t object_id) { |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); | 425 AllocateUninitialized(cls_, Context::InstanceSize(num_variables))); |
| 425 obj->ptr()->num_variables_ = num_variables; | 426 obj->ptr()->num_variables_ = num_variables; |
| 426 return obj; | 427 return obj; |
| 427 } | 428 } |
| 428 | 429 |
| 429 | 430 |
| 430 RawClass* SnapshotReader::NewClass(intptr_t class_id) { | 431 RawClass* SnapshotReader::NewClass(intptr_t class_id) { |
| 431 ASSERT(kind_ == Snapshot::kFull); | 432 ASSERT(kind_ == Snapshot::kFull); |
| 432 ASSERT(isolate()->no_gc_scope_depth() != 0); | 433 ASSERT(isolate()->no_gc_scope_depth() != 0); |
| 433 if (class_id < kNumPredefinedCids) { | 434 if (class_id < kNumPredefinedCids) { |
| 434 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid)); | 435 ASSERT((class_id >= kInstanceCid) && |
| 436 (class_id <= kExternalTwoByteStringCid)); |
| 435 return isolate()->class_table()->At(class_id); | 437 return isolate()->class_table()->At(class_id); |
| 436 } | 438 } |
| 437 cls_ = Object::class_class(); | 439 cls_ = Object::class_class(); |
| 438 RawClass* obj = reinterpret_cast<RawClass*>( | 440 RawClass* obj = reinterpret_cast<RawClass*>( |
| 439 AllocateUninitialized(cls_, Class::InstanceSize())); | 441 AllocateUninitialized(cls_, Class::InstanceSize())); |
| 440 Instance fake; | 442 Instance fake; |
| 441 obj->ptr()->handle_vtable_ = fake.vtable(); | 443 obj->ptr()->handle_vtable_ = fake.vtable(); |
| 442 cls_ = obj; | 444 cls_ = obj; |
| 443 cls_.set_id(kIllegalCid); | 445 cls_.set_id(kIllegalCid); |
| 444 isolate()->class_table()->Register(cls_); | 446 isolate()->class_table()->Register(cls_); |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 | 1172 |
| 1171 | 1173 |
| 1172 void MessageWriter::WriteMessage(const Object& obj) { | 1174 void MessageWriter::WriteMessage(const Object& obj) { |
| 1173 ASSERT(kind() == Snapshot::kMessage); | 1175 ASSERT(kind() == Snapshot::kMessage); |
| 1174 WriteObject(obj.raw()); | 1176 WriteObject(obj.raw()); |
| 1175 UnmarkAll(); | 1177 UnmarkAll(); |
| 1176 } | 1178 } |
| 1177 | 1179 |
| 1178 | 1180 |
| 1179 } // namespace dart | 1181 } // namespace dart |
| OLD | NEW |