Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index c8be271cf969f2818214eabf041f0263bd99b6b2..b0aa310b7419d90d5aaaa5fba1c7182b9c7c97c2 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -618,12 +618,7 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
// checks. |
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
- 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(); |
+ FieldIndex index = lookup->GetFieldIndex(); |
Representation representation = lookup->representation(); |
ASSERT(!representation.IsNone()); |
@@ -648,14 +643,12 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm, |
} |
} else if (representation.IsDouble()) { |
// Load the double storage. |
- if (index < 0) { |
- int offset = object->map()->instance_size() + (index * kPointerSize); |
- __ movp(scratch1, FieldOperand(receiver_reg, offset)); |
+ if (index.is_inobject()) { |
+ __ movp(scratch1, FieldOperand(receiver_reg, index.offset())); |
} else { |
__ movp(scratch1, |
FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
- int offset = index * kPointerSize + FixedArray::kHeaderSize; |
- __ movp(scratch1, FieldOperand(scratch1, offset)); |
+ __ movp(scratch1, FieldOperand(scratch1, index.offset())); |
} |
// Store the value into the storage. |
@@ -680,32 +673,30 @@ 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 < 0) { |
+ if (index.is_inobject()) { |
// Set the property straight into the object. |
- int offset = object->map()->instance_size() + (index * kPointerSize); |
- __ movp(FieldOperand(receiver_reg, offset), value_reg); |
+ __ movp(FieldOperand(receiver_reg, index.offset()), value_reg); |
if (!representation.IsSmi()) { |
// Update the write barrier for the array address. |
// Pass the value being stored in the now unused name_reg. |
__ movp(name_reg, value_reg); |
__ RecordWriteField( |
- receiver_reg, offset, name_reg, scratch1, kDontSaveFPRegs, |
+ receiver_reg, index.offset(), name_reg, scratch1, kDontSaveFPRegs, |
EMIT_REMEMBERED_SET, smi_check); |
} |
} else { |
// Write to the properties array. |
- int offset = index * kPointerSize + FixedArray::kHeaderSize; |
// Get the properties array (optimistically). |
__ movp(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
- __ movp(FieldOperand(scratch1, offset), value_reg); |
+ __ movp(FieldOperand(scratch1, index.offset()), value_reg); |
if (!representation.IsSmi()) { |
// Update the write barrier for the array address. |
// Pass the value being stored in the now unused name_reg. |
__ movp(name_reg, value_reg); |
__ RecordWriteField( |
- scratch1, offset, name_reg, receiver_reg, kDontSaveFPRegs, |
+ scratch1, index.offset(), name_reg, receiver_reg, kDontSaveFPRegs, |
EMIT_REMEMBERED_SET, smi_check); |
} |
} |
@@ -913,20 +904,14 @@ Register LoadStubCompiler::CallbackHandlerFrontend( |
void LoadStubCompiler::GenerateLoadField(Register reg, |
Handle<JSObject> holder, |
- PropertyIndex field, |
+ FieldIndex field, |
Representation representation) { |
if (!reg.is(receiver())) __ movp(receiver(), reg); |
if (kind() == Code::LOAD_IC) { |
- LoadFieldStub stub(isolate(), |
- field.is_inobject(holder), |
- field.translate(holder), |
- representation); |
+ LoadFieldStub stub(isolate(), field); |
GenerateTailCall(masm(), stub.GetCode()); |
} else { |
- KeyedLoadFieldStub stub(isolate(), |
- field.is_inobject(holder), |
- field.translate(holder), |
- representation); |
+ KeyedLoadFieldStub stub(isolate(), field); |
GenerateTailCall(masm(), stub.GetCode()); |
} |
} |