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

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

Issue 2250513005: [interpreter] Record type feedback in the handlers for Inc and Dec. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added tests. 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/interpreter/interpreter.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 9aba0ac7fcf8710a717c9c815e5422138a78acfe..768811dfe8dbd76aae54d1113edd5ee8d2e42442 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1215,6 +1215,18 @@ BinaryOperationHint BytecodeGraphBuilder::GetBinaryOperationHint() {
return hint;
}
+BinaryOperationHint BytecodeGraphBuilder::GetBinaryOperationHintForIncDec() {
+ FeedbackVectorSlot slot =
+ feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(0));
+ DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot));
+ Object* feedback = feedback_vector()->Get(slot);
+ BinaryOperationHint hint = BinaryOperationHint::kAny;
+ if (feedback->IsSmi()) {
+ hint = BinaryOperationHintFromFeedback((Smi::cast(feedback))->value());
+ }
+ return hint;
+}
+
void BytecodeGraphBuilder::VisitAdd() {
BuildBinaryOp(javascript()->Add(GetBinaryOperationHint()));
}
@@ -1302,15 +1314,17 @@ void BytecodeGraphBuilder::VisitInc() {
FrameStateBeforeAndAfter states(this);
// Note: Use subtract -1 here instead of add 1 to ensure we always convert to
// a number, not a string.
- const Operator* js_op = javascript()->Subtract(BinaryOperationHint::kAny);
+ const Operator* js_op =
+ javascript()->Subtract(GetBinaryOperationHintForIncDec());
Node* node = NewNode(js_op, environment()->LookupAccumulator(),
- jsgraph()->Constant(-1.0));
+ jsgraph()->Constant(-1));
environment()->BindAccumulator(node, &states);
}
void BytecodeGraphBuilder::VisitDec() {
FrameStateBeforeAndAfter states(this);
- const Operator* js_op = javascript()->Subtract(BinaryOperationHint::kAny);
+ const Operator* js_op =
+ javascript()->Subtract(GetBinaryOperationHintForIncDec());
Node* node = NewNode(js_op, environment()->LookupAccumulator(),
jsgraph()->OneConstant());
environment()->BindAccumulator(node, &states);
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698