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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 } | 764 } |
765 | 765 |
766 // StaLookupSlotStrict <name_index> | 766 // StaLookupSlotStrict <name_index> |
767 // | 767 // |
768 // Store the object in accumulator to the object with the name in constant | 768 // Store the object in accumulator to the object with the name in constant |
769 // pool entry |name_index| in strict mode. | 769 // pool entry |name_index| in strict mode. |
770 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { | 770 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { |
771 DoStaLookupSlot(LanguageMode::STRICT, assembler); | 771 DoStaLookupSlot(LanguageMode::STRICT, assembler); |
772 } | 772 } |
773 | 773 |
774 Node* Interpreter::BuildLoadNamedProperty(Callable ic, | 774 // LdaNamedProperty <object> <name_index> <slot> |
775 InterpreterAssembler* assembler) { | 775 // |
| 776 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
| 777 // constant pool entry <name_index>. |
| 778 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { |
776 typedef LoadWithVectorDescriptor Descriptor; | 779 typedef LoadWithVectorDescriptor Descriptor; |
| 780 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
777 Node* code_target = __ HeapConstant(ic.code()); | 781 Node* code_target = __ HeapConstant(ic.code()); |
778 Node* register_index = __ BytecodeOperandReg(0); | 782 Node* register_index = __ BytecodeOperandReg(0); |
779 Node* object = __ LoadRegister(register_index); | 783 Node* object = __ LoadRegister(register_index); |
780 Node* constant_index = __ BytecodeOperandIdx(1); | 784 Node* constant_index = __ BytecodeOperandIdx(1); |
781 Node* name = __ LoadConstantPoolEntry(constant_index); | 785 Node* name = __ LoadConstantPoolEntry(constant_index); |
782 Node* raw_slot = __ BytecodeOperandIdx(2); | 786 Node* raw_slot = __ BytecodeOperandIdx(2); |
783 Node* smi_slot = __ SmiTag(raw_slot); | 787 Node* smi_slot = __ SmiTag(raw_slot); |
784 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 788 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
785 Node* context = __ GetContext(); | 789 Node* context = __ GetContext(); |
786 return __ CallStub( | 790 Node* result = __ CallStub( |
787 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), | 791 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), |
788 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), | 792 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), |
789 Arg(Descriptor::kVector, type_feedback_vector)); | 793 Arg(Descriptor::kVector, type_feedback_vector)); |
790 } | |
791 | |
792 // LdaNamedProperty <object> <name_index> <slot> | |
793 // | |
794 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at | |
795 // constant pool entry <name_index>. | |
796 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { | |
797 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); | |
798 Node* result = BuildLoadNamedProperty(ic, assembler); | |
799 __ SetAccumulator(result); | 794 __ SetAccumulator(result); |
800 __ Dispatch(); | 795 __ Dispatch(); |
801 } | 796 } |
802 | 797 |
803 // LdrNamedProperty <object> <name_index> <slot> <reg> | 798 // KeyedLoadIC <object> <slot> |
804 // | 799 // |
805 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at | 800 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
806 // constant pool entry <name_index> and puts the result into register <reg>. | 801 // in the accumulator. |
807 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { | 802 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { |
808 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); | |
809 Node* result = BuildLoadNamedProperty(ic, assembler); | |
810 Node* destination = __ BytecodeOperandReg(3); | |
811 __ StoreRegister(result, destination); | |
812 __ Dispatch(); | |
813 } | |
814 | |
815 Node* Interpreter::BuildLoadKeyedProperty(Callable ic, | |
816 InterpreterAssembler* assembler) { | |
817 typedef LoadWithVectorDescriptor Descriptor; | 803 typedef LoadWithVectorDescriptor Descriptor; |
| 804 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
818 Node* code_target = __ HeapConstant(ic.code()); | 805 Node* code_target = __ HeapConstant(ic.code()); |
819 Node* reg_index = __ BytecodeOperandReg(0); | 806 Node* reg_index = __ BytecodeOperandReg(0); |
820 Node* object = __ LoadRegister(reg_index); | 807 Node* object = __ LoadRegister(reg_index); |
821 Node* name = __ GetAccumulator(); | 808 Node* name = __ GetAccumulator(); |
822 Node* raw_slot = __ BytecodeOperandIdx(1); | 809 Node* raw_slot = __ BytecodeOperandIdx(1); |
823 Node* smi_slot = __ SmiTag(raw_slot); | 810 Node* smi_slot = __ SmiTag(raw_slot); |
824 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 811 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
825 Node* context = __ GetContext(); | 812 Node* context = __ GetContext(); |
826 return __ CallStub( | 813 Node* result = __ CallStub( |
827 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), | 814 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), |
828 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), | 815 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), |
829 Arg(Descriptor::kVector, type_feedback_vector)); | 816 Arg(Descriptor::kVector, type_feedback_vector)); |
830 } | |
831 | |
832 // KeyedLoadIC <object> <slot> | |
833 // | |
834 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | |
835 // in the accumulator. | |
836 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { | |
837 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); | |
838 Node* result = BuildLoadKeyedProperty(ic, assembler); | |
839 __ SetAccumulator(result); | 817 __ SetAccumulator(result); |
840 __ Dispatch(); | 818 __ Dispatch(); |
841 } | 819 } |
842 | 820 |
843 // LdrKeyedProperty <object> <slot> <reg> | |
844 // | |
845 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | |
846 // in the accumulator and puts the result in register <reg>. | |
847 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { | |
848 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); | |
849 Node* result = BuildLoadKeyedProperty(ic, assembler); | |
850 Node* destination = __ BytecodeOperandReg(2); | |
851 __ StoreRegister(result, destination); | |
852 __ Dispatch(); | |
853 } | |
854 | |
855 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { | 821 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
856 typedef StoreWithVectorDescriptor Descriptor; | 822 typedef StoreWithVectorDescriptor Descriptor; |
857 Node* code_target = __ HeapConstant(ic.code()); | 823 Node* code_target = __ HeapConstant(ic.code()); |
858 Node* object_reg_index = __ BytecodeOperandReg(0); | 824 Node* object_reg_index = __ BytecodeOperandReg(0); |
859 Node* object = __ LoadRegister(object_reg_index); | 825 Node* object = __ LoadRegister(object_reg_index); |
860 Node* constant_index = __ BytecodeOperandIdx(1); | 826 Node* constant_index = __ BytecodeOperandIdx(1); |
861 Node* name = __ LoadConstantPoolEntry(constant_index); | 827 Node* name = __ LoadConstantPoolEntry(constant_index); |
862 Node* value = __ GetAccumulator(); | 828 Node* value = __ GetAccumulator(); |
863 Node* raw_slot = __ BytecodeOperandIdx(2); | 829 Node* raw_slot = __ BytecodeOperandIdx(2); |
864 Node* smi_slot = __ SmiTag(raw_slot); | 830 Node* smi_slot = __ SmiTag(raw_slot); |
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2742 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2777 __ SmiTag(new_state)); | 2743 __ SmiTag(new_state)); |
2778 __ SetAccumulator(old_state); | 2744 __ SetAccumulator(old_state); |
2779 | 2745 |
2780 __ Dispatch(); | 2746 __ Dispatch(); |
2781 } | 2747 } |
2782 | 2748 |
2783 } // namespace interpreter | 2749 } // namespace interpreter |
2784 } // namespace internal | 2750 } // namespace internal |
2785 } // namespace v8 | 2751 } // namespace v8 |
OLD | NEW |