| Index: vm/snapshot.cc
|
| ===================================================================
|
| --- vm/snapshot.cc (revision 9828)
|
| +++ vm/snapshot.cc (working copy)
|
| @@ -23,21 +23,22 @@
|
|
|
|
|
| static bool IsSingletonClassId(intptr_t index) {
|
| - // Check if this is a singleton object class which is shared by all isolates.
|
| - return (index >= Object::kClassClass && index < Object::kMaxId);
|
| + // Check if this is a singleton class which is shared by all isolates.
|
| + return ((index >= kClass && index <= kUnwindError) ||
|
| + (index >= kNullClassId && index <= kVoidClassId));
|
| }
|
|
|
|
|
| static bool IsObjectStoreClassId(intptr_t index) {
|
| // Check if this is a class which is stored in the object store.
|
| - return (index >= ObjectStore::kObjectClass && index < ObjectStore::kMaxId);
|
| + return ((index == kObject) || (index >= kInstance && index <= kJSRegExp));
|
| }
|
|
|
|
|
| static bool IsObjectStoreTypeId(intptr_t index) {
|
| // Check if this is a type which is stored in the object store.
|
| return (index >= ObjectStore::kObjectType &&
|
| - index <= ObjectStore::kListInterface);
|
| + index <= ObjectStore::kByteArrayInterface);
|
| }
|
|
|
|
|
| @@ -474,10 +475,9 @@
|
| // stored in the object store.
|
| if (header_type == kObjectId) {
|
| intptr_t header_value = SerializedHeaderData::decode(class_header);
|
| - if (IsObjectStoreClassId(header_value)) {
|
| - return object_store()->GetClass(header_value);
|
| - } else if (IsSingletonClassId(header_value)) {
|
| - return Object::GetSingletonClass(header_value); // return the singleton.
|
| + if (IsObjectStoreClassId(header_value) ||
|
| + IsSingletonClassId(header_value)) {
|
| + return class_table()->At(header_value);
|
| }
|
| }
|
| return Class::null();
|
| @@ -518,10 +518,8 @@
|
| if (object_id == Object::kSentinelObject) {
|
| return Object::sentinel();
|
| }
|
| - if (IsSingletonClassId(object_id)) {
|
| - return Object::GetSingletonClass(object_id); // return singleton object.
|
| - } else if (IsObjectStoreClassId(object_id)) {
|
| - return object_store()->GetClass(object_id);
|
| + if (IsSingletonClassId(object_id) || IsObjectStoreClassId(object_id)) {
|
| + return class_table()->At(object_id);
|
| } else if (object_id == ObjectStore::kTrueValue) {
|
| return object_store()->true_value();
|
| } else if (object_id == ObjectStore::kFalseValue) {
|
| @@ -669,7 +667,7 @@
|
| WriteSerializationMarker(kInlined, object_id);
|
|
|
| // Write out the class information.
|
| - WriteIndexedObject(ObjectStore::kArrayClass);
|
| + WriteIndexedObject(kArray);
|
|
|
| // Write out the length field.
|
| Write<RawObject*>(rawarray->ptr()->length_);
|
| @@ -689,7 +687,7 @@
|
| WriteSerializationMarker(kInlined, object_id);
|
|
|
| // Write out the class information.
|
| - WriteIndexedObject(ObjectStore::kImmutableArrayClass);
|
| + WriteIndexedObject(kImmutableArray);
|
|
|
| // Write out the length field.
|
| Write<RawObject*>(rawarray->ptr()->length_);
|
| @@ -801,8 +799,7 @@
|
|
|
| // Check if it is a singleton class object which is shared by
|
| // all isolates.
|
| - RawClass* raw_class = reinterpret_cast<RawClass*>(rawobj);
|
| - intptr_t index = Object::GetSingletonClassIndex(raw_class);
|
| + intptr_t index = Object::GetSingletonClassIndex(rawobj);
|
| if (index != Object::kInvalidIndex) {
|
| WriteIndexedObject(index);
|
| return true;
|
| @@ -948,14 +945,14 @@
|
|
|
| void SnapshotWriter::WriteClassId(RawClass* cls) {
|
| ASSERT(kind_ != Snapshot::kFull);
|
| - int id = object_store()->GetClassIndex(cls);
|
| + int id = cls->ptr()->id_;
|
| if (IsSingletonClassId(id) || IsObjectStoreClassId(id)) {
|
| WriteIndexedObject(id);
|
| } else {
|
| // TODO(5411462): Should restrict this to only core-lib classes in this
|
| // case.
|
| // Write out the class and tags information.
|
| - WriteObjectHeader(Object::kClassClass, GetObjectTags(cls));
|
| + WriteObjectHeader(kClass, GetObjectTags(cls));
|
|
|
| // Write out the library url and class name.
|
| RawLibrary* library = cls->ptr()->library_;
|
|
|