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

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

Issue 1902823002: [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, 8 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') | no next file » | 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 // operations, instead of calling builtins directly. 700 // operations, instead of calling builtins directly.
701 Node* reg_index = __ BytecodeOperandReg(0); 701 Node* reg_index = __ BytecodeOperandReg(0);
702 Node* lhs = __ LoadRegister(reg_index); 702 Node* lhs = __ LoadRegister(reg_index);
703 Node* rhs = __ GetAccumulator(); 703 Node* rhs = __ GetAccumulator();
704 Node* context = __ GetContext(); 704 Node* context = __ GetContext();
705 Node* result = __ CallRuntime(function_id, context, lhs, rhs); 705 Node* result = __ CallRuntime(function_id, context, lhs, rhs);
706 __ SetAccumulator(result); 706 __ SetAccumulator(result);
707 __ Dispatch(); 707 __ Dispatch();
708 } 708 }
709 709
710 template <class Generator>
711 void Interpreter::DoBinaryOp(InterpreterAssembler* assembler) {
712 Node* reg_index = __ BytecodeOperandReg(0);
713 Node* lhs = __ LoadRegister(reg_index);
714 Node* rhs = __ GetAccumulator();
715 Node* context = __ GetContext();
716 Node* result = Generator::Generate(assembler, lhs, rhs, context);
717 __ SetAccumulator(result);
718 __ Dispatch();
719 }
710 720
711 // Add <src> 721 // Add <src>
712 // 722 //
713 // Add register <src> to accumulator. 723 // Add register <src> to accumulator.
714 void Interpreter::DoAdd(InterpreterAssembler* assembler) { 724 void Interpreter::DoAdd(InterpreterAssembler* assembler) {
715 DoBinaryOp(CodeFactory::Add(isolate_), assembler); 725 DoBinaryOp<AddStub>(assembler);
716 } 726 }
717 727
718 728
719 // Sub <src> 729 // Sub <src>
720 // 730 //
721 // Subtract register <src> from accumulator. 731 // Subtract register <src> from accumulator.
722 void Interpreter::DoSub(InterpreterAssembler* assembler) { 732 void Interpreter::DoSub(InterpreterAssembler* assembler) {
723 DoBinaryOp(CodeFactory::Subtract(isolate_), assembler); 733 DoBinaryOp<SubtractStub>(assembler);
724 } 734 }
725 735
726 736
727 // Mul <src> 737 // Mul <src>
728 // 738 //
729 // Multiply accumulator by register <src>. 739 // Multiply accumulator by register <src>.
730 void Interpreter::DoMul(InterpreterAssembler* assembler) { 740 void Interpreter::DoMul(InterpreterAssembler* assembler) {
731 DoBinaryOp(CodeFactory::Multiply(isolate_), assembler); 741 DoBinaryOp<MultiplyStub>(assembler);
732 } 742 }
733 743
734 744
735 // Div <src> 745 // Div <src>
736 // 746 //
737 // Divide register <src> by accumulator. 747 // Divide register <src> by accumulator.
738 void Interpreter::DoDiv(InterpreterAssembler* assembler) { 748 void Interpreter::DoDiv(InterpreterAssembler* assembler) {
739 DoBinaryOp(CodeFactory::Divide(isolate_), assembler); 749 DoBinaryOp<DivideStub>(assembler);
740 } 750 }
741 751
742 752
743 // Mod <src> 753 // Mod <src>
744 // 754 //
745 // Modulo register <src> by accumulator. 755 // Modulo register <src> by accumulator.
746 void Interpreter::DoMod(InterpreterAssembler* assembler) { 756 void Interpreter::DoMod(InterpreterAssembler* assembler) {
747 DoBinaryOp(CodeFactory::Modulus(isolate_), assembler); 757 DoBinaryOp<ModulusStub>(assembler);
748 } 758 }
749 759
750 760
751 // BitwiseOr <src> 761 // BitwiseOr <src>
752 // 762 //
753 // BitwiseOr register <src> to accumulator. 763 // BitwiseOr register <src> to accumulator.
754 void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) { 764 void Interpreter::DoBitwiseOr(InterpreterAssembler* assembler) {
755 DoBinaryOp(CodeFactory::BitwiseOr(isolate_), assembler); 765 DoBinaryOp<BitwiseOrStub>(assembler);
756 } 766 }
757 767
758 768
759 // BitwiseXor <src> 769 // BitwiseXor <src>
760 // 770 //
761 // BitwiseXor register <src> to accumulator. 771 // BitwiseXor register <src> to accumulator.
762 void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) { 772 void Interpreter::DoBitwiseXor(InterpreterAssembler* assembler) {
763 DoBinaryOp(CodeFactory::BitwiseXor(isolate_), assembler); 773 DoBinaryOp<BitwiseXorStub>(assembler);
764 } 774 }
765 775
766 776
767 // BitwiseAnd <src> 777 // BitwiseAnd <src>
768 // 778 //
769 // BitwiseAnd register <src> to accumulator. 779 // BitwiseAnd register <src> to accumulator.
770 void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) { 780 void Interpreter::DoBitwiseAnd(InterpreterAssembler* assembler) {
771 DoBinaryOp(CodeFactory::BitwiseAnd(isolate_), assembler); 781 DoBinaryOp<BitwiseAndStub>(assembler);
772 } 782 }
773 783
774 784
775 // ShiftLeft <src> 785 // ShiftLeft <src>
776 // 786 //
777 // Left shifts register <src> by the count specified in the accumulator. 787 // Left shifts register <src> by the count specified in the accumulator.
778 // Register <src> is converted to an int32 and the accumulator to uint32 788 // Register <src> is converted to an int32 and the accumulator to uint32
779 // before the operation. 5 lsb bits from the accumulator are used as count 789 // before the operation. 5 lsb bits from the accumulator are used as count
780 // i.e. <src> << (accumulator & 0x1F). 790 // i.e. <src> << (accumulator & 0x1F).
781 void Interpreter::DoShiftLeft(InterpreterAssembler* assembler) { 791 void Interpreter::DoShiftLeft(InterpreterAssembler* assembler) {
782 DoBinaryOp(CodeFactory::ShiftLeft(isolate_), assembler); 792 DoBinaryOp<ShiftLeftStub>(assembler);
783 } 793 }
784 794
785 795
786 // ShiftRight <src> 796 // ShiftRight <src>
787 // 797 //
788 // Right shifts register <src> by the count specified in the accumulator. 798 // Right shifts register <src> by the count specified in the accumulator.
789 // Result is sign extended. Register <src> is converted to an int32 and the 799 // Result is sign extended. Register <src> is converted to an int32 and the
790 // accumulator to uint32 before the operation. 5 lsb bits from the accumulator 800 // accumulator to uint32 before the operation. 5 lsb bits from the accumulator
791 // are used as count i.e. <src> >> (accumulator & 0x1F). 801 // are used as count i.e. <src> >> (accumulator & 0x1F).
792 void Interpreter::DoShiftRight(InterpreterAssembler* assembler) { 802 void Interpreter::DoShiftRight(InterpreterAssembler* assembler) {
793 DoBinaryOp(CodeFactory::ShiftRight(isolate_), assembler); 803 DoBinaryOp<ShiftRightStub>(assembler);
794 } 804 }
795 805
796 806
797 // ShiftRightLogical <src> 807 // ShiftRightLogical <src>
798 // 808 //
799 // Right Shifts register <src> by the count specified in the accumulator. 809 // Right Shifts register <src> by the count specified in the accumulator.
800 // Result is zero-filled. The accumulator and register <src> are converted to 810 // Result is zero-filled. The accumulator and register <src> are converted to
801 // uint32 before the operation 5 lsb bits from the accumulator are used as 811 // uint32 before the operation 5 lsb bits from the accumulator are used as
802 // count i.e. <src> << (accumulator & 0x1F). 812 // count i.e. <src> << (accumulator & 0x1F).
803 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { 813 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) {
804 DoBinaryOp(CodeFactory::ShiftRightLogical(isolate_), assembler); 814 DoBinaryOp<ShiftRightLogicalStub>(assembler);
805 } 815 }
806 816
807 void Interpreter::DoCountOp(Runtime::FunctionId function_id, 817 void Interpreter::DoCountOp(Runtime::FunctionId function_id,
808 InterpreterAssembler* assembler) { 818 InterpreterAssembler* assembler) {
809 Node* value = __ GetAccumulator(); 819 Node* value = __ GetAccumulator();
810 Node* one = __ NumberConstant(1); 820 Node* one = __ NumberConstant(1);
811 Node* context = __ GetContext(); 821 Node* context = __ GetContext();
812 Node* result = __ CallRuntime(function_id, context, value, one); 822 Node* result = __ CallRuntime(function_id, context, value, one);
813 __ SetAccumulator(result); 823 __ SetAccumulator(result);
814 __ Dispatch(); 824 __ Dispatch();
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 // Illegal 1691 // Illegal
1682 // 1692 //
1683 // An invalid bytecode aborting execution if dispatched. 1693 // An invalid bytecode aborting execution if dispatched.
1684 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { 1694 void Interpreter::DoIllegal(InterpreterAssembler* assembler) {
1685 __ Abort(kInvalidBytecode); 1695 __ Abort(kInvalidBytecode);
1686 } 1696 }
1687 1697
1688 } // namespace interpreter 1698 } // namespace interpreter
1689 } // namespace internal 1699 } // namespace internal
1690 } // namespace v8 1700 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698