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

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

Issue 1980463003: [Interpreter] Inline Inc/Dec code stubs into bytecode handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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') | 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 // ShiftRightLogical <src> 829 // ShiftRightLogical <src>
830 // 830 //
831 // Right Shifts register <src> by the count specified in the accumulator. 831 // Right Shifts register <src> by the count specified in the accumulator.
832 // 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
833 // 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
834 // count i.e. <src> << (accumulator & 0x1F). 834 // count i.e. <src> << (accumulator & 0x1F).
835 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { 835 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) {
836 DoBinaryOp<ShiftRightLogicalStub>(assembler); 836 DoBinaryOp<ShiftRightLogicalStub>(assembler);
837 } 837 }
838 838
839 void Interpreter::DoCountOp(Callable callable, 839 template <class Generator>
840 InterpreterAssembler* assembler) { 840 void Interpreter::DoUnaryOp(InterpreterAssembler* assembler) {
841 Node* target = __ HeapConstant(callable.code());
842 Node* value = __ GetAccumulator(); 841 Node* value = __ GetAccumulator();
843 Node* context = __ GetContext(); 842 Node* context = __ GetContext();
844 Node* result = __ CallStub(callable.descriptor(), target, context, value); 843 Node* result = Generator::Generate(assembler, value, context);
845 __ SetAccumulator(result); 844 __ SetAccumulator(result);
846 __ Dispatch(); 845 __ Dispatch();
847 } 846 }
848 847
849
850 // Inc 848 // Inc
851 // 849 //
852 // Increments value in the accumulator by one. 850 // Increments value in the accumulator by one.
853 void Interpreter::DoInc(InterpreterAssembler* assembler) { 851 void Interpreter::DoInc(InterpreterAssembler* assembler) {
854 DoCountOp(CodeFactory::Inc(isolate_), assembler); 852 DoUnaryOp<IncStub>(assembler);
855 } 853 }
856 854
857
858 // Dec 855 // Dec
859 // 856 //
860 // Decrements value in the accumulator by one. 857 // Decrements value in the accumulator by one.
861 void Interpreter::DoDec(InterpreterAssembler* assembler) { 858 void Interpreter::DoDec(InterpreterAssembler* assembler) {
862 DoCountOp(CodeFactory::Dec(isolate_), assembler); 859 DoUnaryOp<DecStub>(assembler);
863 } 860 }
864 861
865 void Interpreter::DoLogicalNotOp(Node* value, InterpreterAssembler* assembler) { 862 void Interpreter::DoLogicalNotOp(Node* value, InterpreterAssembler* assembler) {
866 Label if_true(assembler), if_false(assembler), end(assembler); 863 Label if_true(assembler), if_false(assembler), end(assembler);
867 Node* true_value = __ BooleanConstant(true); 864 Node* true_value = __ BooleanConstant(true);
868 Node* false_value = __ BooleanConstant(false); 865 Node* false_value = __ BooleanConstant(false);
869 __ BranchIfWordEqual(value, true_value, &if_true, &if_false); 866 __ BranchIfWordEqual(value, true_value, &if_true, &if_false);
870 __ Bind(&if_true); 867 __ Bind(&if_true);
871 { 868 {
872 __ SetAccumulator(false_value); 869 __ SetAccumulator(false_value);
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 1853 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
1857 __ SmiTag(new_state)); 1854 __ SmiTag(new_state));
1858 __ SetAccumulator(old_state); 1855 __ SetAccumulator(old_state);
1859 1856
1860 __ Dispatch(); 1857 __ Dispatch();
1861 } 1858 }
1862 1859
1863 } // namespace interpreter 1860 } // namespace interpreter
1864 } // namespace internal 1861 } // namespace internal
1865 } // namespace v8 1862 } // 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