From: yangguo@chromium.org Date: Tue, 6 Dec 2011 09:20:00 +0000 (+0000) Subject: Fixing fix for MathPowHalf on ARM. X-Git-Tag: upstream/4.7.83~17779 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe2049fcb84e91464a22f29762e38cb33156a093;p=platform%2Fupstream%2Fv8.git Fixing fix for MathPowHalf on ARM. Review URL: http://codereview.chromium.org/8817012 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10167 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 2341774..d816106 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1153,6 +1153,11 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { LOperand* input = UseFixedDouble(instr->value(), d2); LUnaryMathOperation* result = new LUnaryMathOperation(input, NULL); return MarkAsCall(DefineFixedDouble(result, d2), instr); + } if (op == kMathPowHalf) { + LOperand* input = UseFixedDouble(instr->value(), d2); + LOperand* temp = FixedTemp(d3); + LUnaryMathOperation* result = new LUnaryMathOperation(input, temp); + return DefineFixedDouble(result, d2); } else { LOperand* input = UseRegisterAtStart(instr->value()); LOperand* temp = (op == kMathFloor) ? TempRegister() : NULL; @@ -1166,8 +1171,6 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { return DefineAsRegister(result); case kMathRound: return AssignEnvironment(DefineAsRegister(result)); - case kMathPowHalf: - return DefineAsRegister(result); default: UNREACHABLE(); return NULL; diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 2d7d168..19dcc9f 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -3097,13 +3097,15 @@ void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); DoubleRegister result = ToDoubleRegister(instr->result()); + DoubleRegister temp = ToDoubleRegister(instr->TempAt(0)); // Note that according to ECMA-262 15.8.2.13: // Math.pow(-Infinity, 0.5) == Infinity // Math.sqrt(-Infinity) == NaN Label done; - __ VFPCompareAndSetFlags(input, -V8_INFINITY); - __ vneg(result, input, eq); + __ vmov(temp, -V8_INFINITY); + __ VFPCompareAndSetFlags(input, temp); + __ vneg(result, temp, eq); __ b(&done, eq); // Add +0 to convert -0 to +0. diff --git a/test/mjsunit/math-pow.js b/test/mjsunit/math-pow.js index 036d825..96d4eb4 100644 --- a/test/mjsunit/math-pow.js +++ b/test/mjsunit/math-pow.js @@ -135,7 +135,7 @@ function test() { assertEquals(+Infinity, Math.pow(-0, -0.6)); assertEquals(-Infinity, Math.pow(-0, -1)); assertEquals(-Infinity, Math.pow(-0, -10000000001)); - + assertEquals(4, Math.pow(16, 0.5)); assertEquals(NaN, Math.pow(-16, 0.5)); assertEquals(0.25, Math.pow(16, -0.5));