| Index: src/ia32/lithium-ia32.cc
|
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
|
| index 0383d72bebec18255aac52224d264b488802aef7..d23ccdc24eadad9cbd8be0a8c0f29c9e0667f08d 100644
|
| --- a/src/ia32/lithium-ia32.cc
|
| +++ b/src/ia32/lithium-ia32.cc
|
| @@ -1845,16 +1845,24 @@ 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;
|
| }
|
|
|
|
|
| @@ -1887,20 +1895,31 @@ 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 = 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);
|
| + }
|
|
|
| - return new LStorePixelArrayElement(external_pointer, key, val, clamped);
|
| + return new LStoreKeyedSpecializedArrayElement(external_pointer,
|
| + key,
|
| + val,
|
| + temp);
|
| }
|
|
|
|
|
|
|