Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index ac10793b46f56e7d088227233861c8e2aec06387..359b893b0aa81893d7a30e37c349260c47af09ca 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3097,9 +3097,19 @@ void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
DoubleRegister result = ToDoubleRegister(instr->result()); |
+ |
+ // Note that according to ECMA-262 15.8.2.13: |
+ // Math.pow(-Infinity, 0.5) == Infinity |
+ // Math.sqrt(-Infinity) == NaN |
+ Label done; |
+ __ VFPCompareAndSetFlags(input, -INFINITY); |
Sven Panne
2011/12/06 08:23:12
I think we should use V8_INFINITY here, although I
|
+ __ vneg(result, input, eq); |
+ __ b(&done, eq); |
+ |
// Add +0 to convert -0 to +0. |
__ vadd(result, input, kDoubleRegZero); |
__ vsqrt(result, result); |
+ __ bind(&done); |
} |