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

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

Issue 2163963003: MIPS: Fix infinite loop in Math.pow(2,-2147483648) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nits 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 | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 47a0a8ea7930394875b406521881cda289432e48..f134cc09f7dab8e7125eb7d463f883c618d042c7 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -823,10 +823,14 @@ void MathPowStub::Generate(MacroAssembler* masm) {
__ Move(double_result, 1.0);
// Get absolute value of exponent.
- Label positive_exponent;
+ Label positive_exponent, bail_out;
__ Branch(&positive_exponent, ge, scratch, Operand(zero_reg));
__ Subu(scratch, zero_reg, scratch);
+ // Check when Subu overflows and we get negative result
+ // (happens only when input is MIN_INT).
+ __ Branch(&bail_out, gt, zero_reg, Operand(scratch));
__ bind(&positive_exponent);
+ __ Assert(ge, kUnexpectedNegativeValue, scratch, Operand(zero_reg));
Label while_true, no_carry, loop_end;
__ bind(&while_true);
@@ -859,6 +863,7 @@ void MathPowStub::Generate(MacroAssembler* masm) {
__ cvt_d_w(double_exponent, single_scratch);
// Returning or bailing out.
+ __ bind(&bail_out);
__ push(ra);
{
AllowExternalCallThatCantCauseGC scope(masm);
« no previous file with comments | « no previous file | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698