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

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

Issue 2221833002: [Interpreter] Collect type feedback for subtract operation and pass it to turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments from Ross. Created 4 years, 4 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/bytecode-graph-builder.h ('k') | src/compiler/type-hint-analyzer.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 621ca104d880ab2ecdb43bddb3f194e5815c2d5e..d310315c642bd78417b860adfa9e3f177e0234f9 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1135,14 +1135,27 @@ void BytecodeGraphBuilder::BuildBinaryOp(const Operator* js_op) {
environment()->BindAccumulator(node, &states);
}
+// Helper function to create binary operation hint from the recorded type
+// feedback.
+BinaryOperationHints BytecodeGraphBuilder::GetBinaryOperationHint() {
+ FeedbackVectorSlot slot =
+ feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1));
+ DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot));
+ Object* feedback = feedback_vector()->Get(slot);
+ BinaryOperationHints::Hint hint = BinaryOperationHints::Hint::kAny;
+ if (feedback->IsSmi()) {
+ hint = BinaryOperationHintFromFeedback((Smi::cast(feedback))->value());
+ }
+ return BinaryOperationHints(hint, hint, hint);
+}
+
void BytecodeGraphBuilder::VisitAdd() {
BinaryOperationHints hints = BinaryOperationHints::Any();
BuildBinaryOp(javascript()->Add(hints));
}
void BytecodeGraphBuilder::VisitSub() {
- BinaryOperationHints hints = BinaryOperationHints::Any();
- BuildBinaryOp(javascript()->Subtract(hints));
+ BuildBinaryOp(javascript()->Subtract(GetBinaryOperationHint()));
}
void BytecodeGraphBuilder::VisitMul() {
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/type-hint-analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698