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..7575cd80c56cdd9aa382b01d077b3ba18f3d2c29 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -2748,7 +2748,9 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
// Load the result. |
__ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); |
- __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize)); |
+ uint32_t offset = FixedArray::kHeaderSize + |
+ (instr->additional_index() << kPointerSizeLog2); |
+ __ ldr(result, FieldMemOperand(scratch, offset)); |
// Check for the hole value. |
if (instr->hydrogen()->RequiresHoleCheck()) { |
@@ -2780,13 +2782,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))); |
} |
__ ldr(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); |
@@ -2813,26 +2816,33 @@ 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) { |
CpuFeatures::Scope scope(VFP3); |
DwVfpRegister result = ToDoubleRegister(instr->result()); |
Operand operand = key_is_constant |
- ? Operand(constant_key * (1 << shift_size)) |
+ ? Operand(constant_key << shift_size) |
: 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 << shift_size) + additional_offset) |
+ : (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 +3740,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; |
__ 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)); |
} |
@@ -3775,7 +3791,7 @@ void LCodeGen::DoStoreKeyedFastDoubleElement( |
} |
int shift_size = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); |
Operand operand = key_is_constant |
- ? Operand(constant_key * (1 << shift_size) + |
+ ? Operand((constant_key << shift_size) + |
FixedDoubleArray::kHeaderSize - kHeapObjectTag) |
: Operand(key, LSL, shift_size); |
__ add(scratch, elements, operand); |
@@ -3793,7 +3809,7 @@ void LCodeGen::DoStoreKeyedFastDoubleElement( |
vs); |
} |
- __ vstr(value, scratch, 0); |
+ __ vstr(value, scratch, instr->additional_index() << shift_size); |
} |
@@ -3814,25 +3830,33 @@ 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) { |
CpuFeatures::Scope scope(VFP3); |
DwVfpRegister value(ToDoubleRegister(instr->value())); |
- Operand operand(key_is_constant ? Operand(constant_key * (1 << shift_size)) |
+ Operand operand(key_is_constant ? Operand(constant_key << shift_size) |
: Operand(key, LSL, shift_size)); |
__ 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()) |
+ << shift_size)) |
+ : (instr->additional_index() == 0 |
+ ? MemOperand(external_pointer, key, LSL, shift_size) |
+ : MemOperand(external_pointer, scratch0(), LSL, shift_size))); |
switch (elements_kind) { |
case EXTERNAL_PIXEL_ELEMENTS: |
case EXTERNAL_BYTE_ELEMENTS: |