| OLD | NEW |
| 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot)); | 1179 DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot)); |
| 1180 Object* feedback = feedback_vector()->Get(slot); | 1180 Object* feedback = feedback_vector()->Get(slot); |
| 1181 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1181 BinaryOperationHint hint = BinaryOperationHint::kAny; |
| 1182 if (feedback->IsSmi()) { | 1182 if (feedback->IsSmi()) { |
| 1183 hint = BinaryOperationHintFromFeedback((Smi::cast(feedback))->value()); | 1183 hint = BinaryOperationHintFromFeedback((Smi::cast(feedback))->value()); |
| 1184 } | 1184 } |
| 1185 return hint; | 1185 return hint; |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 void BytecodeGraphBuilder::VisitAdd() { | 1188 void BytecodeGraphBuilder::VisitAdd() { |
| 1189 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1189 BuildBinaryOp(javascript()->Add(GetBinaryOperationHint())); |
| 1190 BuildBinaryOp(javascript()->Add(hint)); | |
| 1191 } | 1190 } |
| 1192 | 1191 |
| 1193 void BytecodeGraphBuilder::VisitSub() { | 1192 void BytecodeGraphBuilder::VisitSub() { |
| 1194 BuildBinaryOp(javascript()->Subtract(GetBinaryOperationHint())); | 1193 BuildBinaryOp(javascript()->Subtract(GetBinaryOperationHint())); |
| 1195 } | 1194 } |
| 1196 | 1195 |
| 1197 void BytecodeGraphBuilder::VisitMul() { | 1196 void BytecodeGraphBuilder::VisitMul() { |
| 1198 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1197 BuildBinaryOp(javascript()->Multiply(GetBinaryOperationHint())); |
| 1199 BuildBinaryOp(javascript()->Multiply(hint)); | |
| 1200 } | 1198 } |
| 1201 | 1199 |
| 1202 void BytecodeGraphBuilder::VisitDiv() { | 1200 void BytecodeGraphBuilder::VisitDiv() { |
| 1203 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1201 BuildBinaryOp(javascript()->Divide(GetBinaryOperationHint())); |
| 1204 BuildBinaryOp(javascript()->Divide(hint)); | |
| 1205 } | 1202 } |
| 1206 | 1203 |
| 1207 void BytecodeGraphBuilder::VisitMod() { | 1204 void BytecodeGraphBuilder::VisitMod() { |
| 1208 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1205 BuildBinaryOp(javascript()->Modulus(GetBinaryOperationHint())); |
| 1209 BuildBinaryOp(javascript()->Modulus(hint)); | |
| 1210 } | 1206 } |
| 1211 | 1207 |
| 1212 void BytecodeGraphBuilder::VisitBitwiseOr() { | 1208 void BytecodeGraphBuilder::VisitBitwiseOr() { |
| 1213 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1209 BuildBinaryOp(javascript()->BitwiseOr(GetBinaryOperationHint())); |
| 1214 BuildBinaryOp(javascript()->BitwiseOr(hint)); | |
| 1215 } | 1210 } |
| 1216 | 1211 |
| 1217 void BytecodeGraphBuilder::VisitBitwiseXor() { | 1212 void BytecodeGraphBuilder::VisitBitwiseXor() { |
| 1218 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1213 BuildBinaryOp(javascript()->BitwiseXor(GetBinaryOperationHint())); |
| 1219 BuildBinaryOp(javascript()->BitwiseXor(hint)); | |
| 1220 } | 1214 } |
| 1221 | 1215 |
| 1222 void BytecodeGraphBuilder::VisitBitwiseAnd() { | 1216 void BytecodeGraphBuilder::VisitBitwiseAnd() { |
| 1223 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1217 BuildBinaryOp(javascript()->BitwiseAnd(GetBinaryOperationHint())); |
| 1224 BuildBinaryOp(javascript()->BitwiseAnd(hint)); | |
| 1225 } | 1218 } |
| 1226 | 1219 |
| 1227 void BytecodeGraphBuilder::VisitShiftLeft() { | 1220 void BytecodeGraphBuilder::VisitShiftLeft() { |
| 1228 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1221 BuildBinaryOp(javascript()->ShiftLeft(GetBinaryOperationHint())); |
| 1229 BuildBinaryOp(javascript()->ShiftLeft(hint)); | |
| 1230 } | 1222 } |
| 1231 | 1223 |
| 1232 void BytecodeGraphBuilder::VisitShiftRight() { | 1224 void BytecodeGraphBuilder::VisitShiftRight() { |
| 1233 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1225 BuildBinaryOp(javascript()->ShiftRight(GetBinaryOperationHint())); |
| 1234 BuildBinaryOp(javascript()->ShiftRight(hint)); | |
| 1235 } | 1226 } |
| 1236 | 1227 |
| 1237 void BytecodeGraphBuilder::VisitShiftRightLogical() { | 1228 void BytecodeGraphBuilder::VisitShiftRightLogical() { |
| 1238 BinaryOperationHint hint = BinaryOperationHint::kAny; | 1229 BuildBinaryOp(javascript()->ShiftRightLogical(GetBinaryOperationHint())); |
| 1239 BuildBinaryOp(javascript()->ShiftRightLogical(hint)); | |
| 1240 } | 1230 } |
| 1241 | 1231 |
| 1242 void BytecodeGraphBuilder::BuildBinaryOpWithImmediate(const Operator* js_op) { | 1232 void BytecodeGraphBuilder::BuildBinaryOpWithImmediate(const Operator* js_op) { |
| 1243 FrameStateBeforeAndAfter states(this); | 1233 FrameStateBeforeAndAfter states(this); |
| 1244 Node* left = | 1234 Node* left = |
| 1245 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 1235 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); |
| 1246 Node* right = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0)); | 1236 Node* right = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0)); |
| 1247 Node* node = NewNode(js_op, left, right); | 1237 Node* node = NewNode(js_op, left, right); |
| 1248 environment()->BindAccumulator(node, &states); | 1238 environment()->BindAccumulator(node, &states); |
| 1249 } | 1239 } |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 // Phi does not exist yet, introduce one. | 1886 // Phi does not exist yet, introduce one. |
| 1897 value = NewPhi(inputs, value, control); | 1887 value = NewPhi(inputs, value, control); |
| 1898 value->ReplaceInput(inputs - 1, other); | 1888 value->ReplaceInput(inputs - 1, other); |
| 1899 } | 1889 } |
| 1900 return value; | 1890 return value; |
| 1901 } | 1891 } |
| 1902 | 1892 |
| 1903 } // namespace compiler | 1893 } // namespace compiler |
| 1904 } // namespace internal | 1894 } // namespace internal |
| 1905 } // namespace v8 | 1895 } // namespace v8 |
| OLD | NEW |