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

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

Issue 2111923002: [interpreter] Introduce binary op bytecodes for Smi operand. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 5 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/bytecode-peephole-optimizer.cc » ('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 79d8ff2bc56ba6111dde192945b3880379f9851c..a347929131f28e7b5be849d7aeabb6529d43d354 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1155,6 +1155,45 @@ void BytecodeGraphBuilder::VisitShiftRightLogical() {
BuildBinaryOp(javascript()->ShiftRightLogical(hints));
}
+void BytecodeGraphBuilder::BuildBinaryOpWithImmediate(const Operator* js_op) {
+ FrameStateBeforeAndAfter states(this);
+ Node* left =
+ environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
+ Node* right = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0));
+ Node* node = NewNode(js_op, left, right);
+ environment()->BindAccumulator(node, &states);
+}
+
+void BytecodeGraphBuilder::VisitAddSmi() {
+ BinaryOperationHints hints = BinaryOperationHints::Any();
+ BuildBinaryOpWithImmediate(javascript()->Add(hints));
+}
+
+void BytecodeGraphBuilder::VisitSubSmi() {
+ BinaryOperationHints hints = BinaryOperationHints::Any();
+ BuildBinaryOpWithImmediate(javascript()->Subtract(hints));
+}
+
+void BytecodeGraphBuilder::VisitBitwiseOrSmi() {
+ BinaryOperationHints hints = BinaryOperationHints::Any();
+ BuildBinaryOpWithImmediate(javascript()->BitwiseOr(hints));
+}
+
+void BytecodeGraphBuilder::VisitBitwiseAndSmi() {
+ BinaryOperationHints hints = BinaryOperationHints::Any();
+ BuildBinaryOpWithImmediate(javascript()->BitwiseAnd(hints));
+}
+
+void BytecodeGraphBuilder::VisitShiftLeftSmi() {
+ BinaryOperationHints hints = BinaryOperationHints::Any();
+ BuildBinaryOpWithImmediate(javascript()->ShiftLeft(hints));
+}
+
+void BytecodeGraphBuilder::VisitShiftRightSmi() {
+ BinaryOperationHints hints = BinaryOperationHints::Any();
+ BuildBinaryOpWithImmediate(javascript()->ShiftRight(hints));
+}
+
void BytecodeGraphBuilder::VisitInc() {
FrameStateBeforeAndAfter states(this);
// Note: Use subtract -1 here instead of add 1 to ensure we always convert to
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-peephole-optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698