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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 2804813003: [turbofan] Collect and use type feedback on ToNumber. (Closed)
Patch Set: Address Michis feedback. 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 | « no previous file | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 9e8e2b53dbdd22447f3997554248d62e7b9ee079..d2267f7fa2605dfa5609e7fdf3fae3330930e6ae 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -2028,7 +2028,21 @@ void BytecodeGraphBuilder::VisitToObject() {
}
void BytecodeGraphBuilder::VisitToNumber() {
- BuildCastOperator(javascript()->ToNumber());
+ PrepareEagerCheckpoint();
+ Node* object = environment()->LookupAccumulator();
+
+ Node* node = nullptr;
+ FeedbackSlot slot =
+ feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1));
+ if (Node* simplified = TryBuildSimplifiedBinaryOp(
+ javascript()->Multiply(), object, jsgraph()->OneConstant(), slot)) {
+ node = simplified;
+ } else {
+ node = NewNode(javascript()->ToNumber(), object);
+ }
+
+ environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), node,
+ Environment::kAttachFrameState);
}
void BytecodeGraphBuilder::VisitJump() { BuildJump(); }
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698