Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index 96b7937391907f085998d6497849567aff5c3f89..7cf95f3c2e686a25dae06da5ec506824aa04ae0d 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -1830,16 +1830,27 @@ LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
} |
-LInstruction* LChunkBuilder::DoLoadPixelArrayElement( |
- HLoadPixelArrayElement* instr) { |
- ASSERT(instr->representation().IsInteger32()); |
+LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
+ HLoadKeyedSpecializedArrayElement* instr) { |
+ ExternalArrayType array_type = instr->array_type(); |
+ Representation representation(instr->representation()); |
+ ASSERT((representation.IsInteger32() && array_type != kExternalFloatArray) || |
+ (representation.IsDouble() && array_type == kExternalFloatArray)); |
ASSERT(instr->key()->representation().IsInteger32()); |
LOperand* external_pointer = |
UseRegisterAtStart(instr->external_pointer()); |
LOperand* key = UseRegisterAtStart(instr->key()); |
- LLoadPixelArrayElement* result = |
- new LLoadPixelArrayElement(external_pointer, key); |
- return DefineSameAsFirst(result); |
+ LLoadKeyedSpecializedArrayElement* result = |
+ new LLoadKeyedSpecializedArrayElement(external_pointer, |
+ key, |
+ array_type); |
+ LInstruction* load_instr = array_type != kExternalFloatArray ? |
+ DefineSameAsFirst(result) : |
+ DefineAsRegister(result); |
+ // An unsigned int array load might overflow and cause a deopt, make sure it |
+ // has an environment. |
+ return (array_type == kExternalUnsignedIntArray) ? |
Kevin Millikin (Chromium)
2011/03/24 11:21:00
Normally we format this like:
return (array_type
danno
2011/03/24 13:18:38
Done.
|
+ AssignEnvironment(load_instr) : load_instr; |
} |
@@ -1872,20 +1883,38 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement( |
} |
-LInstruction* LChunkBuilder::DoStorePixelArrayElement( |
- HStorePixelArrayElement* instr) { |
- ASSERT(instr->value()->representation().IsInteger32()); |
+LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
+ HStoreKeyedSpecializedArrayElement* instr) { |
+ Representation representation(instr->value()->representation()); |
+ ExternalArrayType array_type = instr->array_type(); |
+ ASSERT((representation.IsInteger32() && |
Kevin Millikin (Chromium)
2011/03/24 11:21:00
Does this fit on two lines like the one in DoLoadK
danno
2011/03/24 13:18:38
Done.
|
+ (array_type != kExternalFloatArray)) || |
+ (representation.IsDouble() && |
+ (array_type == kExternalFloatArray))); |
ASSERT(instr->external_pointer()->representation().IsExternal()); |
ASSERT(instr->key()->representation().IsInteger32()); |
LOperand* external_pointer = UseRegister(instr->external_pointer()); |
LOperand* val = UseRegister(instr->value()); |
LOperand* key = UseRegister(instr->key()); |
- // The generated code requires that the clamped value is in a byte |
- // register. eax is an arbitrary choice to satisfy this requirement. |
- LOperand* clamped = FixedTemp(eax); |
+ LOperand* temp = NULL; |
+ |
+ if (array_type == kExternalPixelArray) { |
+ // The generated code for pixel array stores requires that the clamped value |
+ // is in a byte register. eax is an arbitrary choice to satisfy this |
+ // requirement. |
+ temp = FixedTemp(eax); |
+ } else if (array_type == kExternalFloatArray) { |
+ // The floating point external array load needs an extra register for |
+ // converting from single precision to double. |
+ temp = FixedTemp(xmm1); |
Kevin Millikin (Chromium)
2011/03/24 11:21:00
At the moment, xmm0 is never allocated and can be
danno
2011/03/24 13:18:38
Done.
|
+ } |
- return new LStorePixelArrayElement(external_pointer, key, val, clamped); |
+ return new LStoreKeyedSpecializedArrayElement(external_pointer, |
+ key, |
+ val, |
+ temp, |
+ instr->array_type()); |
} |