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

Unified Diff: src/compiler/simplified-operator-reducer.cc

Issue 2047213002: [turbofan] Do strength reduction for ObjectIsSmi based on inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/compiler/simplified-operator-reducer.h ('k') | test/unittests/compiler/graph-unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator-reducer.cc
diff --git a/src/compiler/simplified-operator-reducer.cc b/src/compiler/simplified-operator-reducer.cc
index f27741c2ca31d6bd4edb4134d2148eedc6ba7031..dda29ef6a8c6e07da3769a0380f831065f43a16c 100644
--- a/src/compiler/simplified-operator-reducer.cc
+++ b/src/compiler/simplified-operator-reducer.cc
@@ -110,6 +110,14 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
}
break;
}
+ case IrOpcode::kObjectIsSmi: {
+ NumberMatcher m(node->InputAt(0));
+ if (m.HasValue()) return ReplaceBoolean(IsSmiDouble(m.Value()));
+ if (m.IsChangeBitToTagged()) return ReplaceBoolean(false);
+ if (m.IsChangeInt31ToTaggedSigned()) return ReplaceBoolean(true);
+ if (m.IsHeapConstant()) return ReplaceBoolean(false);
+ break;
+ }
case IrOpcode::kNumberCeil:
case IrOpcode::kNumberFloor:
case IrOpcode::kNumberRound:
@@ -165,6 +173,9 @@ Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op,
return Changed(node);
}
+Reduction SimplifiedOperatorReducer::ReplaceBoolean(bool value) {
+ return Replace(jsgraph()->BooleanConstant(value));
+}
Reduction SimplifiedOperatorReducer::ReplaceFloat64(double value) {
return Replace(jsgraph()->Float64Constant(value));
« no previous file with comments | « src/compiler/simplified-operator-reducer.h ('k') | test/unittests/compiler/graph-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698