| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 Handle<Name> name = | 638 Handle<Name> name = |
| 639 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); | 639 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); |
| 640 VectorSlotPair feedback = | 640 VectorSlotPair feedback = |
| 641 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 641 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
| 642 | 642 |
| 643 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); | 643 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); |
| 644 Node* node = NewNode(op, GetFunctionClosure()); | 644 Node* node = NewNode(op, GetFunctionClosure()); |
| 645 environment()->BindAccumulator(node, &states); | 645 environment()->BindAccumulator(node, &states); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void BytecodeGraphBuilder::VisitLdaGlobalSloppy() { | 648 void BytecodeGraphBuilder::VisitLdaGlobal() { |
| 649 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | 649 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); |
| 650 } | 650 } |
| 651 | 651 |
| 652 void BytecodeGraphBuilder::VisitLdaGlobalStrict() { | 652 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() { |
| 653 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); |
| 654 } |
| 655 |
| 656 void BytecodeGraphBuilder::VisitLdaGlobalWide() { |
| 653 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | 657 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); |
| 654 } | 658 } |
| 655 | 659 |
| 656 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppy() { | 660 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofWide() { |
| 657 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); | 661 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); |
| 658 } | 662 } |
| 659 | 663 |
| 660 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrict() { | |
| 661 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); | |
| 662 } | |
| 663 | |
| 664 void BytecodeGraphBuilder::VisitLdaGlobalSloppyWide() { | |
| 665 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | |
| 666 } | |
| 667 | |
| 668 void BytecodeGraphBuilder::VisitLdaGlobalStrictWide() { | |
| 669 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); | |
| 670 } | |
| 671 | |
| 672 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppyWide() { | |
| 673 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); | |
| 674 } | |
| 675 | |
| 676 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrictWide() { | |
| 677 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); | |
| 678 } | |
| 679 | |
| 680 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { | 664 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { |
| 681 FrameStateBeforeAndAfter states(this); | 665 FrameStateBeforeAndAfter states(this); |
| 682 Handle<Name> name = | 666 Handle<Name> name = |
| 683 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); | 667 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); |
| 684 VectorSlotPair feedback = | 668 VectorSlotPair feedback = |
| 685 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 669 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
| 686 Node* value = environment()->LookupAccumulator(); | 670 Node* value = environment()->LookupAccumulator(); |
| 687 | 671 |
| 688 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); | 672 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); |
| 689 Node* node = NewNode(op, value, GetFunctionClosure()); | 673 Node* node = NewNode(op, value, GetFunctionClosure()); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 777 |
| 794 void BytecodeGraphBuilder::BuildNamedLoad() { | 778 void BytecodeGraphBuilder::BuildNamedLoad() { |
| 795 FrameStateBeforeAndAfter states(this); | 779 FrameStateBeforeAndAfter states(this); |
| 796 Node* object = | 780 Node* object = |
| 797 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 781 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 798 Handle<Name> name = | 782 Handle<Name> name = |
| 799 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 783 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
| 800 VectorSlotPair feedback = | 784 VectorSlotPair feedback = |
| 801 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 785 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
| 802 | 786 |
| 803 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); | 787 const Operator* op = javascript()->LoadNamed(name, feedback); |
| 804 Node* node = NewNode(op, object, GetFunctionClosure()); | 788 Node* node = NewNode(op, object, GetFunctionClosure()); |
| 805 environment()->BindAccumulator(node, &states); | 789 environment()->BindAccumulator(node, &states); |
| 806 } | 790 } |
| 807 | 791 |
| 808 void BytecodeGraphBuilder::VisitLoadICSloppy() { | 792 void BytecodeGraphBuilder::VisitLoadIC() { BuildNamedLoad(); } |
| 809 DCHECK(is_sloppy(language_mode())); | |
| 810 BuildNamedLoad(); | |
| 811 } | |
| 812 | 793 |
| 813 void BytecodeGraphBuilder::VisitLoadICStrict() { | 794 void BytecodeGraphBuilder::VisitLoadICWide() { BuildNamedLoad(); } |
| 814 DCHECK(is_strict(language_mode())); | |
| 815 BuildNamedLoad(); | |
| 816 } | |
| 817 | |
| 818 void BytecodeGraphBuilder::VisitLoadICSloppyWide() { | |
| 819 DCHECK(is_sloppy(language_mode())); | |
| 820 BuildNamedLoad(); | |
| 821 } | |
| 822 | |
| 823 void BytecodeGraphBuilder::VisitLoadICStrictWide() { | |
| 824 DCHECK(is_strict(language_mode())); | |
| 825 BuildNamedLoad(); | |
| 826 } | |
| 827 | 795 |
| 828 void BytecodeGraphBuilder::BuildKeyedLoad() { | 796 void BytecodeGraphBuilder::BuildKeyedLoad() { |
| 829 FrameStateBeforeAndAfter states(this); | 797 FrameStateBeforeAndAfter states(this); |
| 830 Node* key = environment()->LookupAccumulator(); | 798 Node* key = environment()->LookupAccumulator(); |
| 831 Node* object = | 799 Node* object = |
| 832 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 800 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 833 VectorSlotPair feedback = | 801 VectorSlotPair feedback = |
| 834 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); | 802 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); |
| 835 | 803 |
| 836 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); | 804 const Operator* op = javascript()->LoadProperty(feedback); |
| 837 Node* node = NewNode(op, object, key, GetFunctionClosure()); | 805 Node* node = NewNode(op, object, key, GetFunctionClosure()); |
| 838 environment()->BindAccumulator(node, &states); | 806 environment()->BindAccumulator(node, &states); |
| 839 } | 807 } |
| 840 | 808 |
| 841 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy() { | 809 void BytecodeGraphBuilder::VisitKeyedLoadIC() { BuildKeyedLoad(); } |
| 842 DCHECK(is_sloppy(language_mode())); | |
| 843 BuildKeyedLoad(); | |
| 844 } | |
| 845 | 810 |
| 846 void BytecodeGraphBuilder::VisitKeyedLoadICStrict() { | 811 void BytecodeGraphBuilder::VisitKeyedLoadICWide() { BuildKeyedLoad(); } |
| 847 DCHECK(is_strict(language_mode())); | |
| 848 BuildKeyedLoad(); | |
| 849 } | |
| 850 | |
| 851 void BytecodeGraphBuilder::VisitKeyedLoadICSloppyWide() { | |
| 852 DCHECK(is_sloppy(language_mode())); | |
| 853 BuildKeyedLoad(); | |
| 854 } | |
| 855 | |
| 856 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide() { | |
| 857 DCHECK(is_strict(language_mode())); | |
| 858 BuildKeyedLoad(); | |
| 859 } | |
| 860 | 812 |
| 861 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { | 813 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { |
| 862 FrameStateBeforeAndAfter states(this); | 814 FrameStateBeforeAndAfter states(this); |
| 863 Node* value = environment()->LookupAccumulator(); | 815 Node* value = environment()->LookupAccumulator(); |
| 864 Node* object = | 816 Node* object = |
| 865 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 817 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 866 Handle<Name> name = | 818 Handle<Name> name = |
| 867 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); | 819 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); |
| 868 VectorSlotPair feedback = | 820 VectorSlotPair feedback = |
| 869 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); | 821 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 // Phi does not exist yet, introduce one. | 1746 // Phi does not exist yet, introduce one. |
| 1795 value = NewPhi(inputs, value, control); | 1747 value = NewPhi(inputs, value, control); |
| 1796 value->ReplaceInput(inputs - 1, other); | 1748 value->ReplaceInput(inputs - 1, other); |
| 1797 } | 1749 } |
| 1798 return value; | 1750 return value; |
| 1799 } | 1751 } |
| 1800 | 1752 |
| 1801 } // namespace compiler | 1753 } // namespace compiler |
| 1802 } // namespace internal | 1754 } // namespace internal |
| 1803 } // namespace v8 | 1755 } // namespace v8 |
| OLD | NEW |