Index: src/compiler/typed-optimization.cc |
diff --git a/src/compiler/typed-optimization.cc b/src/compiler/typed-optimization.cc |
index 76ae9d48ec1b714066c539c5451eb89fe327e8ba..6c958bdac49b6fa5f8f27bf92ef5d23ce4a59b98 100644 |
--- a/src/compiler/typed-optimization.cc |
+++ b/src/compiler/typed-optimization.cc |
@@ -96,6 +96,8 @@ Reduction TypedOptimization::Reduce(Node* node) { |
return ReduceReferenceEqual(node); |
case IrOpcode::kSelect: |
return ReduceSelect(node); |
+ case IrOpcode::kSpeculativeToNumber: |
+ return ReduceSpeculativeToNumber(node); |
default: |
break; |
} |
@@ -311,6 +313,18 @@ Reduction TypedOptimization::ReduceSelect(Node* node) { |
return NoChange(); |
} |
+Reduction TypedOptimization::ReduceSpeculativeToNumber(Node* node) { |
+ DCHECK_EQ(IrOpcode::kSpeculativeToNumber, node->opcode()); |
+ Node* const input = NodeProperties::GetValueInput(node, 0); |
+ Type* const input_type = NodeProperties::GetType(input); |
+ if (input_type->Is(Type::Number())) { |
+ // SpeculativeToNumber(x:number) => x |
+ ReplaceWithValue(node, input); |
+ return Replace(input); |
+ } |
+ return NoChange(); |
+} |
+ |
Factory* TypedOptimization::factory() const { return isolate()->factory(); } |
Graph* TypedOptimization::graph() const { return jsgraph()->graph(); } |