Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 09b7b6342838c14d2e0bbd98218b0004a0415c5d..a2d3258722b55e991ef4d8f87c30be8638d99aaa 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -1801,16 +1801,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) ? |
+ AssignEnvironment(load_instr) : load_instr; |
} |
@@ -1842,9 +1853,13 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement( |
} |
-LInstruction* LChunkBuilder::DoStorePixelArrayElement( |
- HStorePixelArrayElement* instr) { |
- ASSERT(instr->value()->representation().IsInteger32()); |
+LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
+ HStoreKeyedSpecializedArrayElement* instr) { |
+ Representation representation(instr->value()->representation()); |
+ ASSERT((representation.IsInteger32() && |
+ (instr->array_type() != kExternalFloatArray)) || |
+ (representation.IsDouble() && |
+ (instr->array_type() == kExternalFloatArray))); |
ASSERT(instr->external_pointer()->representation().IsExternal()); |
ASSERT(instr->key()->representation().IsInteger32()); |
@@ -1852,7 +1867,10 @@ LInstruction* LChunkBuilder::DoStorePixelArrayElement( |
LOperand* val = UseTempRegister(instr->value()); |
LOperand* key = UseRegister(instr->key()); |
- return new LStorePixelArrayElement(external_pointer, key, val); |
+ return new LStoreKeyedSpecializedArrayElement(external_pointer, |
+ key, |
+ val, |
+ instr->array_type()); |
} |