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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 749 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
750 Handle<Name> name = | 750 Handle<Name> name = |
751 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 751 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
752 VectorSlotPair feedback = | 752 VectorSlotPair feedback = |
753 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 753 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
754 | 754 |
755 const Operator* op = javascript()->LoadNamed(name, feedback); | 755 const Operator* op = javascript()->LoadNamed(name, feedback); |
756 return NewNode(op, object, GetFunctionClosure()); | 756 return NewNode(op, object, GetFunctionClosure()); |
757 } | 757 } |
758 | 758 |
759 void BytecodeGraphBuilder::VisitLoadIC() { | 759 void BytecodeGraphBuilder::VisitLdaNamedProperty() { |
760 FrameStateBeforeAndAfter states(this); | 760 FrameStateBeforeAndAfter states(this); |
761 Node* node = BuildNamedLoad(); | 761 Node* node = BuildNamedLoad(); |
762 environment()->BindAccumulator(node, &states); | 762 environment()->BindAccumulator(node, &states); |
763 } | 763 } |
764 | 764 |
765 void BytecodeGraphBuilder::VisitLdrNamedProperty() { | 765 void BytecodeGraphBuilder::VisitLdrNamedProperty() { |
766 FrameStateBeforeAndAfter states(this); | 766 FrameStateBeforeAndAfter states(this); |
767 Node* node = BuildNamedLoad(); | 767 Node* node = BuildNamedLoad(); |
768 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node, | 768 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(3), node, |
769 &states); | 769 &states); |
770 } | 770 } |
771 | 771 |
772 Node* BytecodeGraphBuilder::BuildKeyedLoad() { | 772 Node* BytecodeGraphBuilder::BuildKeyedLoad() { |
773 Node* key = environment()->LookupAccumulator(); | 773 Node* key = environment()->LookupAccumulator(); |
774 Node* object = | 774 Node* object = |
775 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 775 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
776 VectorSlotPair feedback = | 776 VectorSlotPair feedback = |
777 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 777 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
778 | 778 |
779 const Operator* op = javascript()->LoadProperty(feedback); | 779 const Operator* op = javascript()->LoadProperty(feedback); |
780 return NewNode(op, object, key, GetFunctionClosure()); | 780 return NewNode(op, object, key, GetFunctionClosure()); |
781 } | 781 } |
782 | 782 |
783 void BytecodeGraphBuilder::VisitKeyedLoadIC() { | 783 void BytecodeGraphBuilder::VisitLdaKeyedProperty() { |
784 FrameStateBeforeAndAfter states(this); | 784 FrameStateBeforeAndAfter states(this); |
785 Node* node = BuildKeyedLoad(); | 785 Node* node = BuildKeyedLoad(); |
786 environment()->BindAccumulator(node, &states); | 786 environment()->BindAccumulator(node, &states); |
787 } | 787 } |
788 | 788 |
789 void BytecodeGraphBuilder::VisitLdrKeyedProperty() { | 789 void BytecodeGraphBuilder::VisitLdrKeyedProperty() { |
790 FrameStateBeforeAndAfter states(this); | 790 FrameStateBeforeAndAfter states(this); |
791 Node* node = BuildKeyedLoad(); | 791 Node* node = BuildKeyedLoad(); |
792 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node, | 792 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(2), node, |
793 &states); | 793 &states); |
794 } | 794 } |
795 | 795 |
796 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { | 796 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { |
797 FrameStateBeforeAndAfter states(this); | 797 FrameStateBeforeAndAfter states(this); |
798 Node* value = environment()->LookupAccumulator(); | 798 Node* value = environment()->LookupAccumulator(); |
799 Node* object = | 799 Node* object = |
800 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 800 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
801 Handle<Name> name = | 801 Handle<Name> name = |
802 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 802 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
803 VectorSlotPair feedback = | 803 VectorSlotPair feedback = |
804 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 804 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
805 | 805 |
806 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); | 806 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); |
807 Node* node = NewNode(op, object, value, GetFunctionClosure()); | 807 Node* node = NewNode(op, object, value, GetFunctionClosure()); |
808 environment()->RecordAfterState(node, &states); | 808 environment()->RecordAfterState(node, &states); |
809 } | 809 } |
810 | 810 |
811 void BytecodeGraphBuilder::VisitStoreICSloppy() { | 811 void BytecodeGraphBuilder::VisitStaNamedPropertySloppy() { |
812 BuildNamedStore(LanguageMode::SLOPPY); | 812 BuildNamedStore(LanguageMode::SLOPPY); |
813 } | 813 } |
814 | 814 |
815 void BytecodeGraphBuilder::VisitStoreICStrict() { | 815 void BytecodeGraphBuilder::VisitStaNamedPropertyStrict() { |
816 BuildNamedStore(LanguageMode::STRICT); | 816 BuildNamedStore(LanguageMode::STRICT); |
817 } | 817 } |
818 | 818 |
819 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { | 819 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { |
820 FrameStateBeforeAndAfter states(this); | 820 FrameStateBeforeAndAfter states(this); |
821 Node* value = environment()->LookupAccumulator(); | 821 Node* value = environment()->LookupAccumulator(); |
822 Node* object = | 822 Node* object = |
823 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 823 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
824 Node* key = | 824 Node* key = |
825 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 825 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); |
826 VectorSlotPair feedback = | 826 VectorSlotPair feedback = |
827 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 827 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
828 | 828 |
829 const Operator* op = javascript()->StoreProperty(language_mode, feedback); | 829 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
830 Node* node = NewNode(op, object, key, value, GetFunctionClosure()); | 830 Node* node = NewNode(op, object, key, value, GetFunctionClosure()); |
831 environment()->RecordAfterState(node, &states); | 831 environment()->RecordAfterState(node, &states); |
832 } | 832 } |
833 | 833 |
834 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() { | 834 void BytecodeGraphBuilder::VisitStaKeyedPropertySloppy() { |
835 BuildKeyedStore(LanguageMode::SLOPPY); | 835 BuildKeyedStore(LanguageMode::SLOPPY); |
836 } | 836 } |
837 | 837 |
838 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() { | 838 void BytecodeGraphBuilder::VisitStaKeyedPropertyStrict() { |
839 BuildKeyedStore(LanguageMode::STRICT); | 839 BuildKeyedStore(LanguageMode::STRICT); |
840 } | 840 } |
841 | 841 |
842 void BytecodeGraphBuilder::VisitPushContext() { | 842 void BytecodeGraphBuilder::VisitPushContext() { |
843 Node* new_context = environment()->LookupAccumulator(); | 843 Node* new_context = environment()->LookupAccumulator(); |
844 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), | 844 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), |
845 environment()->Context()); | 845 environment()->Context()); |
846 environment()->SetContext(new_context); | 846 environment()->SetContext(new_context); |
847 } | 847 } |
848 | 848 |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 // Phi does not exist yet, introduce one. | 1723 // Phi does not exist yet, introduce one. |
1724 value = NewPhi(inputs, value, control); | 1724 value = NewPhi(inputs, value, control); |
1725 value->ReplaceInput(inputs - 1, other); | 1725 value->ReplaceInput(inputs - 1, other); |
1726 } | 1726 } |
1727 return value; | 1727 return value; |
1728 } | 1728 } |
1729 | 1729 |
1730 } // namespace compiler | 1730 } // namespace compiler |
1731 } // namespace internal | 1731 } // namespace internal |
1732 } // namespace v8 | 1732 } // namespace v8 |
OLD | NEW |