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

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

Issue 2080703006: [turbofan] Some strength reduction on Smi/HeapObject checks. (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') | src/globals.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 dda29ef6a8c6e07da3769a0380f831065f43a16c..0b2e85a49db44334487bc5d46c86595bb70a87e1 100644
--- a/src/compiler/simplified-operator-reducer.cc
+++ b/src/compiler/simplified-operator-reducer.cc
@@ -16,8 +16,27 @@ namespace v8 {
namespace internal {
namespace compiler {
-SimplifiedOperatorReducer::SimplifiedOperatorReducer(JSGraph* jsgraph)
- : jsgraph_(jsgraph), type_cache_(TypeCache::Get()) {}
+namespace {
+
+Decision DecideObjectIsSmi(Node* const input) {
+ NumberMatcher m(input);
+ if (m.HasValue()) {
+ return IsSmiDouble(m.Value()) ? Decision::kTrue : Decision::kFalse;
+ }
+ if (m.IsAllocate()) return Decision::kFalse;
+ if (m.IsChangeBitToTagged()) return Decision::kFalse;
+ if (m.IsChangeInt31ToTaggedSigned()) return Decision::kTrue;
+ if (m.IsHeapConstant()) return Decision::kFalse;
+ return Decision::kUnknown;
+}
+
+} // namespace
+
+SimplifiedOperatorReducer::SimplifiedOperatorReducer(Editor* editor,
+ JSGraph* jsgraph)
+ : AdvancedReducer(editor),
+ jsgraph_(jsgraph),
+ type_cache_(TypeCache::Get()) {}
SimplifiedOperatorReducer::~SimplifiedOperatorReducer() {}
@@ -110,12 +129,32 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
}
break;
}
+ case IrOpcode::kCheckTaggedPointer: {
+ Node* const input = node->InputAt(0);
+ if (DecideObjectIsSmi(input) == Decision::kFalse) {
+ ReplaceWithValue(node, input);
+ return Replace(input);
+ }
+ break;
+ }
+ case IrOpcode::kCheckTaggedSigned: {
+ Node* const input = node->InputAt(0);
+ if (DecideObjectIsSmi(input) == Decision::kTrue) {
+ ReplaceWithValue(node, input);
+ return Replace(input);
+ }
+ 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);
+ Node* const input = node->InputAt(0);
+ switch (DecideObjectIsSmi(input)) {
+ case Decision::kTrue:
+ return ReplaceBoolean(true);
+ case Decision::kFalse:
+ return ReplaceBoolean(false);
+ case Decision::kUnknown:
+ break;
+ }
break;
}
case IrOpcode::kNumberCeil:
« no previous file with comments | « src/compiler/simplified-operator-reducer.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698