Chromium Code Reviews| 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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1006 UpdateControlDependencyToLeaveFunction(control); | 1006 UpdateControlDependencyToLeaveFunction(control); |
| 1007 environment()->BindAccumulator(value); | 1007 environment()->BindAccumulator(value); |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 | 1010 |
| 1011 void BytecodeGraphBuilder::BuildBinaryOp( | 1011 void BytecodeGraphBuilder::BuildBinaryOp( |
| 1012 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { | 1012 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { |
| 1013 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1013 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 1014 Node* right = environment()->LookupAccumulator(); | 1014 Node* right = environment()->LookupAccumulator(); |
| 1015 Node* node = NewNode(js_op, left, right); | 1015 Node* node = NewNode(js_op, left, right); |
| 1016 | |
| 1017 AddEmptyFrameStateInputs(node); | 1016 AddEmptyFrameStateInputs(node); |
| 1018 environment()->BindAccumulator(node); | 1017 environment()->BindAccumulator(node); |
| 1019 } | 1018 } |
| 1020 | 1019 |
| 1021 | 1020 |
| 1022 void BytecodeGraphBuilder::VisitAdd( | 1021 void BytecodeGraphBuilder::VisitAdd( |
| 1023 const interpreter::BytecodeArrayIterator& iterator) { | 1022 const interpreter::BytecodeArrayIterator& iterator) { |
| 1024 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1023 BinaryOperationHints hints = BinaryOperationHints::Any(); |
| 1025 BuildBinaryOp(javascript()->Add(language_mode(), hints), iterator); | 1024 BuildBinaryOp(javascript()->Add(language_mode(), hints), iterator); |
| 1026 } | 1025 } |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1362 const interpreter::BytecodeArrayIterator& iterator) { | 1361 const interpreter::BytecodeArrayIterator& iterator) { |
| 1363 Node* control = | 1362 Node* control = |
| 1364 NewNode(common()->Return(), environment()->LookupAccumulator()); | 1363 NewNode(common()->Return(), environment()->LookupAccumulator()); |
| 1365 UpdateControlDependencyToLeaveFunction(control); | 1364 UpdateControlDependencyToLeaveFunction(control); |
| 1366 set_environment(nullptr); | 1365 set_environment(nullptr); |
| 1367 } | 1366 } |
| 1368 | 1367 |
| 1369 | 1368 |
| 1370 void BytecodeGraphBuilder::VisitForInPrepare( | 1369 void BytecodeGraphBuilder::VisitForInPrepare( |
| 1371 const interpreter::BytecodeArrayIterator& iterator) { | 1370 const interpreter::BytecodeArrayIterator& iterator) { |
| 1372 UNIMPLEMENTED(); | 1371 Node* receiver = |
| 1372 environment()->LookupRegister(iterator.GetRegisterOperand(0)); | |
| 1373 Node* property_names = environment()->LookupAccumulator(); | |
| 1374 const Operator* call_runtime = | |
| 1375 javascript()->CallRuntime(Runtime::kInterpreterForInPrepare, 2); | |
|
Benedikt Meurer
2015/12/16 10:53:25
What about JSForInPrepare? Calling interpreter run
| |
| 1376 Node** args = info()->zone()->NewArray<Node*>(2); | |
| 1377 args[0] = receiver; | |
| 1378 args[1] = property_names; | |
| 1379 Node* value = MakeNode(call_runtime, 2, args, false); | |
| 1380 AddEmptyFrameStateInputs(value); | |
| 1381 environment()->BindAccumulator(value); | |
| 1382 } | |
| 1383 | |
| 1384 | |
| 1385 void BytecodeGraphBuilder::VisitForInDone( | |
| 1386 const interpreter::BytecodeArrayIterator& iterator) { | |
| 1387 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | |
| 1388 Node* cache_length = | |
| 1389 environment()->LookupRegister(iterator.GetRegisterOperand(1)); | |
| 1390 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); | |
| 1391 AddEmptyFrameStateInputs(exit_cond); | |
| 1392 environment()->BindAccumulator(exit_cond); | |
| 1373 } | 1393 } |
| 1374 | 1394 |
| 1375 | 1395 |
| 1376 void BytecodeGraphBuilder::VisitForInNext( | 1396 void BytecodeGraphBuilder::VisitForInNext( |
| 1377 const interpreter::BytecodeArrayIterator& iterator) { | 1397 const interpreter::BytecodeArrayIterator& iterator) { |
| 1378 UNIMPLEMENTED(); | 1398 Node* receiver = |
| 1399 environment()->LookupRegister(iterator.GetRegisterOperand(0)); | |
| 1400 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(1)); | |
| 1401 Node* cache_type = | |
| 1402 environment()->LookupRegister(iterator.GetRegisterOperand(2)); | |
| 1403 Node* cache_array = | |
| 1404 environment()->LookupRegister(iterator.GetRegisterOperand(3)); | |
| 1405 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, | |
| 1406 cache_type, index); | |
| 1407 AddEmptyFrameStateInputs(value); | |
| 1408 environment()->BindAccumulator(value); | |
| 1379 } | 1409 } |
| 1380 | 1410 |
| 1381 | 1411 |
| 1382 void BytecodeGraphBuilder::VisitForInDone( | 1412 void BytecodeGraphBuilder::VisitForInStep( |
| 1383 const interpreter::BytecodeArrayIterator& iterator) { | 1413 const interpreter::BytecodeArrayIterator& iterator) { |
| 1384 UNIMPLEMENTED(); | 1414 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 1415 index = NewNode(javascript()->ForInStep(), index); | |
| 1416 AddEmptyFrameStateInputs(index); | |
| 1417 environment()->BindRegister(iterator.GetRegisterOperand(0), index); | |
| 1385 } | 1418 } |
| 1386 | 1419 |
| 1387 | 1420 |
| 1388 void BytecodeGraphBuilder::MergeEnvironmentsOfBackwardBranches( | 1421 void BytecodeGraphBuilder::MergeEnvironmentsOfBackwardBranches( |
| 1389 int source_offset, int target_offset) { | 1422 int source_offset, int target_offset) { |
| 1390 DCHECK_GE(source_offset, target_offset); | 1423 DCHECK_GE(source_offset, target_offset); |
| 1391 const ZoneVector<int>* back_branches = | 1424 const ZoneVector<int>* back_branches = |
| 1392 branch_analysis()->BackwardBranchesTargetting(target_offset); | 1425 branch_analysis()->BackwardBranchesTargetting(target_offset); |
| 1393 if (back_branches->back() == source_offset) { | 1426 if (back_branches->back() == source_offset) { |
| 1394 // The set of back branches is complete, merge them. | 1427 // The set of back branches is complete, merge them. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1626 | 1659 |
| 1627 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1660 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
| 1628 if (environment()->IsMarkedAsUnreachable()) return; | 1661 if (environment()->IsMarkedAsUnreachable()) return; |
| 1629 environment()->MarkAsUnreachable(); | 1662 environment()->MarkAsUnreachable(); |
| 1630 exit_controls_.push_back(exit); | 1663 exit_controls_.push_back(exit); |
| 1631 } | 1664 } |
| 1632 | 1665 |
| 1633 } // namespace compiler | 1666 } // namespace compiler |
| 1634 } // namespace internal | 1667 } // namespace internal |
| 1635 } // namespace v8 | 1668 } // namespace v8 |
| OLD | NEW |