| Index: src/x64/lithium-x64.cc
|
| diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
|
| index 9e72731e9429cfa47091464f5d1138305602e354..c47cd726f5ebad1d62c0c9eb6ef9b056f961fc70 100644
|
| --- a/src/x64/lithium-x64.cc
|
| +++ b/src/x64/lithium-x64.cc
|
| @@ -1816,16 +1816,22 @@ 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);
|
| + LOperand* external_pointer = UseRegister(instr->external_pointer());
|
| + LOperand* key = UseRegister(instr->key());
|
| + LLoadKeyedSpecializedArrayElement* result =
|
| + new LLoadKeyedSpecializedArrayElement(external_pointer, key);
|
| + LInstruction* load_instr = 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;
|
| }
|
|
|
|
|
| @@ -1857,17 +1863,26 @@ 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() && 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 = UseTempRegister(instr->value());
|
| + bool val_is_temp_register = array_type == kExternalPixelArray ||
|
| + array_type == kExternalFloatArray;
|
| + LOperand* val = val_is_temp_register
|
| + ? UseTempRegister(instr->value())
|
| + : UseRegister(instr->key());
|
| LOperand* key = UseRegister(instr->key());
|
|
|
| - return new LStorePixelArrayElement(external_pointer, key, val);
|
| + return new LStoreKeyedSpecializedArrayElement(external_pointer,
|
| + key,
|
| + val);
|
| }
|
|
|
|
|
|
|