| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 | 656 |
| 657 void BytecodeGraphBuilder::BuildLoadGlobal( | 657 void BytecodeGraphBuilder::BuildLoadGlobal( |
| 658 TypeofMode typeof_mode) { | 658 TypeofMode typeof_mode) { |
| 659 FrameStateBeforeAndAfter states(this); | 659 FrameStateBeforeAndAfter states(this); |
| 660 Handle<Name> name = | 660 Handle<Name> name = |
| 661 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); | 661 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); |
| 662 VectorSlotPair feedback = | 662 VectorSlotPair feedback = |
| 663 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 663 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
| 664 | 664 |
| 665 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); | 665 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); |
| 666 Node* node = NewNode(op, BuildLoadFeedbackVector()); | 666 Node* node = NewNode(op, GetFunctionClosure()); |
| 667 environment()->BindAccumulator(node, &states); | 667 environment()->BindAccumulator(node, &states); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void BytecodeGraphBuilder::VisitLdaGlobalSloppy() { | 670 void BytecodeGraphBuilder::VisitLdaGlobalSloppy() { |
| 671 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | 671 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); |
| 672 } | 672 } |
| 673 | 673 |
| 674 void BytecodeGraphBuilder::VisitLdaGlobalStrict() { | 674 void BytecodeGraphBuilder::VisitLdaGlobalStrict() { |
| 675 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | 675 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); |
| 676 } | 676 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 701 | 701 |
| 702 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { | 702 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { |
| 703 FrameStateBeforeAndAfter states(this); | 703 FrameStateBeforeAndAfter states(this); |
| 704 Handle<Name> name = | 704 Handle<Name> name = |
| 705 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); | 705 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); |
| 706 VectorSlotPair feedback = | 706 VectorSlotPair feedback = |
| 707 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 707 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
| 708 Node* value = environment()->LookupAccumulator(); | 708 Node* value = environment()->LookupAccumulator(); |
| 709 | 709 |
| 710 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); | 710 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); |
| 711 Node* node = NewNode(op, value, BuildLoadFeedbackVector()); | 711 Node* node = NewNode(op, value, GetFunctionClosure()); |
| 712 environment()->RecordAfterState(node, &states); | 712 environment()->RecordAfterState(node, &states); |
| 713 } | 713 } |
| 714 | 714 |
| 715 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { | 715 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { |
| 716 BuildStoreGlobal(LanguageMode::SLOPPY); | 716 BuildStoreGlobal(LanguageMode::SLOPPY); |
| 717 } | 717 } |
| 718 | 718 |
| 719 void BytecodeGraphBuilder::VisitStaGlobalStrict() { | 719 void BytecodeGraphBuilder::VisitStaGlobalStrict() { |
| 720 BuildStoreGlobal(LanguageMode::STRICT); | 720 BuildStoreGlobal(LanguageMode::STRICT); |
| 721 } | 721 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 void BytecodeGraphBuilder::BuildNamedLoad() { | 813 void BytecodeGraphBuilder::BuildNamedLoad() { |
| 814 FrameStateBeforeAndAfter states(this); | 814 FrameStateBeforeAndAfter states(this); |
| 815 Node* object = | 815 Node* object = |
| 816 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 816 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 817 Handle<Name> name = | 817 Handle<Name> name = |
| 818 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 818 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
| 819 VectorSlotPair feedback = | 819 VectorSlotPair feedback = |
| 820 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 820 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
| 821 | 821 |
| 822 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); | 822 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); |
| 823 Node* node = NewNode(op, object, BuildLoadFeedbackVector()); | 823 Node* node = NewNode(op, object, GetFunctionClosure()); |
| 824 environment()->BindAccumulator(node, &states); | 824 environment()->BindAccumulator(node, &states); |
| 825 } | 825 } |
| 826 | 826 |
| 827 void BytecodeGraphBuilder::VisitLoadICSloppy() { | 827 void BytecodeGraphBuilder::VisitLoadICSloppy() { |
| 828 DCHECK(is_sloppy(language_mode())); | 828 DCHECK(is_sloppy(language_mode())); |
| 829 BuildNamedLoad(); | 829 BuildNamedLoad(); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void BytecodeGraphBuilder::VisitLoadICStrict() { | 832 void BytecodeGraphBuilder::VisitLoadICStrict() { |
| 833 DCHECK(is_strict(language_mode())); | 833 DCHECK(is_strict(language_mode())); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 846 | 846 |
| 847 void BytecodeGraphBuilder::BuildKeyedLoad() { | 847 void BytecodeGraphBuilder::BuildKeyedLoad() { |
| 848 FrameStateBeforeAndAfter states(this); | 848 FrameStateBeforeAndAfter states(this); |
| 849 Node* key = environment()->LookupAccumulator(); | 849 Node* key = environment()->LookupAccumulator(); |
| 850 Node* object = | 850 Node* object = |
| 851 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 851 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 852 VectorSlotPair feedback = | 852 VectorSlotPair feedback = |
| 853 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 853 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
| 854 | 854 |
| 855 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); | 855 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); |
| 856 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector()); | 856 Node* node = NewNode(op, object, key, GetFunctionClosure()); |
| 857 environment()->BindAccumulator(node, &states); | 857 environment()->BindAccumulator(node, &states); |
| 858 } | 858 } |
| 859 | 859 |
| 860 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy() { | 860 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy() { |
| 861 DCHECK(is_sloppy(language_mode())); | 861 DCHECK(is_sloppy(language_mode())); |
| 862 BuildKeyedLoad(); | 862 BuildKeyedLoad(); |
| 863 } | 863 } |
| 864 | 864 |
| 865 void BytecodeGraphBuilder::VisitKeyedLoadICStrict() { | 865 void BytecodeGraphBuilder::VisitKeyedLoadICStrict() { |
| 866 DCHECK(is_strict(language_mode())); | 866 DCHECK(is_strict(language_mode())); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 881 FrameStateBeforeAndAfter states(this); | 881 FrameStateBeforeAndAfter states(this); |
| 882 Node* value = environment()->LookupAccumulator(); | 882 Node* value = environment()->LookupAccumulator(); |
| 883 Node* object = | 883 Node* object = |
| 884 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 884 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 885 Handle<Name> name = | 885 Handle<Name> name = |
| 886 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 886 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
| 887 VectorSlotPair feedback = | 887 VectorSlotPair feedback = |
| 888 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 888 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
| 889 | 889 |
| 890 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); | 890 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); |
| 891 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); | 891 Node* node = NewNode(op, object, value, GetFunctionClosure()); |
| 892 environment()->RecordAfterState(node, &states); | 892 environment()->RecordAfterState(node, &states); |
| 893 } | 893 } |
| 894 | 894 |
| 895 void BytecodeGraphBuilder::VisitStoreICSloppy() { | 895 void BytecodeGraphBuilder::VisitStoreICSloppy() { |
| 896 BuildNamedStore(LanguageMode::SLOPPY); | 896 BuildNamedStore(LanguageMode::SLOPPY); |
| 897 } | 897 } |
| 898 | 898 |
| 899 void BytecodeGraphBuilder::VisitStoreICStrict() { | 899 void BytecodeGraphBuilder::VisitStoreICStrict() { |
| 900 BuildNamedStore(LanguageMode::STRICT); | 900 BuildNamedStore(LanguageMode::STRICT); |
| 901 } | 901 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 912 FrameStateBeforeAndAfter states(this); | 912 FrameStateBeforeAndAfter states(this); |
| 913 Node* value = environment()->LookupAccumulator(); | 913 Node* value = environment()->LookupAccumulator(); |
| 914 Node* object = | 914 Node* object = |
| 915 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 915 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 916 Node* key = | 916 Node* key = |
| 917 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 917 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); |
| 918 VectorSlotPair feedback = | 918 VectorSlotPair feedback = |
| 919 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 919 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
| 920 | 920 |
| 921 const Operator* op = javascript()->StoreProperty(language_mode, feedback); | 921 const Operator* op = javascript()->StoreProperty(language_mode, feedback); |
| 922 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector()); | 922 Node* node = NewNode(op, object, key, value, GetFunctionClosure()); |
| 923 environment()->RecordAfterState(node, &states); | 923 environment()->RecordAfterState(node, &states); |
| 924 } | 924 } |
| 925 | 925 |
| 926 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() { | 926 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() { |
| 927 BuildKeyedStore(LanguageMode::SLOPPY); | 927 BuildKeyedStore(LanguageMode::SLOPPY); |
| 928 } | 928 } |
| 929 | 929 |
| 930 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() { | 930 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() { |
| 931 BuildKeyedStore(LanguageMode::STRICT); | 931 BuildKeyedStore(LanguageMode::STRICT); |
| 932 } | 932 } |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 // Phi does not exist yet, introduce one. | 1813 // Phi does not exist yet, introduce one. |
| 1814 value = NewPhi(inputs, value, control); | 1814 value = NewPhi(inputs, value, control); |
| 1815 value->ReplaceInput(inputs - 1, other); | 1815 value->ReplaceInput(inputs - 1, other); |
| 1816 } | 1816 } |
| 1817 return value; | 1817 return value; |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 } // namespace compiler | 1820 } // namespace compiler |
| 1821 } // namespace internal | 1821 } // namespace internal |
| 1822 } // namespace v8 | 1822 } // namespace v8 |
| OLD | NEW |