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

Unified Diff: src/compiler/typed-optimization.cc

Issue 2802113003: [turbofan] Introduce a SpeculativeToNumber operator. (Closed)
Patch Set: Paint it green! Created 3 years, 8 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/typed-optimization.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(); }
« no previous file with comments | « src/compiler/typed-optimization.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698