Index: src/compiler/simplified-operator-reducer.cc |
diff --git a/src/compiler/simplified-operator-reducer.cc b/src/compiler/simplified-operator-reducer.cc |
index 120d7926d541bbc5feab7f5627d5aa8c1dbc7540..48aca9729e0393b1a9ba8db7a07c52b75581a841 100644 |
--- a/src/compiler/simplified-operator-reducer.cc |
+++ b/src/compiler/simplified-operator-reducer.cc |
@@ -9,14 +9,14 @@ |
#include "src/compiler/node-matchers.h" |
#include "src/compiler/operator-properties.h" |
#include "src/conversions-inl.h" |
+#include "src/type-cache.h" |
namespace v8 { |
namespace internal { |
namespace compiler { |
SimplifiedOperatorReducer::SimplifiedOperatorReducer(JSGraph* jsgraph) |
- : jsgraph_(jsgraph) {} |
- |
+ : jsgraph_(jsgraph), type_cache_(TypeCache::Get()) {} |
SimplifiedOperatorReducer::~SimplifiedOperatorReducer() {} |
@@ -89,6 +89,8 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) { |
if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value())); |
break; |
} |
+ case IrOpcode::kNumberFloor: |
+ return ReduceNumberFloor(node); |
case IrOpcode::kReferenceEqual: |
return ReduceReferenceEqual(node); |
default: |
@@ -97,6 +99,15 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) { |
return NoChange(); |
} |
+Reduction SimplifiedOperatorReducer::ReduceNumberFloor(Node* node) { |
+ DCHECK_EQ(IrOpcode::kNumberFloor, node->opcode()); |
+ Node* const input = NodeProperties::GetValueInput(node, 0); |
+ Type* const input_type = NodeProperties::GetType(input); |
+ if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) { |
+ return Replace(input); |
+ } |
+ return NoChange(); |
+} |
Reduction SimplifiedOperatorReducer::ReduceReferenceEqual(Node* node) { |
DCHECK_EQ(IrOpcode::kReferenceEqual, node->opcode()); |