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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 void BytecodeGraphBuilder::VisitShiftRight() { 1148 void BytecodeGraphBuilder::VisitShiftRight() {
1149 BinaryOperationHints hints = BinaryOperationHints::Any(); 1149 BinaryOperationHints hints = BinaryOperationHints::Any();
1150 BuildBinaryOp(javascript()->ShiftRight(hints)); 1150 BuildBinaryOp(javascript()->ShiftRight(hints));
1151 } 1151 }
1152 1152
1153 void BytecodeGraphBuilder::VisitShiftRightLogical() { 1153 void BytecodeGraphBuilder::VisitShiftRightLogical() {
1154 BinaryOperationHints hints = BinaryOperationHints::Any(); 1154 BinaryOperationHints hints = BinaryOperationHints::Any();
1155 BuildBinaryOp(javascript()->ShiftRightLogical(hints)); 1155 BuildBinaryOp(javascript()->ShiftRightLogical(hints));
1156 } 1156 }
1157 1157
1158 void BytecodeGraphBuilder::BuildBinaryOpWithImmediate(const Operator* js_op) {
1159 FrameStateBeforeAndAfter states(this);
1160 Node* left =
1161 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
1162 Node* right = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0));
1163 Node* node = NewNode(js_op, left, right);
1164 environment()->BindAccumulator(node, &states);
1165 }
1166
1167 void BytecodeGraphBuilder::VisitAddSmi() {
1168 BinaryOperationHints hints = BinaryOperationHints::Any();
1169 BuildBinaryOpWithImmediate(javascript()->Add(hints));
1170 }
1171
1172 void BytecodeGraphBuilder::VisitSubSmi() {
1173 BinaryOperationHints hints = BinaryOperationHints::Any();
1174 BuildBinaryOpWithImmediate(javascript()->Subtract(hints));
1175 }
1176
1177 void BytecodeGraphBuilder::VisitBitwiseOrSmi() {
1178 BinaryOperationHints hints = BinaryOperationHints::Any();
1179 BuildBinaryOpWithImmediate(javascript()->BitwiseOr(hints));
1180 }
1181
1182 void BytecodeGraphBuilder::VisitBitwiseAndSmi() {
1183 BinaryOperationHints hints = BinaryOperationHints::Any();
1184 BuildBinaryOpWithImmediate(javascript()->BitwiseAnd(hints));
1185 }
1186
1187 void BytecodeGraphBuilder::VisitShiftLeftSmi() {
1188 BinaryOperationHints hints = BinaryOperationHints::Any();
1189 BuildBinaryOpWithImmediate(javascript()->ShiftLeft(hints));
1190 }
1191
1192 void BytecodeGraphBuilder::VisitShiftRightSmi() {
1193 BinaryOperationHints hints = BinaryOperationHints::Any();
1194 BuildBinaryOpWithImmediate(javascript()->ShiftRight(hints));
1195 }
1196
1158 void BytecodeGraphBuilder::VisitInc() { 1197 void BytecodeGraphBuilder::VisitInc() {
1159 FrameStateBeforeAndAfter states(this); 1198 FrameStateBeforeAndAfter states(this);
1160 // Note: Use subtract -1 here instead of add 1 to ensure we always convert to 1199 // Note: Use subtract -1 here instead of add 1 to ensure we always convert to
1161 // a number, not a string. 1200 // a number, not a string.
1162 const Operator* js_op = javascript()->Subtract(BinaryOperationHints::Any()); 1201 const Operator* js_op = javascript()->Subtract(BinaryOperationHints::Any());
1163 Node* node = NewNode(js_op, environment()->LookupAccumulator(), 1202 Node* node = NewNode(js_op, environment()->LookupAccumulator(),
1164 jsgraph()->Constant(-1.0)); 1203 jsgraph()->Constant(-1.0));
1165 environment()->BindAccumulator(node, &states); 1204 environment()->BindAccumulator(node, &states);
1166 } 1205 }
1167 1206
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 // Phi does not exist yet, introduce one. 1783 // Phi does not exist yet, introduce one.
1745 value = NewPhi(inputs, value, control); 1784 value = NewPhi(inputs, value, control);
1746 value->ReplaceInput(inputs - 1, other); 1785 value->ReplaceInput(inputs - 1, other);
1747 } 1786 }
1748 return value; 1787 return value;
1749 } 1788 }
1750 1789
1751 } // namespace compiler 1790 } // namespace compiler
1752 } // namespace internal 1791 } // namespace internal
1753 } // namespace v8 1792 } // namespace v8
OLDNEW
« 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