Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index a25d6782626fa294fa7e1f722a2d3378b574d5a3..75808952b980d4d1ae85c43be66e23f4fb7eee15 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2092,13 +2092,13 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { |
void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { |
- Register external_elements = ToRegister(instr->external_pointer()); |
+ Register external_pointer = ToRegister(instr->external_pointer()); |
Register key = ToRegister(instr->key()); |
Register result = ToRegister(instr->result()); |
- ASSERT(result.is(external_elements)); |
+ ASSERT(result.is(external_pointer)); |
// Load the result. |
- __ movzx_b(result, Operand(external_elements, key, times_1, 0)); |
+ __ movzx_b(result, Operand(external_pointer, key, times_1, 0)); |
} |
@@ -2718,6 +2718,25 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
} |
+void LCodeGen::DoStorePixelArrayElement(LStorePixelArrayElement* instr) { |
+ Register external_pointer = ToRegister(instr->external_pointer()); |
+ Register key = ToRegister(instr->key()); |
+ Register value = ToRegister(instr->value()); |
+ ASSERT(ToRegister(instr->TempAt(0)).is(eax)); |
+ |
+ __ mov(eax, value); |
+ { // Clamp the value to [0..255]. |
+ NearLabel done; |
+ __ test(eax, Immediate(0xFFFFFF00)); |
+ __ j(zero, &done); |
+ __ setcc(negative, eax); // 1 if negative, 0 if positive. |
+ __ dec_b(eax); // 0 if negative, 255 if positive. |
+ __ bind(&done); |
+ } |
+ __ mov_b(Operand(external_pointer, key, times_1, 0), eax); |
+} |
+ |
+ |
void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
Register value = ToRegister(instr->value()); |
Register elements = ToRegister(instr->object()); |