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

Unified Diff: src/compiler/representation-change.h

Issue 839813002: [turbofan] Fix bit representation of NumberConstant. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/compiler/regress-bit-number-constant.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.h
diff --git a/src/compiler/representation-change.h b/src/compiler/representation-change.h
index e4c257f2ea4bbef34adae3fec268785d5a892c27..8720afdde3ff8938e46ed2f1ab19a647e591e3da 100644
--- a/src/compiler/representation-change.h
+++ b/src/compiler/representation-change.h
@@ -296,6 +296,13 @@ class RepresentationChanger {
if (value == 0 || value == 1) return node;
return jsgraph()->Int32Constant(1); // value != 0
}
+ case IrOpcode::kNumberConstant: {
+ double value = OpParameter<double>(node);
+ if (std::isnan(value) || value == 0.0) {
+ return jsgraph()->Int32Constant(0);
+ }
+ return jsgraph()->Int32Constant(1);
+ }
case IrOpcode::kHeapConstant: {
Handle<Object> handle = OpParameter<Unique<Object> >(node).handle();
DCHECK(*handle == isolate()->heap()->true_value() ||
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-bit-number-constant.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698