Reviewers: danno, Paul Lind, kisg,
Message:
Please merge this CL to the 3.12 branch as well.
This patch requires the following patch to be landed first:
https://chromiumcodereview.appspot.com/10825263/publish
Description:
MIPS: Fix write barrier for StoreKeyedFastElements on ARM.
Port r12238 (300f3dac)
BUG=
TEST=
Please review this at https://chromiumcodereview.appspot.com/10828216/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/mips/lithium-codegen-mips.cc
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
ce59937eb6d0af3ae7f188c1898786a448122f94..e6c66bde1308b325de6e764a222b3508d804bdf1
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -2527,13 +2527,14 @@ void
LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Register elements = ToRegister(instr->elements());
Register result = ToRegister(instr->result());
Register scratch = scratch0();
+ Register store_base = scratch;
+ int offset = 0;
if (instr->key()->IsConstantOperand()) {
LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
- int offset =
- (ToInteger32(const_operand) + instr->additional_index()) *
kPointerSize
- + FixedArray::kHeaderSize;
- __ lw(result, FieldMemOperand(elements, offset));
+ offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
+ instr->additional_index());
+ store_base = elements;
} else {
Register key = EmitLoadRegister(instr->key(), scratch);
// Even though the HLoadKeyedFastElement instruction forces the input
@@ -2547,10 +2548,9 @@ void
LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
__ sll(scratch, key, kPointerSizeLog2);
__ addu(scratch, elements, scratch);
}
- uint32_t offset = FixedArray::kHeaderSize +
- (instr->additional_index() << kPointerSizeLog2);
- __ lw(result, FieldMemOperand(scratch, offset));
+ offset = FixedArray::OffsetOfElementAt(instr->additional_index());
}
+ __ lw(result, FieldMemOperand(store_base, offset));
// Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) {
@@ -3622,15 +3622,16 @@ void
LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
Register elements = ToRegister(instr->object());
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) :
no_reg;
Register scratch = scratch0();
+ Register store_base = scratch;
+ int offset = 0;
// Do the store.
if (instr->key()->IsConstantOperand()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
LConstantOperand* const_operand = LConstantOperand::cast(instr->key());
- int offset =
- (ToInteger32(const_operand) + instr->additional_index()) *
kPointerSize
- + FixedArray::kHeaderSize;
- __ sw(value, FieldMemOperand(elements, offset));
+ offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) +
+ instr->additional_index());
+ store_base = elements;
} else {
// Even though the HLoadKeyedFastElement instruction forces the input
// representation for the key to be an integer, the input gets replaced
@@ -3643,17 +3644,16 @@ void
LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
__ sll(scratch, key, kPointerSizeLog2);
__ addu(scratch, elements, scratch);
}
- uint32_t offset = FixedArray::kHeaderSize +
- (instr->additional_index() << kPointerSizeLog2);
- __ sw(value, FieldMemOperand(scratch, offset));
+ offset = FixedArray::OffsetOfElementAt(instr->additional_index());
}
+ __ sw(value, FieldMemOperand(store_base, offset));
if (instr->hydrogen()->NeedsWriteBarrier()) {
HType type = instr->hydrogen()->value()->type();
SmiCheck check_needed =
type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
// Compute address of modified element and store it into key register.
- __ Addu(key, scratch, Operand(FixedArray::kHeaderSize -
kHeapObjectTag));
+ __ Addu(key, store_base, Operand(offset - kHeapObjectTag));
__ RecordWrite(elements,
key,
value,
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev