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: |