Commit cd95464d authored by danno@chromium.org's avatar danno@chromium.org

Fix write barrier for StoreKeyedFastElements on ARM

R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10824107

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12238 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b3e24405
...@@ -2781,13 +2781,14 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { ...@@ -2781,13 +2781,14 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Register elements = ToRegister(instr->elements()); Register elements = ToRegister(instr->elements());
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
Register scratch = scratch0(); Register scratch = scratch0();
Register store_base = scratch;
int offset = 0;
if (instr->key()->IsConstantOperand()) { if (instr->key()->IsConstantOperand()) {
LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
int offset = offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
(ToInteger32(const_operand) + instr->additional_index()) * kPointerSize instr->additional_index());
+ FixedArray::kHeaderSize; store_base = elements;
__ ldr(result, FieldMemOperand(elements, offset));
} else { } else {
Register key = EmitLoadRegister(instr->key(), scratch0()); Register key = EmitLoadRegister(instr->key(), scratch0());
// Even though the HLoadKeyedFastElement instruction forces the input // Even though the HLoadKeyedFastElement instruction forces the input
...@@ -2800,10 +2801,9 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { ...@@ -2800,10 +2801,9 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
} else { } else {
__ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
} }
uint32_t offset = FixedArray::kHeaderSize + offset = FixedArray::OffsetOfElementAt(instr->additional_index());
(instr->additional_index() << kPointerSizeLog2);
__ ldr(result, FieldMemOperand(scratch, offset));
} }
__ ldr(result, FieldMemOperand(store_base, offset));
// Check for the hole value. // Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) { if (instr->hydrogen()->RequiresHoleCheck()) {
...@@ -3849,15 +3849,16 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { ...@@ -3849,15 +3849,16 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
Register elements = ToRegister(instr->object()); Register elements = ToRegister(instr->object());
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
Register scratch = scratch0(); Register scratch = scratch0();
Register store_base = scratch;
int offset = 0;
// Do the store. // Do the store.
if (instr->key()->IsConstantOperand()) { if (instr->key()->IsConstantOperand()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
int offset = offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
(ToInteger32(const_operand) + instr->additional_index()) * kPointerSize instr->additional_index());
+ FixedArray::kHeaderSize; store_base = elements;
__ str(value, FieldMemOperand(elements, offset));
} else { } else {
// Even though the HLoadKeyedFastElement instruction forces the input // Even though the HLoadKeyedFastElement instruction forces the input
// representation for the key to be an integer, the input gets replaced // representation for the key to be an integer, the input gets replaced
...@@ -3869,17 +3870,16 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { ...@@ -3869,17 +3870,16 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
} else { } else {
__ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2));
} }
uint32_t offset = FixedArray::kHeaderSize + offset = FixedArray::OffsetOfElementAt(instr->additional_index());
(instr->additional_index() << kPointerSizeLog2);
__ str(value, FieldMemOperand(scratch, offset));
} }
__ str(value, FieldMemOperand(store_base, offset));
if (instr->hydrogen()->NeedsWriteBarrier()) { if (instr->hydrogen()->NeedsWriteBarrier()) {
HType type = instr->hydrogen()->value()->type(); HType type = instr->hydrogen()->value()->type();
SmiCheck check_needed = SmiCheck check_needed =
type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
// Compute address of modified element and store it into key register. // Compute address of modified element and store it into key register.
__ add(key, scratch, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); __ add(key, store_base, Operand(offset - kHeapObjectTag));
__ RecordWrite(elements, __ RecordWrite(elements,
key, key,
value, value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment