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

Unified Diff: src/crankshaft/hydrogen-instructions.cc

Issue 2472413002: [crankshaft] Fix constant folding of HDiv instruction. (Closed)
Patch Set: Created 4 years, 1 month 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-crbug-662367.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen-instructions.cc
diff --git a/src/crankshaft/hydrogen-instructions.cc b/src/crankshaft/hydrogen-instructions.cc
index 7273788bc734e8f4c54f91ed86da3bfa6836d244..465a18ae46e6145d08cb35d5156306cc3ab378d3 100644
--- a/src/crankshaft/hydrogen-instructions.cc
+++ b/src/crankshaft/hydrogen-instructions.cc
@@ -3578,10 +3578,12 @@ HInstruction* HDiv::New(Isolate* isolate, Zone* zone, HValue* context,
return H_CONSTANT_INT(double_res);
}
return H_CONSTANT_DOUBLE(double_res);
- } else {
+ } else if (c_left->DoubleValue() != 0) {
int sign = Double(c_left->DoubleValue()).Sign() *
Double(c_right->DoubleValue()).Sign(); // Right could be -0.
return H_CONSTANT_DOUBLE(sign * V8_INFINITY);
+ } else {
+ return H_CONSTANT_DOUBLE(std::numeric_limits<double>::quiet_NaN());
}
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-662367.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698