Index: src/code-stub-assembler.cc |
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
index 5295189a8e7816bdc7947828b3486554c0596e31..e0cf5794ab14421e9dba5163bbae062a04662b46 100644 |
--- a/src/code-stub-assembler.cc |
+++ b/src/code-stub-assembler.cc |
@@ -1116,12 +1116,32 @@ Node* CodeStubAssembler::StoreObjectField( |
IntPtrConstant(offset - kHeapObjectTag), value); |
} |
+Node* CodeStubAssembler::StoreObjectField(Node* object, Node* offset, |
+ Node* value) { |
+ int const_offset; |
+ if (ToInt32Constant(offset, const_offset)) { |
+ return StoreObjectField(object, const_offset, value); |
+ } |
+ return Store(MachineRepresentation::kTagged, object, |
+ IntPtrSub(offset, IntPtrConstant(kHeapObjectTag)), value); |
+} |
+ |
Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( |
Node* object, int offset, Node* value, MachineRepresentation rep) { |
return StoreNoWriteBarrier(rep, object, |
IntPtrConstant(offset - kHeapObjectTag), value); |
} |
+Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( |
+ Node* object, Node* offset, Node* value, MachineRepresentation rep) { |
+ int const_offset; |
+ if (ToInt32Constant(offset, const_offset)) { |
+ return StoreObjectFieldNoWriteBarrier(object, const_offset, value, rep); |
+ } |
+ return StoreNoWriteBarrier( |
+ rep, object, IntPtrSub(offset, IntPtrConstant(kHeapObjectTag)), value); |
+} |
+ |
Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { |
return StoreNoWriteBarrier( |
MachineRepresentation::kTagged, object, |
@@ -5080,15 +5100,22 @@ void CodeStubAssembler::StoreNamedField(Node* object, FieldIndex index, |
Node* value, bool transition_to_field) { |
DCHECK_EQ(index.is_double(), representation.IsDouble()); |
+ StoreNamedField(object, IntPtrConstant(index.offset()), index.is_inobject(), |
+ representation, value, transition_to_field); |
+} |
+ |
+void CodeStubAssembler::StoreNamedField(Node* object, Node* offset, |
+ bool is_inobject, |
+ Representation representation, |
+ Node* value, bool transition_to_field) { |
bool store_value_as_double = representation.IsDouble(); |
- int offset = index.offset(); |
Node* property_storage = object; |
- if (!index.is_inobject()) { |
+ if (!is_inobject) { |
property_storage = LoadProperties(object); |
} |
if (representation.IsDouble()) { |
- if (!FLAG_unbox_double_fields || !index.is_inobject()) { |
+ if (!FLAG_unbox_double_fields || !is_inobject) { |
if (transition_to_field) { |
Node* heap_number = AllocateHeapNumberWithValue(value, MUTABLE); |
// Store the new mutable heap number into the object. |
@@ -5098,7 +5125,7 @@ void CodeStubAssembler::StoreNamedField(Node* object, FieldIndex index, |
// Load the heap number. |
property_storage = LoadObjectField(property_storage, offset); |
// Store the double value into it. |
- offset = HeapNumber::kValueOffset; |
+ offset = IntPtrConstant(HeapNumber::kValueOffset); |
} |
} |
} |