Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1980333002: [ignition] Inline the binary op TurboFan code stubs in the bytecode handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/snapshot/snapshot-common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 // operations, instead of calling builtins directly. 722 // operations, instead of calling builtins directly.
723 Node* reg_index = __ BytecodeOperandReg(0); 723 Node* reg_index = __ BytecodeOperandReg(0);
724 Node* lhs = __ LoadRegister(reg_index); 724 Node* lhs = __ LoadRegister(reg_index);
725 Node* rhs = __ GetAccumulator(); 725 Node* rhs = __ GetAccumulator();
726 Node* context = __ GetContext(); 726 Node* context = __ GetContext();
727 Node* result = __ CallRuntime(function_id, context, lhs, rhs); 727 Node* result = __ CallRuntime(function_id, context, lhs, rhs);
728 __ SetAccumulator(result); 728 __ SetAccumulator(result);
729 __ Dispatch(); 729 __ Dispatch();
730 } 730 }
731 731
732 template <class Generator>
733 void Interpreter::DoBinaryOp(InterpreterAssembler* assembler) {
734 Node* reg_index = __ BytecodeOperandReg(0);
735 Node* lhs = __ LoadRegister(reg_index);
736 Node* rhs = __ GetAccumulator();
737 Node* context = __ GetContext();
738 Node* result = Generator::Generate(assembler, lhs, rhs, context);
739 __ SetAccumulator(result);
740 __ Dispatch();
741 }
732 742
733 // Add <src> 743 // Add <src>
734 // 744 //
735 // Add register <src> to accumulator. 745 // Add register <src> to accumulator.
736 void Interpreter::DoAdd(InterpreterAssembler* assembler) { 746 void Interpreter::DoAdd(InterpreterAssembler* assembler) {
737 DoBinaryOp(CodeFactory::Add(isolate_), assembler); 747 DoBinaryOp<AddStub>(assembler);
738 } 748 }
739 749
740 750
741 // Sub <src> 751 // Sub <src>
742 // 752 //
743 // Subtract register <src> from accumulator. 753 // Subtract register <src> from accumulator.
744 void Interpreter::DoSub(InterpreterAssembler* assembler) { 754 void Interpreter::DoSub(InterpreterAssembler* assembler) {
745 DoBinaryOp(CodeFactory::Subtract(isolate_), assembler); 755 DoBinaryOp<SubtractStub>(assembler);
746 } 756 }
747 757
748 758
749 // Mul <src> 759 // Mul <src>
750 // 760 //
751 // Multiply accumulator by register <src>. 761 // Multiply accumulator by register <src>.
752 void Interpreter::DoMul(InterpreterAssembler* assembler) { 762 void Interpreter::DoMul(InterpreterAssembler* assembler) {
753 DoBinaryOp(CodeFactory::Multiply(isolate_), assembler); 763 DoBinaryOp<MultiplyStub>(assembler);
754 } 764 }
755 765
756 766
757 // Div <src> 767 // Div <src>
758 // 768 //
759 // Divide register <src> by accumulator. 769 // Divide register <src> by accumulator.
760 void Interpreter::DoDiv(InterpreterAssembler* assembler) { 770 void Interpreter::DoDiv(InterpreterAssembler* assembler) {
761 DoBinaryOp(CodeFactory::Divide(isolate_), assembler); 771 DoBinaryOp<DivideStub>(assembler);
762 } 772 }
763 773
764 774
765 // Mod <src> 775 // Mod <src>
766 // 776 //
767 // Modulo register <src> by accumulator. 777 // Modulo register <src> by accumulator.
768 void Interpreter::DoMod(InterpreterAssembler* assembler) { 778 void Interpreter::DoMod(InterpreterAssembler* assembler) {
769 DoBinaryOp(CodeFactory::Modulus(isolate_), assembler); 779 DoBinaryOp<ModulusStub>(assembler);
770 } 780 }
771 781
772 782
773 // BitwiseOr <src> 783 // BitwiseOr <src>
774 // 784 //
775 // BitwiseOr register <src> to accumulator. 785 // BitwiseOr register <src> to accumulator.
776 void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) { 786 void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) {
777 DoBinaryOp(CodeFactory::BitwiseOr(isolate_), assembler); 787 DoBinaryOp<BitwiseOrStub>(assembler);
778 } 788 }
779 789
780 790
781 // BitwiseXor <src> 791 // BitwiseXor <src>
782 // 792 //
783 // BitwiseXor register <src> to accumulator. 793 // BitwiseXor register <src> to accumulator.
784 void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) { 794 void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) {
785 DoBinaryOp(CodeFactory::BitwiseXor(isolate_), assembler); 795 DoBinaryOp<BitwiseXorStub>(assembler);
786 } 796 }
787 797
788 798
789 // BitwiseAnd <src> 799 // BitwiseAnd <src>
790 // 800 //
791 // BitwiseAnd register <src> to accumulator. 801 // BitwiseAnd register <src> to accumulator.
792 void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) { 802 void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) {
793 DoBinaryOp(CodeFactory::BitwiseAnd(isolate_), assembler); 803 DoBinaryOp<BitwiseAndStub>(assembler);
794 } 804 }
795 805
796 806
797 // ShiftLeft <src> 807 // ShiftLeft <src>
798 // 808 //
799 // Left shifts register <src> by the count specified in the accumulator. 809 // Left shifts register <src> by the count specified in the accumulator.
800 // Register <src> is converted to an int32 and the accumulator to uint32 810 // Register <src> is converted to an int32 and the accumulator to uint32
801 // before the operation. 5 lsb bits from the accumulator are used as count 811 // before the operation. 5 lsb bits from the accumulator are used as count
802 // i.e. <src> << (accumulator & 0x1F). 812 // i.e. <src> << (accumulator & 0x1F).
803 void Interpreter::DoShiftLeft(InterpreterAssembler* assembler) { 813 void Interpreter::DoShiftLeft(InterpreterAssembler* assembler) {
804 DoBinaryOp(CodeFactory::ShiftLeft(isolate_), assembler); 814 DoBinaryOp<ShiftLeftStub>(assembler);
805 } 815 }
806 816
807 817
808 // ShiftRight <src> 818 // ShiftRight <src>
809 // 819 //
810 // Right shifts register <src> by the count specified in the accumulator. 820 // Right shifts register <src> by the count specified in the accumulator.
811 // Result is sign extended. Register <src> is converted to an int32 and the 821 // Result is sign extended. Register <src> is converted to an int32 and the
812 // accumulator to uint32 before the operation. 5 lsb bits from the accumulator 822 // accumulator to uint32 before the operation. 5 lsb bits from the accumulator
813 // are used as count i.e. <src> >> (accumulator & 0x1F). 823 // are used as count i.e. <src> >> (accumulator & 0x1F).
814 void Interpreter::DoShiftRight(InterpreterAssembler* assembler) { 824 void Interpreter::DoShiftRight(InterpreterAssembler* assembler) {
815 DoBinaryOp(CodeFactory::ShiftRight(isolate_), assembler); 825 DoBinaryOp<ShiftRightStub>(assembler);
816 } 826 }
817 827
818 828
819 // ShiftRightLogical <src> 829 // ShiftRightLogical <src>
820 // 830 //
821 // Right Shifts register <src> by the count specified in the accumulator. 831 // Right Shifts register <src> by the count specified in the accumulator.
822 // Result is zero-filled. The accumulator and register <src> are converted to 832 // Result is zero-filled. The accumulator and register <src> are converted to
823 // uint32 before the operation 5 lsb bits from the accumulator are used as 833 // uint32 before the operation 5 lsb bits from the accumulator are used as
824 // count i.e. <src> << (accumulator & 0x1F). 834 // count i.e. <src> << (accumulator & 0x1F).
825 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { 835 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) {
826 DoBinaryOp(CodeFactory::ShiftRightLogical(isolate_), assembler); 836 DoBinaryOp<ShiftRightLogicalStub>(assembler);
827 } 837 }
828 838
829 void Interpreter::DoCountOp(Callable callable, 839 void Interpreter::DoCountOp(Callable callable,
830 InterpreterAssembler* assembler) { 840 InterpreterAssembler* assembler) {
831 Node* target = __ HeapConstant(callable.code()); 841 Node* target = __ HeapConstant(callable.code());
832 Node* value = __ GetAccumulator(); 842 Node* value = __ GetAccumulator();
833 Node* context = __ GetContext(); 843 Node* context = __ GetContext();
834 Node* result = __ CallStub(callable.descriptor(), target, context, value); 844 Node* result = __ CallStub(callable.descriptor(), target, context, value);
835 __ SetAccumulator(result); 845 __ SetAccumulator(result);
836 __ Dispatch(); 846 __ Dispatch();
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 1839 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
1830 __ SmiTag(new_state)); 1840 __ SmiTag(new_state));
1831 __ SetAccumulator(old_state); 1841 __ SetAccumulator(old_state);
1832 1842
1833 __ Dispatch(); 1843 __ Dispatch();
1834 } 1844 }
1835 1845
1836 } // namespace interpreter 1846 } // namespace interpreter
1837 } // namespace internal 1847 } // namespace internal
1838 } // namespace v8 1848 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/snapshot/snapshot-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698