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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 FrameStateBeforeAndAfter states(this); | 1196 FrameStateBeforeAndAfter states(this); |
1197 Node* left = | 1197 Node* left = |
1198 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1198 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
1199 Node* right = environment()->LookupAccumulator(); | 1199 Node* right = environment()->LookupAccumulator(); |
1200 Node* node = NewNode(js_op, left, right); | 1200 Node* node = NewNode(js_op, left, right); |
1201 environment()->BindAccumulator(node, &states); | 1201 environment()->BindAccumulator(node, &states); |
1202 } | 1202 } |
1203 | 1203 |
1204 void BytecodeGraphBuilder::VisitAdd() { | 1204 void BytecodeGraphBuilder::VisitAdd() { |
1205 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1205 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1206 BuildBinaryOp(javascript()->Add(language_mode(), hints)); | 1206 BuildBinaryOp(javascript()->Add(hints)); |
1207 } | 1207 } |
1208 | 1208 |
1209 void BytecodeGraphBuilder::VisitSub() { | 1209 void BytecodeGraphBuilder::VisitSub() { |
1210 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1210 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1211 BuildBinaryOp(javascript()->Subtract(language_mode(), hints)); | 1211 BuildBinaryOp(javascript()->Subtract(hints)); |
1212 } | 1212 } |
1213 | 1213 |
1214 void BytecodeGraphBuilder::VisitMul() { | 1214 void BytecodeGraphBuilder::VisitMul() { |
1215 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1215 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1216 BuildBinaryOp(javascript()->Multiply(language_mode(), hints)); | 1216 BuildBinaryOp(javascript()->Multiply(hints)); |
1217 } | 1217 } |
1218 | 1218 |
1219 void BytecodeGraphBuilder::VisitDiv() { | 1219 void BytecodeGraphBuilder::VisitDiv() { |
1220 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1220 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1221 BuildBinaryOp(javascript()->Divide(language_mode(), hints)); | 1221 BuildBinaryOp(javascript()->Divide(hints)); |
1222 } | 1222 } |
1223 | 1223 |
1224 void BytecodeGraphBuilder::VisitMod() { | 1224 void BytecodeGraphBuilder::VisitMod() { |
1225 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1225 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1226 BuildBinaryOp(javascript()->Modulus(language_mode(), hints)); | 1226 BuildBinaryOp(javascript()->Modulus(hints)); |
1227 } | 1227 } |
1228 | 1228 |
1229 void BytecodeGraphBuilder::VisitBitwiseOr() { | 1229 void BytecodeGraphBuilder::VisitBitwiseOr() { |
1230 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1230 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1231 BuildBinaryOp(javascript()->BitwiseOr(language_mode(), hints)); | 1231 BuildBinaryOp(javascript()->BitwiseOr(hints)); |
1232 } | 1232 } |
1233 | 1233 |
1234 void BytecodeGraphBuilder::VisitBitwiseXor() { | 1234 void BytecodeGraphBuilder::VisitBitwiseXor() { |
1235 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1235 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1236 BuildBinaryOp(javascript()->BitwiseXor(language_mode(), hints)); | 1236 BuildBinaryOp(javascript()->BitwiseXor(hints)); |
1237 } | 1237 } |
1238 | 1238 |
1239 void BytecodeGraphBuilder::VisitBitwiseAnd() { | 1239 void BytecodeGraphBuilder::VisitBitwiseAnd() { |
1240 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1240 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1241 BuildBinaryOp(javascript()->BitwiseAnd(language_mode(), hints)); | 1241 BuildBinaryOp(javascript()->BitwiseAnd(hints)); |
1242 } | 1242 } |
1243 | 1243 |
1244 void BytecodeGraphBuilder::VisitShiftLeft() { | 1244 void BytecodeGraphBuilder::VisitShiftLeft() { |
1245 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1245 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1246 BuildBinaryOp(javascript()->ShiftLeft(language_mode(), hints)); | 1246 BuildBinaryOp(javascript()->ShiftLeft(hints)); |
1247 } | 1247 } |
1248 | 1248 |
1249 void BytecodeGraphBuilder::VisitShiftRight() { | 1249 void BytecodeGraphBuilder::VisitShiftRight() { |
1250 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1250 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1251 BuildBinaryOp(javascript()->ShiftRight(language_mode(), hints)); | 1251 BuildBinaryOp(javascript()->ShiftRight(hints)); |
1252 } | 1252 } |
1253 | 1253 |
1254 void BytecodeGraphBuilder::VisitShiftRightLogical() { | 1254 void BytecodeGraphBuilder::VisitShiftRightLogical() { |
1255 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1255 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1256 BuildBinaryOp(javascript()->ShiftRightLogical(language_mode(), hints)); | 1256 BuildBinaryOp(javascript()->ShiftRightLogical(hints)); |
1257 } | 1257 } |
1258 | 1258 |
1259 void BytecodeGraphBuilder::VisitInc() { | 1259 void BytecodeGraphBuilder::VisitInc() { |
1260 FrameStateBeforeAndAfter states(this); | 1260 FrameStateBeforeAndAfter states(this); |
1261 const Operator* js_op = | 1261 const Operator* js_op = javascript()->Add(BinaryOperationHints::Any()); |
1262 javascript()->Add(language_mode(), BinaryOperationHints::Any()); | |
1263 Node* node = NewNode(js_op, environment()->LookupAccumulator(), | 1262 Node* node = NewNode(js_op, environment()->LookupAccumulator(), |
1264 jsgraph()->OneConstant()); | 1263 jsgraph()->OneConstant()); |
1265 environment()->BindAccumulator(node, &states); | 1264 environment()->BindAccumulator(node, &states); |
1266 } | 1265 } |
1267 | 1266 |
1268 void BytecodeGraphBuilder::VisitDec() { | 1267 void BytecodeGraphBuilder::VisitDec() { |
1269 FrameStateBeforeAndAfter states(this); | 1268 FrameStateBeforeAndAfter states(this); |
1270 const Operator* js_op = | 1269 const Operator* js_op = javascript()->Subtract(BinaryOperationHints::Any()); |
1271 javascript()->Subtract(language_mode(), BinaryOperationHints::Any()); | |
1272 Node* node = NewNode(js_op, environment()->LookupAccumulator(), | 1270 Node* node = NewNode(js_op, environment()->LookupAccumulator(), |
1273 jsgraph()->OneConstant()); | 1271 jsgraph()->OneConstant()); |
1274 environment()->BindAccumulator(node, &states); | 1272 environment()->BindAccumulator(node, &states); |
1275 } | 1273 } |
1276 | 1274 |
1277 void BytecodeGraphBuilder::VisitLogicalNot() { | 1275 void BytecodeGraphBuilder::VisitLogicalNot() { |
1278 Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), | 1276 Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), |
1279 environment()->LookupAccumulator()); | 1277 environment()->LookupAccumulator()); |
1280 Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, | 1278 Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, |
1281 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); | 1279 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 | 1323 |
1326 void BytecodeGraphBuilder::VisitTestEqualStrict() { | 1324 void BytecodeGraphBuilder::VisitTestEqualStrict() { |
1327 BuildCompareOp(javascript()->StrictEqual()); | 1325 BuildCompareOp(javascript()->StrictEqual()); |
1328 } | 1326 } |
1329 | 1327 |
1330 void BytecodeGraphBuilder::VisitTestNotEqualStrict() { | 1328 void BytecodeGraphBuilder::VisitTestNotEqualStrict() { |
1331 BuildCompareOp(javascript()->StrictNotEqual()); | 1329 BuildCompareOp(javascript()->StrictNotEqual()); |
1332 } | 1330 } |
1333 | 1331 |
1334 void BytecodeGraphBuilder::VisitTestLessThan() { | 1332 void BytecodeGraphBuilder::VisitTestLessThan() { |
1335 BuildCompareOp(javascript()->LessThan(language_mode())); | 1333 BuildCompareOp(javascript()->LessThan()); |
1336 } | 1334 } |
1337 | 1335 |
1338 void BytecodeGraphBuilder::VisitTestGreaterThan() { | 1336 void BytecodeGraphBuilder::VisitTestGreaterThan() { |
1339 BuildCompareOp(javascript()->GreaterThan(language_mode())); | 1337 BuildCompareOp(javascript()->GreaterThan()); |
1340 } | 1338 } |
1341 | 1339 |
1342 void BytecodeGraphBuilder::VisitTestLessThanOrEqual() { | 1340 void BytecodeGraphBuilder::VisitTestLessThanOrEqual() { |
1343 BuildCompareOp(javascript()->LessThanOrEqual(language_mode())); | 1341 BuildCompareOp(javascript()->LessThanOrEqual()); |
1344 } | 1342 } |
1345 | 1343 |
1346 void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual() { | 1344 void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual() { |
1347 BuildCompareOp(javascript()->GreaterThanOrEqual(language_mode())); | 1345 BuildCompareOp(javascript()->GreaterThanOrEqual()); |
1348 } | 1346 } |
1349 | 1347 |
1350 void BytecodeGraphBuilder::VisitTestIn() { | 1348 void BytecodeGraphBuilder::VisitTestIn() { |
1351 BuildCompareOp(javascript()->HasProperty()); | 1349 BuildCompareOp(javascript()->HasProperty()); |
1352 } | 1350 } |
1353 | 1351 |
1354 void BytecodeGraphBuilder::VisitTestInstanceOf() { | 1352 void BytecodeGraphBuilder::VisitTestInstanceOf() { |
1355 BuildCompareOp(javascript()->InstanceOf()); | 1353 BuildCompareOp(javascript()->InstanceOf()); |
1356 } | 1354 } |
1357 | 1355 |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 // Phi does not exist yet, introduce one. | 1794 // Phi does not exist yet, introduce one. |
1797 value = NewPhi(inputs, value, control); | 1795 value = NewPhi(inputs, value, control); |
1798 value->ReplaceInput(inputs - 1, other); | 1796 value->ReplaceInput(inputs - 1, other); |
1799 } | 1797 } |
1800 return value; | 1798 return value; |
1801 } | 1799 } |
1802 | 1800 |
1803 } // namespace compiler | 1801 } // namespace compiler |
1804 } // namespace internal | 1802 } // namespace internal |
1805 } // namespace v8 | 1803 } // namespace v8 |
OLD | NEW |