| Index: src/ia32/stub-cache-ia32.cc
|
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
|
| index 9eb113cede43253aa7738657f86e8b74e67eb9c6..75533d1259e143cfd47c32f4e4027209d69e6183 100644
|
| --- a/src/ia32/stub-cache-ia32.cc
|
| +++ b/src/ia32/stub-cache-ia32.cc
|
| @@ -661,7 +661,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());
|
| @@ -686,11 +691,13 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm,
|
| }
|
| } else if (representation.IsDouble()) {
|
| // Load the double storage.
|
| - if (index.is_inobject()) {
|
| - __ mov(scratch1, FieldOperand(receiver_reg, index.offset()));
|
| + if (index < 0) {
|
| + int offset = object->map()->instance_size() + (index * kPointerSize);
|
| + __ mov(scratch1, FieldOperand(receiver_reg, offset));
|
| } else {
|
| __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
|
| - __ mov(scratch1, FieldOperand(scratch1, index.offset()));
|
| + int offset = index * kPointerSize + FixedArray::kHeaderSize;
|
| + __ mov(scratch1, FieldOperand(scratch1, offset));
|
| }
|
|
|
| // Store the value into the storage.
|
| @@ -716,16 +723,17 @@ 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.
|
| - __ mov(FieldOperand(receiver_reg, index.offset()), value_reg);
|
| + int offset = object->map()->instance_size() + (index * kPointerSize);
|
| + __ mov(FieldOperand(receiver_reg, 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.
|
| __ mov(name_reg, value_reg);
|
| __ RecordWriteField(receiver_reg,
|
| - index.offset(),
|
| + offset,
|
| name_reg,
|
| scratch1,
|
| kDontSaveFPRegs,
|
| @@ -734,16 +742,17 @@ void StoreStubCompiler::GenerateStoreField(MacroAssembler* masm,
|
| }
|
| } else {
|
| // Write to the properties array.
|
| + int offset = index * kPointerSize + FixedArray::kHeaderSize;
|
| // Get the properties array (optimistically).
|
| __ mov(scratch1, FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
|
| - __ mov(FieldOperand(scratch1, index.offset()), value_reg);
|
| + __ mov(FieldOperand(scratch1, 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.
|
| __ mov(name_reg, value_reg);
|
| __ RecordWriteField(scratch1,
|
| - index.offset(),
|
| + offset,
|
| name_reg,
|
| receiver_reg,
|
| kDontSaveFPRegs,
|
| @@ -963,14 +972,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());
|
| }
|
| }
|
|
|