Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 5f58306ec22d41b4dd98ba8303c00b06b6c5a656..cd61ab52b92a657d66eaef1d2b759e3123584d0d 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -17,6 +17,7 @@ |
#include "src/objects.h" |
#include "src/contexts.h" |
#include "src/conversions-inl.h" |
+#include "src/field-index-inl.h" |
#include "src/heap.h" |
#include "src/isolate.h" |
#include "src/heap-inl.h" |
@@ -1945,29 +1946,22 @@ void JSObject::SetInternalField(int index, Smi* value) { |
// Access fast-case object properties at index. The use of these routines |
// is needed to correctly distinguish between properties stored in-object and |
// properties stored in the properties array. |
-Object* JSObject::RawFastPropertyAt(int index) { |
- // Adjust for the number of properties stored in the object. |
- index -= map()->inobject_properties(); |
- if (index < 0) { |
- int offset = map()->instance_size() + (index * kPointerSize); |
- return READ_FIELD(this, offset); |
+Object* JSObject::RawFastPropertyAt(FieldIndex index) { |
+ if (index.is_inobject()) { |
+ return READ_FIELD(this, index.offset()); |
} else { |
- ASSERT(index < properties()->length()); |
- return properties()->get(index); |
+ return properties()->get(index.outobject_array_index()); |
} |
} |
-void JSObject::FastPropertyAtPut(int index, Object* value) { |
- // Adjust for the number of properties stored in the object. |
- index -= map()->inobject_properties(); |
- if (index < 0) { |
- int offset = map()->instance_size() + (index * kPointerSize); |
+void JSObject::FastPropertyAtPut(FieldIndex index, Object* value) { |
+ if (index.is_inobject()) { |
+ int offset = index.offset(); |
WRITE_FIELD(this, offset, value); |
WRITE_BARRIER(GetHeap(), this, offset, value); |
} else { |
- ASSERT(index < properties()->length()); |
- properties()->set(index, value); |
+ properties()->set(index.outobject_array_index(), value); |
} |
} |
@@ -4076,7 +4070,7 @@ 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); |
+ ASSERT(index <= 0); |
return instance_size() + (index * kPointerSize); |
} |