Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 052115bd417badedb371a90ef22fbebd2fcee854..b49dfaf9429aaa9abfbcddfaebf1a92c00aa7cf6 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2938,9 +2938,28 @@ void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
XMMRegister xmm_scratch = xmm0; |
XMMRegister input_reg = ToDoubleRegister(instr->value()); |
ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); |
+ |
+ Label return_infinity, done; |
+ // Check base for +/- infinity. |
+ __ push(ecx); |
Erik Corry
2011/12/02 13:11:02
This is nasty. We have support for allocating tem
|
+ __ mov(ecx, factory()->infinity_value()); |
+ __ ucomisd(input_reg, FieldOperand(ecx, HeapNumber::kValueOffset)); |
+ __ j(equal, &return_infinity, Label::kNear); |
+ __ xorps(xmm_scratch, xmm_scratch); |
+ __ subsd(xmm_scratch, input_reg); |
+ __ ucomisd(xmm_scratch, FieldOperand(ecx, HeapNumber::kValueOffset)); |
+ __ j(equal, &return_infinity, Label::kNear); |
+ |
+ __ pop(ecx); |
__ xorps(xmm_scratch, xmm_scratch); |
__ addsd(input_reg, xmm_scratch); // Convert -0 to +0. |
__ sqrtsd(input_reg, input_reg); |
+ __ jmp(&done, Label::kNear); |
+ |
+ __ bind(&return_infinity); |
+ __ movdbl(input_reg, FieldOperand(ecx, HeapNumber::kValueOffset)); |
+ __ pop(ecx); |
+ __ bind(&done); |
} |