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

Unified Diff: vm/snapshot.cc

Issue 10807078: Address review comments from a previous CL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« vm/object.cc ('K') | « vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« vm/object.cc ('K') | « vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698