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/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 UNIMPLEMENTED(); | 695 UNIMPLEMENTED(); |
696 } | 696 } |
697 | 697 |
698 | 698 |
699 void BytecodeGraphBuilder::VisitCreateUnmappedArguments( | 699 void BytecodeGraphBuilder::VisitCreateUnmappedArguments( |
700 const interpreter::BytecodeArrayIterator& iterator) { | 700 const interpreter::BytecodeArrayIterator& iterator) { |
701 UNIMPLEMENTED(); | 701 UNIMPLEMENTED(); |
702 } | 702 } |
703 | 703 |
704 | 704 |
| 705 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) { |
| 706 Node* literal = NewNode(op, GetFunctionClosure()); |
| 707 AddEmptyFrameStateInputs(literal); |
| 708 environment()->BindAccumulator(literal); |
| 709 } |
| 710 |
| 711 |
| 712 void BytecodeGraphBuilder::BuildCreateRegExpLiteral( |
| 713 const interpreter::BytecodeArrayIterator& iterator) { |
| 714 Handle<String> constant_pattern = |
| 715 Handle<String>::cast(iterator.GetConstantForIndexOperand(0)); |
| 716 int literal_index = iterator.GetIndexOperand(1); |
| 717 int literal_flags = iterator.GetImmediateOperand(2); |
| 718 const Operator* op = javascript()->CreateLiteralRegExp( |
| 719 constant_pattern, literal_flags, literal_index); |
| 720 BuildCreateLiteral(op); |
| 721 } |
| 722 |
| 723 |
705 void BytecodeGraphBuilder::VisitCreateRegExpLiteral( | 724 void BytecodeGraphBuilder::VisitCreateRegExpLiteral( |
706 const interpreter::BytecodeArrayIterator& iterator) { | 725 const interpreter::BytecodeArrayIterator& iterator) { |
707 UNIMPLEMENTED(); | 726 BuildCreateRegExpLiteral(iterator); |
| 727 } |
| 728 |
| 729 |
| 730 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide( |
| 731 const interpreter::BytecodeArrayIterator& iterator) { |
| 732 BuildCreateRegExpLiteral(iterator); |
| 733 } |
| 734 |
| 735 |
| 736 void BytecodeGraphBuilder::BuildCreateArrayLiteral( |
| 737 const interpreter::BytecodeArrayIterator& iterator) { |
| 738 Handle<FixedArray> constant_elements = |
| 739 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); |
| 740 int literal_index = iterator.GetIndexOperand(1); |
| 741 int literal_flags = iterator.GetImmediateOperand(2); |
| 742 const Operator* op = javascript()->CreateLiteralArray( |
| 743 constant_elements, literal_flags, literal_index); |
| 744 BuildCreateLiteral(op); |
708 } | 745 } |
709 | 746 |
710 | 747 |
711 void BytecodeGraphBuilder::VisitCreateArrayLiteral( | 748 void BytecodeGraphBuilder::VisitCreateArrayLiteral( |
712 const interpreter::BytecodeArrayIterator& iterator) { | 749 const interpreter::BytecodeArrayIterator& iterator) { |
713 UNIMPLEMENTED(); | 750 BuildCreateArrayLiteral(iterator); |
| 751 } |
| 752 |
| 753 |
| 754 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide( |
| 755 const interpreter::BytecodeArrayIterator& iterator) { |
| 756 BuildCreateArrayLiteral(iterator); |
| 757 } |
| 758 |
| 759 |
| 760 void BytecodeGraphBuilder::BuildCreateObjectLiteral( |
| 761 const interpreter::BytecodeArrayIterator& iterator) { |
| 762 Handle<FixedArray> constant_properties = |
| 763 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); |
| 764 int literal_index = iterator.GetIndexOperand(1); |
| 765 int literal_flags = iterator.GetImmediateOperand(2); |
| 766 const Operator* op = javascript()->CreateLiteralObject( |
| 767 constant_properties, literal_flags, literal_index); |
| 768 BuildCreateLiteral(op); |
714 } | 769 } |
715 | 770 |
716 | 771 |
717 void BytecodeGraphBuilder::VisitCreateObjectLiteral( | 772 void BytecodeGraphBuilder::VisitCreateObjectLiteral( |
718 const interpreter::BytecodeArrayIterator& iterator) { | 773 const interpreter::BytecodeArrayIterator& iterator) { |
719 UNIMPLEMENTED(); | 774 BuildCreateObjectLiteral(iterator); |
720 } | 775 } |
721 | 776 |
722 | 777 |
| 778 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide( |
| 779 const interpreter::BytecodeArrayIterator& iterator) { |
| 780 BuildCreateObjectLiteral(iterator); |
| 781 } |
| 782 |
| 783 |
723 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, | 784 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, |
724 Node* callee, | 785 Node* callee, |
725 interpreter::Register receiver, | 786 interpreter::Register receiver, |
726 size_t arity) { | 787 size_t arity) { |
727 Node** all = info()->zone()->NewArray<Node*>(static_cast<int>(arity)); | 788 Node** all = info()->zone()->NewArray<Node*>(static_cast<int>(arity)); |
728 all[0] = callee; | 789 all[0] = callee; |
729 all[1] = environment()->LookupRegister(receiver); | 790 all[1] = environment()->LookupRegister(receiver); |
730 int receiver_index = receiver.index(); | 791 int receiver_index = receiver.index(); |
731 for (int i = 2; i < static_cast<int>(arity); ++i) { | 792 for (int i = 2; i < static_cast<int>(arity); ++i) { |
732 all[i] = environment()->LookupRegister( | 793 all[i] = environment()->LookupRegister( |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 | 1383 |
1323 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1384 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
1324 if (environment()->IsMarkedAsUnreachable()) return; | 1385 if (environment()->IsMarkedAsUnreachable()) return; |
1325 environment()->MarkAsUnreachable(); | 1386 environment()->MarkAsUnreachable(); |
1326 exit_controls_.push_back(exit); | 1387 exit_controls_.push_back(exit); |
1327 } | 1388 } |
1328 | 1389 |
1329 } // namespace compiler | 1390 } // namespace compiler |
1330 } // namespace internal | 1391 } // namespace internal |
1331 } // namespace v8 | 1392 } // namespace v8 |
OLD | NEW |