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

Unified Diff: src/hydrogen-instructions.cc

Issue 22623007: Fix smi-based math floor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Better field names Created 7 years, 4 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 | « src/hydrogen-instructions.h ('k') | test/mjsunit/regress/regress-smi-math-floor-round.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 997b7c2fda9b29455d03faac59c5a49a60d18d5c..5fc65ce8034ca6d7e764e41da2f447dced9aef61 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1285,6 +1285,15 @@ static HValue* SimplifiedDividendForMathFloorOfDiv(HValue* dividend) {
HValue* HUnaryMathOperation::Canonicalize() {
+ if (op() == kMathRound) {
+ HValue* val = value();
+ if (val->IsChange()) val = HChange::cast(val)->value();
+
+ // If the input is integer32 then we replace the round instruction
+ // with its input.
+ if (val->representation().IsSmiOrInteger32()) return val;
+ }
+
if (op() == kMathFloor) {
HValue* val = value();
if (val->IsChange()) val = HChange::cast(val)->value();
@@ -3313,7 +3322,11 @@ Representation HUnaryMathOperation::RepresentationFromInputs() {
// If any of the actual input representation is more general than what we
// have so far but not Tagged, use that representation instead.
Representation input_rep = value()->representation();
- if (!input_rep.IsTagged()) rep = rep.generalize(input_rep);
+ if (!input_rep.IsTagged()) {
+ rep = rep.generalize(input_rep);
+ } else if (flexible_int()) {
+ rep = Representation::Integer32();
+ }
return rep;
}
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/mjsunit/regress/regress-smi-math-floor-round.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698