Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 79b56fc077bc930918cc4b3230b31a462c534935..b838b42b3e6a20cdbbfefbbf6251f1b11fa44607 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -2748,7 +2748,11 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
// Load the result. |
__ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); |
- __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize)); |
+ __ ldr(result, |
Jakob Kummerow
2012/05/15 15:53:23
Formatting proposal:
uint32_t offset = FixedArr
|
+ FieldMemOperand(scratch, |
+ FixedArray::kHeaderSize |
+ + (instr->additional_index() |
+ << kPointerSizeLog2))); |
// Check for the hole value. |
if (instr->hydrogen()->RequiresHoleCheck()) { |
@@ -2780,13 +2784,14 @@ void LCodeGen::DoLoadKeyedFastDoubleElement( |
} |
Operand operand = key_is_constant |
- ? Operand(constant_key * (1 << shift_size) + |
+ ? Operand(((constant_key + instr->additional_index()) << shift_size) + |
FixedDoubleArray::kHeaderSize - kHeapObjectTag) |
: Operand(key, LSL, shift_size); |
__ add(elements, elements, operand); |
if (!key_is_constant) { |
__ add(elements, elements, |
- Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
+ Operand((FixedDoubleArray::kHeaderSize - kHeapObjectTag) |
+ + (instr->additional_index() << shift_size))); |
Jakob Kummerow
2012/05/15 15:53:23
nit: for consistency, the operator goes at the end
|
} |
__ ldr(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); |
@@ -2813,6 +2818,7 @@ void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
key = ToRegister(instr->key()); |
} |
int shift_size = ElementsKindToShiftSize(elements_kind); |
+ int additional_offset = instr->additional_index() << shift_size; |
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
@@ -2823,16 +2829,22 @@ void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
: Operand(key, LSL, shift_size); |
__ add(scratch0(), external_pointer, operand); |
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
- __ vldr(result.low(), scratch0(), 0); |
+ __ vldr(result.low(), scratch0(), additional_offset); |
__ vcvt_f64_f32(result, result.low()); |
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
- __ vldr(result, scratch0(), 0); |
+ __ vldr(result, scratch0(), additional_offset); |
} |
} else { |
Register result = ToRegister(instr->result()); |
+ if (instr->additional_index() != 0 && !key_is_constant) { |
+ __ add(scratch0(), key, Operand(instr->additional_index())); |
+ } |
MemOperand mem_operand(key_is_constant |
- ? MemOperand(external_pointer, constant_key * (1 << shift_size)) |
- : MemOperand(external_pointer, key, LSL, shift_size)); |
+ ? MemOperand(external_pointer, |
+ constant_key * (1 << shift_size) + additional_offset) |
Jakob Kummerow
2012/05/15 15:53:23
nit: drop the "* (1". Just "(constant_key << shift
|
+ : (instr->additional_index() == 0 |
+ ? MemOperand(external_pointer, key, LSL, shift_size) |
+ : MemOperand(external_pointer, scratch0(), LSL, shift_size))); |
switch (elements_kind) { |
case EXTERNAL_BYTE_ELEMENTS: |
__ ldrsb(result, mem_operand); |
@@ -3730,10 +3742,16 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
int offset = |
- ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize; |
+ (ToInteger32(const_operand) + instr->additional_index()) |
+ * kPointerSize + FixedArray::kHeaderSize; |
Jakob Kummerow
2012/05/15 15:53:23
nit: looks like "* kPointerSize" might just fit on
|
__ str(value, FieldMemOperand(elements, offset)); |
} else { |
__ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); |
+ if (instr->additional_index() != 0) { |
+ __ add(scratch, |
+ scratch, |
+ Operand(instr->additional_index() << kPointerSizeLog2)); |
+ } |
__ str(value, FieldMemOperand(scratch, FixedArray::kHeaderSize)); |
} |
@@ -3793,7 +3811,7 @@ void LCodeGen::DoStoreKeyedFastDoubleElement( |
vs); |
} |
- __ vstr(value, scratch, 0); |
+ __ vstr(value, scratch, instr->additional_index() << shift_size); |
} |
@@ -3814,6 +3832,7 @@ void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
key = ToRegister(instr->key()); |
} |
int shift_size = ElementsKindToShiftSize(elements_kind); |
+ int additional_offset = instr->additional_index() << shift_size; |
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
@@ -3824,15 +3843,22 @@ void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
__ add(scratch0(), external_pointer, operand); |
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
__ vcvt_f32_f64(double_scratch0().low(), value); |
- __ vstr(double_scratch0().low(), scratch0(), 0); |
+ __ vstr(double_scratch0().low(), scratch0(), additional_offset); |
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
- __ vstr(value, scratch0(), 0); |
+ __ vstr(value, scratch0(), additional_offset); |
} |
} else { |
Register value(ToRegister(instr->value())); |
+ if (instr->additional_index() != 0 && !key_is_constant) { |
+ __ add(scratch0(), key, Operand(instr->additional_index())); |
+ } |
MemOperand mem_operand(key_is_constant |
- ? MemOperand(external_pointer, constant_key * (1 << shift_size)) |
- : MemOperand(external_pointer, key, LSL, shift_size)); |
+ ? MemOperand(external_pointer, |
+ (constant_key + instr->additional_index()) |
+ * (1 << shift_size)) |
+ : (instr->additional_index() == 0 |
+ ? MemOperand(external_pointer, key, LSL, shift_size) |
Jakob Kummerow
2012/05/15 15:53:23
nit: 4 space indent please.
|
+ : MemOperand(external_pointer, scratch0(), LSL, shift_size))); |
switch (elements_kind) { |
case EXTERNAL_PIXEL_ELEMENTS: |
case EXTERNAL_BYTE_ELEMENTS: |