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

Unified Diff: src/mips64/code-stubs-mips64.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: MIPS: Fix infinite loop in Math.pow(2,-2147483648) 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
Index: src/mips64/code-stubs-mips64.cc
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
index 1d836ffa29077303a5dfb1ba244dc37d51f48fe2..9271ef98402e56b83530638664674c76e63c73a4 100644
--- a/src/mips64/code-stubs-mips64.cc
+++ b/src/mips64/code-stubs-mips64.cc
@@ -820,10 +820,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));
__ Dsubu(scratch, zero_reg, scratch);
+ // Check when Subu overflows and we get negative result
akos.palfi.imgtec 2016/07/21 11:23:27 Nit: s/Subu/Dsubu
ivica.bogosavljevic 2016/07/22 14:45:07 Acknowledged.
+ // (happens only when input is MIN_INT)
akos.palfi.imgtec 2016/07/21 11:23:27 Nit: please put period at the end of the sentence.
ivica.bogosavljevic 2016/07/22 14:45:07 Acknowledged.
+ __ BranchShort(&bail_out, gt, zero_reg, Operand(scratch));
akos.palfi.imgtec 2016/07/21 11:23:27 You should use Branch() instead of BranchShort().
ivica.bogosavljevic 2016/07/22 14:45:07 Acknowledged.
__ bind(&positive_exponent);
+ __ Assert(ge, kUnexpectedNegativeValue, scratch, Operand(zero_reg));
Label while_true, no_carry, loop_end;
__ bind(&while_true);
@@ -856,6 +860,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);

Powered by Google App Engine
This is Rietveld 408576698