Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 9e388e968cd537c40f6f173a9e587af38917edc3..dd3c0b182d616fda37b0c66d24acba52e2593570 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1968,18 +1968,12 @@ void JSObject::FastPropertyAtPut(int index, Object* value) { |
int JSObject::GetInObjectPropertyOffset(int index) { |
- // Adjust for the number of properties stored in the object. |
- index -= map()->inobject_properties(); |
- ASSERT(index < 0); |
- return map()->instance_size() + (index * kPointerSize); |
+ return map()->GetInObjectPropertyOffset(index); |
} |
Object* JSObject::InObjectPropertyAt(int index) { |
- // Adjust for the number of properties stored in the object. |
- index -= map()->inobject_properties(); |
- ASSERT(index < 0); |
- int offset = map()->instance_size() + (index * kPointerSize); |
+ int offset = GetInObjectPropertyOffset(index); |
return READ_FIELD(this, offset); |
} |
@@ -1988,9 +1982,7 @@ Object* JSObject::InObjectPropertyAtPut(int index, |
Object* value, |
WriteBarrierMode mode) { |
// Adjust for the number of properties stored in the object. |
- index -= map()->inobject_properties(); |
- ASSERT(index < 0); |
- int offset = map()->instance_size() + (index * kPointerSize); |
+ int offset = GetInObjectPropertyOffset(index); |
WRITE_FIELD(this, offset, value); |
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); |
return value; |
@@ -3808,6 +3800,14 @@ int Map::pre_allocated_property_fields() { |
} |
+int Map::GetInObjectPropertyOffset(int index) { |
+ // Adjust for the number of properties stored in the object. |
+ index -= inobject_properties(); |
+ ASSERT(index < 0); |
+ return instance_size() + (index * kPointerSize); |
+} |
+ |
+ |
int HeapObject::SizeFromMap(Map* map) { |
int instance_size = map->instance_size(); |
if (instance_size != kVariableSizeSentinel) return instance_size; |