Chromium Code Reviews| Index: src/arm/lithium-codegen-arm.cc |
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
| index dc93aea3461da251a785470be020995d790024b0..237d88cf50f9c0a623f131f4a631810d2417a460 100644 |
| --- a/src/arm/lithium-codegen-arm.cc |
| +++ b/src/arm/lithium-codegen-arm.cc |
| @@ -2433,6 +2433,44 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
| } |
| +void LCodeGen::DoLoadKeyedFastDoubleElement( |
| + LLoadKeyedFastDoubleElement* instr) { |
| + Register elements = ToRegister(instr->elements()); |
| + bool key_is_constant = instr->key()->IsConstantOperand(); |
| + Register key = no_reg; |
| + DwVfpRegister result = ToDoubleRegister(instr->result()); |
| + Register scratch1 = scratch0(); |
|
Mads Ager (chromium)
2011/07/19 08:03:51
scratch1 -> scratch?
danno
2011/07/19 12:50:17
Done.
|
| + |
| + int shift_size = |
| + ElementsKindToShiftSize(JSObject::FAST_DOUBLE_ELEMENTS); |
| + int constant_key = 0; |
| + if (key_is_constant) { |
| + constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| + if (constant_key & 0xF0000000) { |
| + Abort("array index constant value too big."); |
| + } |
| + } else { |
| + key = ToRegister(instr->key()); |
| + } |
| + |
| + Operand operand(key_is_constant ? Operand(constant_key * (1 << shift_size)) |
|
Mads Ager (chromium)
2011/07/19 08:03:51
Use "operand = expression" instead of "operand(exp
danno
2011/07/19 12:50:17
Done.
|
| + : Operand(key, LSL, shift_size)); |
| + __ add(elements, elements, operand); |
|
Alexandre
2011/07/18 16:22:14
If key is constant this add instruction can be mer
Mads Ager (chromium)
2011/07/19 08:03:51
I'm fine with tweaking stuff like this later. I th
danno
2011/07/19 12:50:17
Done.
|
| + |
| + if (instr->hydrogen()->RequiresHoleCheck()) { |
| + int offset = |
| + FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); |
| + __ ldr(scratch1, FieldMemOperand(elements, offset)); |
| + __ cmp(scratch1, Operand(kHoleNanUpper32)); |
| + DeoptimizeIf(eq, instr->environment()); |
| + } |
| + |
| + __ add(elements, elements, |
| + Operand(FixedDoubleArray::kHeaderSize - kSmiTagMask)); |
|
Mads Ager (chromium)
2011/07/19 08:03:51
kSmiTagMask -> kHeapObjectTag?
danno
2011/07/19 12:50:17
Done.
|
| + __ vldr(result, elements, 0); |
| +} |
| + |
| + |
| void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| LLoadKeyedSpecializedArrayElement* instr) { |
| Register external_pointer = ToRegister(instr->external_pointer()); |
| @@ -3243,6 +3281,43 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
| } |
| +void LCodeGen::DoStoreKeyedFastDoubleElement( |
| + LStoreKeyedFastDoubleElement* instr) { |
| + DwVfpRegister value = ToDoubleRegister(instr->value()); |
| + Register elements = ToRegister(instr->elements()); |
| + Register key = no_reg; |
| + bool key_is_constant = instr->key()->IsConstantOperand(); |
| + int constant_key = 0; |
| + Label not_nan; |
| + |
| + // Calculate the effective address of the slot in the array to store the |
| + // double value. |
| + if (key_is_constant) { |
| + constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| + if (constant_key & 0xF0000000) { |
| + Abort("array index constant value too big."); |
| + } |
| + } else { |
| + key = ToRegister(instr->key()); |
| + } |
| + int shift_size = ElementsKindToShiftSize(JSObject::FAST_DOUBLE_ELEMENTS); |
| + Operand operand(key_is_constant ? Operand(constant_key * (1 << shift_size)) |
|
Mads Ager (chromium)
2011/07/19 08:03:51
I would use '=' here.
danno
2011/07/19 12:50:17
Done.
|
| + : Operand(key, LSL, shift_size)); |
| + __ add(elements, elements, operand); |
|
Alexandre
2011/07/18 16:22:14
If the key is constant, these two add instructions
Mads Ager (chromium)
2011/07/19 08:03:51
Instead of writing to elements here, can you use t
danno
2011/07/19 12:50:17
Done.
danno
2011/07/19 12:50:17
Done.
|
| + __ add(elements, elements, |
| + Operand(FixedDoubleArray::kHeaderSize - kSmiTagMask)); |
|
Mads Ager (chromium)
2011/07/19 08:03:51
kHeapObjectTag
danno
2011/07/19 12:50:17
Done.
|
| + |
| + // Check for NaN. All NaNs must be canonicalized. |
| + __ VFPCompareAndSetFlags(value, value); |
| + __ b(vc, ¬_nan); |
| + |
| + __ Vmov(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double()); |
|
Alexandre
2011/07/18 16:22:14
You can spare the previous branch by making this v
danno
2011/07/19 12:50:17
Done.
|
| + |
| + __ bind(¬_nan); |
| + __ vstr(value, elements, 0); |
| +} |
| + |
| + |
| void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
| LStoreKeyedSpecializedArrayElement* instr) { |