Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 5f17c9f2d8461e3f6efd0561c7adf1db4a52d77f..c0be0762504f7df846ea001908d25384e4d6584b 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -573,7 +573,12 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
// checks. |
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
- FieldIndex index = lookup->GetFieldIndex(); |
+ int index = lookup->GetFieldIndex().field_index(); |
+ |
+ // Adjust for the number of properties stored in the object. Even in the |
+ // face of a transition we can use the old map here because the size of the |
+ // object and the number of in-object properties is not going to change. |
+ index -= object->map()->inobject_properties(); |
Representation representation = lookup->representation(); |
ASSERT(!representation.IsNone()); |
@@ -599,12 +604,14 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
} |
} else if (representation.IsDouble()) { |
// Load the double storage. |
- if (index.is_inobject()) { |
- __ ldr(scratch1, FieldMemOperand(receiver_reg, index.offset())); |
+ if (index < 0) { |
+ int offset = object->map()->instance_size() + (index * kPointerSize); |
+ __ ldr(scratch1, FieldMemOperand(receiver_reg, offset)); |
} else { |
__ ldr(scratch1, |
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
- __ ldr(scratch1, FieldMemOperand(scratch1, index.offset())); |
+ int offset = index * kPointerSize + FixedArray::kHeaderSize; |
+ __ ldr(scratch1, FieldMemOperand(scratch1, offset)); |
} |
// Store the value into the storage. |
@@ -631,9 +638,10 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
// TODO(verwaest): Share this code as a code stub. |
SmiCheck smi_check = representation.IsTagged() |
? INLINE_SMI_CHECK : OMIT_SMI_CHECK; |
- if (index.is_inobject()) { |
+ if (index < 0) { |
// Set the property straight into the object. |
- __ str(value_reg, FieldMemOperand(receiver_reg, index.offset())); |
+ int offset = object->map()->instance_size() + (index * kPointerSize); |
+ __ str(value_reg, FieldMemOperand(receiver_reg, offset)); |
if (!representation.IsSmi()) { |
// Skip updating write barrier if storing a smi. |
@@ -643,7 +651,7 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
// Pass the now unused name_reg as a scratch register. |
__ mov(name_reg, value_reg); |
__ RecordWriteField(receiver_reg, |
- index.offset(), |
+ offset, |
name_reg, |
scratch1, |
kLRHasNotBeenSaved, |
@@ -653,10 +661,11 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
} |
} else { |
// Write to the properties array. |
+ int offset = index * kPointerSize + FixedArray::kHeaderSize; |
// Get the properties array |
__ ldr(scratch1, |
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
- __ str(value_reg, FieldMemOperand(scratch1, index.offset())); |
+ __ str(value_reg, FieldMemOperand(scratch1, offset)); |
if (!representation.IsSmi()) { |
// Skip updating write barrier if storing a smi. |
@@ -666,7 +675,7 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
// Ok to clobber receiver_reg and name_reg, since we return. |
__ mov(name_reg, value_reg); |
__ RecordWriteField(scratch1, |
- index.offset(), |
+ offset, |
name_reg, |
receiver_reg, |
kLRHasNotBeenSaved, |
@@ -997,14 +1006,20 @@ Register LoadStubCompiler::CallbackHandlerFrontend( |
void LoadStubCompiler::GenerateLoadField(Register reg, |
Handle<JSObject> holder, |
- FieldIndex field, |
+ PropertyIndex field, |
Representation representation) { |
if (!reg.is(receiver())) __ mov(receiver(), reg); |
if (kind() == Code::LOAD_IC) { |
- LoadFieldStub stub(isolate(), field); |
+ LoadFieldStub stub(isolate(), |
+ field.is_inobject(holder), |
+ field.translate(holder), |
+ representation); |
GenerateTailCall(masm(), stub.GetCode()); |
} else { |
- KeyedLoadFieldStub stub(isolate(), field); |
+ KeyedLoadFieldStub stub(isolate(), |
+ field.is_inobject(holder), |
+ field.translate(holder), |
+ representation); |
GenerateTailCall(masm(), stub.GetCode()); |
} |
} |