Index: src/crankshaft/x87/lithium-codegen-x87.cc |
diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc |
index fe39fbf8e57c88eb1415f8ec142578e1bd1681b5..4731581fdfd75fedb238aaf0a16361ee6b0703f9 100644 |
--- a/src/crankshaft/x87/lithium-codegen-x87.cc |
+++ b/src/crankshaft/x87/lithium-codegen-x87.cc |
@@ -3351,6 +3351,17 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
Register tmp = input_reg.is(eax) ? ecx : eax; |
Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; |
+ // Make sure that the context isn't overwritten in the AllocateHeapNumber |
+ // macro below. |
+ if (instr->context()->IsRegister()) { |
+ Register context_reg = ToRegister(instr->context()); |
+ if (tmp.is(context_reg)) { |
+ tmp = ebx; |
+ } else if (tmp2.is(context_reg)) { |
+ tmp2 = ebx; |
+ } |
+ } |
+ |
// Preserve the value of all registers. |
PushSafepointRegistersScope scope(this); |