Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: src/arm/code-stubs-arm.cc

Issue 2166743003: [arm] Fix infinite loop in Math.pow(2,2147483648). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5214.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index 2671d8fc6aa9806c900ad9ba2b9f7d7631f8fdee..88632d03a98889b825dbbf52f9a22795a7a6e061 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -697,10 +697,10 @@ void StoreBufferOverflowStub::Generate(MacroAssembler* masm) {
void MathPowStub::Generate(MacroAssembler* masm) {
const Register exponent = MathPowTaggedDescriptor::exponent();
DCHECK(exponent.is(r2));
- const DwVfpRegister double_base = d0;
- const DwVfpRegister double_exponent = d1;
- const DwVfpRegister double_result = d2;
- const DwVfpRegister double_scratch = d3;
+ const LowDwVfpRegister double_base = d0;
+ const LowDwVfpRegister double_exponent = d1;
+ const LowDwVfpRegister double_result = d2;
+ const LowDwVfpRegister double_scratch = d3;
const SwVfpRegister single_scratch = s6;
const Register scratch = r9;
const Register scratch2 = r4;
@@ -715,14 +715,9 @@ void MathPowStub::Generate(MacroAssembler* masm) {
}
if (exponent_type() != INTEGER) {
- Label int_exponent_convert;
// Detect integer exponents stored as double.
- __ vcvt_u32_f64(single_scratch, double_exponent);
- // We do not check for NaN or Infinity here because comparing numbers on
- // ARM correctly distinguishes NaNs. We end up calling the built-in.
- __ vcvt_f64_u32(double_scratch, single_scratch);
- __ VFPCompareAndSetFlags(double_scratch, double_exponent);
- __ b(eq, &int_exponent_convert);
+ __ TryDoubleToInt32Exact(scratch, double_exponent, double_scratch);
+ __ b(eq, &int_exponent);
__ push(lr);
{
@@ -734,11 +729,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
}
__ pop(lr);
__ MovFromFloatResult(double_result);
- __ jmp(&done);
-
- __ bind(&int_exponent_convert);
- __ vcvt_u32_f64(single_scratch, double_exponent);
- __ vmov(scratch, single_scratch);
+ __ b(&done);
}
// Calculate power with integer exponent.
@@ -756,12 +747,11 @@ void MathPowStub::Generate(MacroAssembler* masm) {
// Get absolute value of exponent.
__ cmp(scratch, Operand::Zero());
- __ mov(scratch2, Operand::Zero(), LeaveCC, mi);
- __ sub(scratch, scratch2, scratch, LeaveCC, mi);
+ __ rsb(scratch, scratch, Operand::Zero(), LeaveCC, mi);
Label while_true;
__ bind(&while_true);
- __ mov(scratch, Operand(scratch, ASR, 1), SetCC);
+ __ mov(scratch, Operand(scratch, LSR, 1), SetCC);
__ vmul(double_result, double_result, double_scratch, cs);
__ vmul(double_scratch, double_scratch, double_scratch, ne);
__ b(ne, &while_true);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5214.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698