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

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

Issue 1901083002: [Interpreter] Introduce IncStub and DecStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments 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
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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // ShiftRightLogical <src> 797 // ShiftRightLogical <src>
798 // 798 //
799 // Right Shifts register <src> by the count specified in the accumulator. 799 // Right Shifts register <src> by the count specified in the accumulator.
800 // Result is zero-filled. The accumulator and register <src> are converted to 800 // 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 801 // uint32 before the operation 5 lsb bits from the accumulator are used as
802 // count i.e. <src> << (accumulator & 0x1F). 802 // count i.e. <src> << (accumulator & 0x1F).
803 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { 803 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) {
804 DoBinaryOp(CodeFactory::ShiftRightLogical(isolate_), assembler); 804 DoBinaryOp(CodeFactory::ShiftRightLogical(isolate_), assembler);
805 } 805 }
806 806
807 void Interpreter::DoCountOp(Runtime::FunctionId function_id, 807 void Interpreter::DoCountOp(Callable callable,
808 InterpreterAssembler* assembler) { 808 InterpreterAssembler* assembler) {
809 Node* target = __ HeapConstant(callable.code());
809 Node* value = __ GetAccumulator(); 810 Node* value = __ GetAccumulator();
810 Node* one = __ NumberConstant(1);
811 Node* context = __ GetContext(); 811 Node* context = __ GetContext();
812 Node* result = __ CallRuntime(function_id, context, value, one); 812 Node* result = __ CallStub(callable.descriptor(), target, context, value);
813 __ SetAccumulator(result); 813 __ SetAccumulator(result);
814 __ Dispatch(); 814 __ Dispatch();
815 } 815 }
816 816
817 817
818 // Inc 818 // Inc
819 // 819 //
820 // Increments value in the accumulator by one. 820 // Increments value in the accumulator by one.
821 void Interpreter::DoInc(InterpreterAssembler* assembler) { 821 void Interpreter::DoInc(InterpreterAssembler* assembler) {
822 DoCountOp(Runtime::kAdd, assembler); 822 DoCountOp(CodeFactory::Inc(isolate_), assembler);
823 } 823 }
824 824
825 825
826 // Dec 826 // Dec
827 // 827 //
828 // Decrements value in the accumulator by one. 828 // Decrements value in the accumulator by one.
829 void Interpreter::DoDec(InterpreterAssembler* assembler) { 829 void Interpreter::DoDec(InterpreterAssembler* assembler) {
830 DoCountOp(Runtime::kSubtract, assembler); 830 DoCountOp(CodeFactory::Dec(isolate_), assembler);
831 } 831 }
832 832
833 833
834 // LogicalNot 834 // LogicalNot
835 // 835 //
836 // Perform logical-not on the accumulator, first casting the 836 // Perform logical-not on the accumulator, first casting the
837 // accumulator to a boolean value if required. 837 // accumulator to a boolean value if required.
838 void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) { 838 void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
839 Callable callable = CodeFactory::ToBoolean(isolate_); 839 Callable callable = CodeFactory::ToBoolean(isolate_);
840 Node* target = __ HeapConstant(callable.code()); 840 Node* target = __ HeapConstant(callable.code());
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 // Illegal 1681 // Illegal
1682 // 1682 //
1683 // An invalid bytecode aborting execution if dispatched. 1683 // An invalid bytecode aborting execution if dispatched.
1684 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { 1684 void Interpreter::DoIllegal(InterpreterAssembler* assembler) {
1685 __ Abort(kInvalidBytecode); 1685 __ Abort(kInvalidBytecode);
1686 } 1686 }
1687 1687
1688 } // namespace interpreter 1688 } // namespace interpreter
1689 } // namespace internal 1689 } // namespace internal
1690 } // namespace v8 1690 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698