| Index: src/ia32/lithium-ia32.cc | 
| diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc | 
| index f1dea595ad78fe880e4e126493421615080ffaaf..950321f2c66182208bd7014567c473ebdb94301b 100644 | 
| --- a/src/ia32/lithium-ia32.cc | 
| +++ b/src/ia32/lithium-ia32.cc | 
| @@ -1926,18 +1926,15 @@ LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 
| LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 
| ASSERT(instr->key()->representation().IsInteger32() || | 
| instr->key()->representation().IsTagged()); | 
| -  ElementsKind elements_kind = instr->elements_kind(); | 
| -  bool clobbers_key = ExternalArrayOpRequiresTemp( | 
| -      instr->key()->representation(), elements_kind); | 
| -  LOperand* key = clobbers_key | 
| +  ElementsKind elements_kind = instr->elements_kind(); | 
| +  LOperand* elements = UseRegisterAtStart(instr->elements()); | 
| +  LOperand* key = instr->is_external() && | 
| +    ExternalArrayOpRequiresTemp<HLoadKeyed>(instr) | 
| ? UseTempRegister(instr->key()) | 
| : UseRegisterOrConstantAtStart(instr->key()); | 
| -  LLoadKeyed* result = NULL; | 
|  | 
| -  if (!instr->is_external()) { | 
| -    LOperand* obj = UseRegisterAtStart(instr->elements()); | 
| -    result = new(zone()) LLoadKeyed(obj, key); | 
| -  } else { | 
| +#ifdef DEBUG | 
| +  if (instr->is_external()) { | 
| ASSERT( | 
| (instr->representation().IsInteger32() && | 
| (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 
| @@ -1945,10 +1942,10 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 
| (instr->representation().IsDouble() && | 
| ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 
| (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 
| -    LOperand* external_pointer = UseRegister(instr->elements()); | 
| -    result = new(zone()) LLoadKeyed(external_pointer, key); | 
| } | 
| +#endif | 
|  | 
| +  LLoadKeyed* result = new(zone()) LLoadKeyed(elements, key); | 
| DefineAsRegister(result); | 
| bool can_deoptimize = instr->RequiresHoleCheck() || | 
| (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 
| @@ -1970,34 +1967,27 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 
|  | 
|  | 
| LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 
| -  LStoreKeyed* result = NULL; | 
| +  ElementsKind elements_kind = instr->elements_kind(); | 
| +  LOperand* elements; | 
| +  LOperand* val; | 
| +  LOperand* key; | 
|  | 
| if (!instr->is_external()) { | 
| ASSERT(instr->elements()->representation().IsTagged()); | 
| ASSERT(instr->key()->representation().IsInteger32() || | 
| instr->key()->representation().IsTagged()); | 
|  | 
| -    if (instr->value()->representation().IsDouble()) { | 
| -      LOperand* object = UseRegisterAtStart(instr->elements()); | 
| -      LOperand* val = UseTempRegister(instr->value()); | 
| -      LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 
| - | 
| -      result = new(zone()) LStoreKeyed(object, key, val); | 
| +    if (instr->NeedsWriteBarrier() && | 
| +        !IsFastDoubleElementsKind(elements_kind)) { | 
| +      val = UseTempRegister(instr->value()); | 
| +      key = UseTempRegister(instr->key()); | 
| +      elements = UseRegister(instr->elements()); | 
| } else { | 
| -      ASSERT(instr->value()->representation().IsTagged()); | 
| -      bool needs_write_barrier = instr->NeedsWriteBarrier(); | 
| - | 
| -      LOperand* obj = UseRegister(instr->elements()); | 
| -      LOperand* val = needs_write_barrier | 
| -          ? UseTempRegister(instr->value()) | 
| -          : UseRegisterAtStart(instr->value()); | 
| -      LOperand* key = needs_write_barrier | 
| -          ? UseTempRegister(instr->key()) | 
| -          : UseRegisterOrConstantAtStart(instr->key()); | 
| -      result = new(zone()) LStoreKeyed(obj, key, val); | 
| +      val = UseRegisterAtStart(instr->value()); | 
| +      key = UseRegisterOrConstantAtStart(instr->key()); | 
| +      elements = UseRegisterAtStart(instr->elements()); | 
| } | 
| } else { | 
| -    ElementsKind elements_kind = instr->elements_kind(); | 
| ASSERT( | 
| (instr->value()->representation().IsInteger32() && | 
| (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 
| @@ -2007,26 +1997,25 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 
| (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 
| ASSERT(instr->elements()->representation().IsExternal()); | 
|  | 
| -    LOperand* external_pointer = UseRegister(instr->elements()); | 
| +    if (ExternalArrayOpRequiresTemp<HStoreKeyed>(instr)) { | 
| +      key = UseTempRegister(instr->key()); | 
| +      elements = UseRegister(instr->elements()); | 
| +    } else { | 
| +      key = UseRegisterOrConstantAtStart(instr->key()); | 
| +      elements = UseRegisterAtStart(instr->elements()); | 
| +    } | 
| + | 
| // Determine if we need a byte register in this case for the value. | 
| bool val_is_fixed_register = | 
| elements_kind == EXTERNAL_BYTE_ELEMENTS || | 
| elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS || | 
| elements_kind == EXTERNAL_PIXEL_ELEMENTS; | 
| - | 
| -    LOperand* val = val_is_fixed_register | 
| +    val = val_is_fixed_register | 
| ? UseFixed(instr->value(), eax) | 
| : UseRegister(instr->value()); | 
| -    bool clobbers_key = ExternalArrayOpRequiresTemp( | 
| -        instr->key()->representation(), elements_kind); | 
| -    LOperand* key = clobbers_key | 
| -        ? UseTempRegister(instr->key()) | 
| -        : UseRegisterOrConstantAtStart(instr->key()); | 
| -    result = new(zone()) LStoreKeyed(external_pointer, | 
| -                                     key, | 
| -                                     val); | 
| } | 
|  | 
| +  LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val); | 
| ASSERT(result != NULL); | 
| return result; | 
| } | 
|  |