Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 6317a54a2b400385c2c75ff3c59b6fac8ca36deb..ff569b37073b1cdfcc85d55677dc22d1323cb772 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2648,6 +2648,7 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
__ mov(result, |
BuildFastArrayOperand(instr->elements(), |
instr->key(), |
+ instr->hydrogen()->key()->representation(), |
FAST_ELEMENTS, |
FixedArray::kHeaderSize - kHeapObjectTag, |
instr->additional_index())); |
@@ -2674,6 +2675,7 @@ void LCodeGen::DoLoadKeyedFastDoubleElement( |
sizeof(kHoleNanLower32); |
Operand hole_check_operand = BuildFastArrayOperand( |
instr->elements(), instr->key(), |
+ instr->hydrogen()->key()->representation(), |
FAST_DOUBLE_ELEMENTS, |
offset, |
instr->additional_index()); |
@@ -2684,6 +2686,7 @@ void LCodeGen::DoLoadKeyedFastDoubleElement( |
Operand double_load_operand = BuildFastArrayOperand( |
instr->elements(), |
instr->key(), |
+ instr->hydrogen()->key()->representation(), |
FAST_DOUBLE_ELEMENTS, |
FixedDoubleArray::kHeaderSize - kHeapObjectTag, |
instr->additional_index()); |
@@ -2694,11 +2697,15 @@ void LCodeGen::DoLoadKeyedFastDoubleElement( |
Operand LCodeGen::BuildFastArrayOperand( |
LOperand* elements_pointer, |
LOperand* key, |
+ Representation key_representation, |
ElementsKind elements_kind, |
uint32_t offset, |
uint32_t additional_index) { |
Register elements_pointer_reg = ToRegister(elements_pointer); |
int shift_size = ElementsKindToShiftSize(elements_kind); |
+ if (key_representation.IsTagged() && shift_size >= 1) { |
Michael Starzinger
2012/07/19 21:02:23
Can we also make this condition use !ExternalArray
danno
2012/07/20 09:51:57
Done.
danno
2012/07/20 10:40:27
Actually, it turns out that ExternalArrayOpRequire
Michael Starzinger
2012/07/20 10:50:25
I see, OK. Just use the kSmiTagSize constant.
|
+ shift_size -= 1; |
Michael Starzinger
2012/07/19 21:02:23
Can we use kSmiTagSize here?
danno
2012/07/20 09:51:57
Done.
|
+ } |
if (key->IsConstantOperand()) { |
int constant_value = ToInteger32(LConstantOperand::cast(key)); |
if (constant_value & 0xF0000000) { |
@@ -2720,11 +2727,19 @@ Operand LCodeGen::BuildFastArrayOperand( |
void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
LLoadKeyedSpecializedArrayElement* instr) { |
ElementsKind elements_kind = instr->elements_kind(); |
- Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
- instr->key(), |
- elements_kind, |
- 0, |
- instr->additional_index())); |
+ LOperand* key = instr->key(); |
+ if (!key->IsConstantOperand() && |
+ ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), |
+ elements_kind)) { |
+ __ SmiUntag(ToRegister(key)); |
+ } |
+ Operand operand(BuildFastArrayOperand( |
+ instr->external_pointer(), |
+ key, |
+ instr->hydrogen()->key()->representation(), |
+ elements_kind, |
+ 0, |
+ instr->additional_index())); |
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
XMMRegister result(ToDoubleRegister(instr->result())); |
__ movss(result, operand); |
@@ -3677,11 +3692,19 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
LStoreKeyedSpecializedArrayElement* instr) { |
ElementsKind elements_kind = instr->elements_kind(); |
- Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
- instr->key(), |
- elements_kind, |
- 0, |
- instr->additional_index())); |
+ LOperand* key = instr->key(); |
+ if (!key->IsConstantOperand() && |
+ ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), |
+ elements_kind)) { |
+ __ SmiUntag(ToRegister(key)); |
+ } |
+ Operand operand(BuildFastArrayOperand( |
+ instr->external_pointer(), |
+ key, |
+ instr->hydrogen()->key()->representation(), |
+ elements_kind, |
+ 0, |
+ instr->additional_index())); |
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
__ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); |
__ movss(operand, xmm0); |
@@ -3728,6 +3751,7 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
Operand operand = BuildFastArrayOperand( |
instr->object(), |
instr->key(), |
+ instr->hydrogen()->key()->representation(), |
FAST_ELEMENTS, |
FixedArray::kHeaderSize - kHeapObjectTag, |
instr->additional_index()); |
@@ -3769,6 +3793,7 @@ void LCodeGen::DoStoreKeyedFastDoubleElement( |
Operand double_store_operand = BuildFastArrayOperand( |
instr->elements(), |
instr->key(), |
+ instr->hydrogen()->key()->representation(), |
FAST_DOUBLE_ELEMENTS, |
FixedDoubleArray::kHeaderSize - kHeapObjectTag, |
instr->additional_index()); |