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/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::BuildCreateRegExpLiteral( | |
| 706 const interpreter::BytecodeArrayIterator& iterator) { | |
| 707 Node* closure = GetFunctionClosure(); | |
|
Benedikt Meurer
2015/12/09 07:24:11
This code is duplicated 3 times. How about adding
mythria
2015/12/09 09:48:20
Done.
| |
| 708 Handle<String> constant_pattern = | |
| 709 Handle<String>::cast(iterator.GetConstantForIndexOperand(0)); | |
| 710 int literal_index = iterator.GetIndexOperand(1); | |
| 711 int literal_flags = iterator.GetImmediateOperand(2); | |
| 712 const Operator* op = javascript()->CreateLiteralRegExp( | |
| 713 constant_pattern, literal_flags, literal_index); | |
| 714 Node* literal = NewNode(op, closure); | |
| 715 AddEmptyFrameStateInputs(literal); | |
| 716 environment()->BindAccumulator(literal); | |
| 717 } | |
| 718 | |
| 719 | |
| 705 void BytecodeGraphBuilder::VisitCreateRegExpLiteral( | 720 void BytecodeGraphBuilder::VisitCreateRegExpLiteral( |
| 706 const interpreter::BytecodeArrayIterator& iterator) { | 721 const interpreter::BytecodeArrayIterator& iterator) { |
| 707 UNIMPLEMENTED(); | 722 BuildCreateRegExpLiteral(iterator); |
| 723 } | |
| 724 | |
| 725 | |
| 726 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide( | |
| 727 const interpreter::BytecodeArrayIterator& iterator) { | |
| 728 BuildCreateRegExpLiteral(iterator); | |
| 729 } | |
| 730 | |
| 731 | |
| 732 void BytecodeGraphBuilder::BuildCreateArrayLiteral( | |
| 733 const interpreter::BytecodeArrayIterator& iterator) { | |
| 734 Node* closure = GetFunctionClosure(); | |
| 735 Handle<FixedArray> constant_elements = | |
| 736 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0)); | |
| 737 int literal_index = iterator.GetIndexOperand(1); | |
| 738 int literal_flags = iterator.GetImmediateOperand(2); | |
| 739 const Operator* op = javascript()->CreateLiteralArray( | |
| 740 constant_elements, literal_flags, literal_index); | |
| 741 Node* literal = NewNode(op, closure); | |
| 742 AddEmptyFrameStateInputs(literal); | |
| 743 environment()->BindAccumulator(literal); | |
| 708 } | 744 } |
| 709 | 745 |
| 710 | 746 |
| 711 void BytecodeGraphBuilder::VisitCreateArrayLiteral( | 747 void BytecodeGraphBuilder::VisitCreateArrayLiteral( |
| 712 const interpreter::BytecodeArrayIterator& iterator) { | 748 const interpreter::BytecodeArrayIterator& iterator) { |
| 713 UNIMPLEMENTED(); | 749 BuildCreateArrayLiteral(iterator); |
| 750 } | |
| 751 | |
| 752 | |
| 753 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide( | |
| 754 const interpreter::BytecodeArrayIterator& iterator) { | |
| 755 BuildCreateArrayLiteral(iterator); | |
| 756 } | |
| 757 | |
| 758 | |
| 759 void BytecodeGraphBuilder::BuildCreateObjectLiteral( | |
| 760 const interpreter::BytecodeArrayIterator& iterator) { | |
| 761 Node* closure = GetFunctionClosure(); | |
| 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 Node* literal = NewNode(op, closure); | |
| 769 AddEmptyFrameStateInputs(literal); | |
| 770 environment()->BindAccumulator(literal); | |
| 714 } | 771 } |
| 715 | 772 |
| 716 | 773 |
| 717 void BytecodeGraphBuilder::VisitCreateObjectLiteral( | 774 void BytecodeGraphBuilder::VisitCreateObjectLiteral( |
| 718 const interpreter::BytecodeArrayIterator& iterator) { | 775 const interpreter::BytecodeArrayIterator& iterator) { |
| 719 UNIMPLEMENTED(); | 776 BuildCreateObjectLiteral(iterator); |
| 720 } | 777 } |
| 721 | 778 |
| 722 | 779 |
| 780 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide( | |
| 781 const interpreter::BytecodeArrayIterator& iterator) { | |
| 782 BuildCreateObjectLiteral(iterator); | |
| 783 } | |
| 784 | |
| 785 | |
| 723 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, | 786 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, |
| 724 Node* callee, | 787 Node* callee, |
| 725 interpreter::Register receiver, | 788 interpreter::Register receiver, |
| 726 size_t arity) { | 789 size_t arity) { |
| 727 Node** all = info()->zone()->NewArray<Node*>(static_cast<int>(arity)); | 790 Node** all = info()->zone()->NewArray<Node*>(static_cast<int>(arity)); |
| 728 all[0] = callee; | 791 all[0] = callee; |
| 729 all[1] = environment()->LookupRegister(receiver); | 792 all[1] = environment()->LookupRegister(receiver); |
| 730 int receiver_index = receiver.index(); | 793 int receiver_index = receiver.index(); |
| 731 for (int i = 2; i < static_cast<int>(arity); ++i) { | 794 for (int i = 2; i < static_cast<int>(arity); ++i) { |
| 732 all[i] = environment()->LookupRegister( | 795 all[i] = environment()->LookupRegister( |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 | 1385 |
| 1323 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1386 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
| 1324 if (environment()->IsMarkedAsUnreachable()) return; | 1387 if (environment()->IsMarkedAsUnreachable()) return; |
| 1325 environment()->MarkAsUnreachable(); | 1388 environment()->MarkAsUnreachable(); |
| 1326 exit_controls_.push_back(exit); | 1389 exit_controls_.push_back(exit); |
| 1327 } | 1390 } |
| 1328 | 1391 |
| 1329 } // namespace compiler | 1392 } // namespace compiler |
| 1330 } // namespace internal | 1393 } // namespace internal |
| 1331 } // namespace v8 | 1394 } // namespace v8 |
| OLD | NEW |