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

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

Issue 2286273002: [interpreter] Make the comparison bytecode handlers collect type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix. 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
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 93bc847c44f0906488040e3485bece34e187acf9..bc7fc77c8bd3dd85f852df179e35a23c3d80eb09 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1217,6 +1217,24 @@ BinaryOperationHint BytecodeGraphBuilder::GetBinaryOperationHint(
return hint;
}
+// Helper function to create compare operation hint from the recorded type
+// feedback.
+CompareOperationHint BytecodeGraphBuilder::GetCompareOperationHint() {
+ int slot_index = bytecode_iterator().GetIndexOperand(1);
+ if (slot_index == 0) {
+ return CompareOperationHint::kAny;
+ }
+ FeedbackVectorSlot slot =
+ feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1));
+ DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot));
+ Object* feedback = feedback_vector()->Get(slot);
+ CompareOperationHint hint = CompareOperationHint::kAny;
+ if (feedback->IsSmi()) {
+ hint = CompareOperationHintFromFeedback((Smi::cast(feedback))->value());
+ }
+ return hint;
+}
+
void BytecodeGraphBuilder::VisitAdd() {
BuildBinaryOp(
javascript()->Add(GetBinaryOperationHint(kBinaryOperationHintIndex)));
@@ -1380,38 +1398,31 @@ void BytecodeGraphBuilder::BuildCompareOp(const Operator* js_op) {
}
void BytecodeGraphBuilder::VisitTestEqual() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->Equal(hint));
+ BuildCompareOp(javascript()->Equal(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestNotEqual() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->NotEqual(hint));
+ BuildCompareOp(javascript()->NotEqual(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestEqualStrict() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->StrictEqual(hint));
+ BuildCompareOp(javascript()->StrictEqual(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestLessThan() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->LessThan(hint));
+ BuildCompareOp(javascript()->LessThan(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestGreaterThan() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->GreaterThan(hint));
+ BuildCompareOp(javascript()->GreaterThan(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestLessThanOrEqual() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->LessThanOrEqual(hint));
+ BuildCompareOp(javascript()->LessThanOrEqual(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual() {
- CompareOperationHint hint = CompareOperationHint::kAny;
- BuildCompareOp(javascript()->GreaterThanOrEqual(hint));
+ BuildCompareOp(javascript()->GreaterThanOrEqual(GetCompareOperationHint()));
}
void BytecodeGraphBuilder::VisitTestIn() {

Powered by Google App Engine
This is Rietveld 408576698