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

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

Issue 2187603004: [stubs] Using template magic to get the call interface descriptor type from callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@code-factory-cleanup
Patch Set: Created 4 years, 4 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/compiler/js-generic-lowering.cc ('k') | src/interpreter/interpreter.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 #ifndef V8_INTERPRETER_INTERPRETER_H_ 5 #ifndef V8_INTERPRETER_INTERPRETER_H_
6 #define V8_INTERPRETER_INTERPRETER_H_ 6 #define V8_INTERPRETER_INTERPRETER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 // Clients of this interface shouldn't depend on lots of interpreter internals. 10 // Clients of this interface shouldn't depend on lots of interpreter internals.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 template <class Generator> 76 template <class Generator>
77 void DoBinaryOp(InterpreterAssembler* assembler); 77 void DoBinaryOp(InterpreterAssembler* assembler);
78 78
79 // Generates code to perform the binary operation via |Generator| using 79 // Generates code to perform the binary operation via |Generator| using
80 // an immediate value rather the accumulator as the rhs operand. 80 // an immediate value rather the accumulator as the rhs operand.
81 template <class Generator> 81 template <class Generator>
82 void DoBinaryOpWithImmediate(InterpreterAssembler* assembler); 82 void DoBinaryOpWithImmediate(InterpreterAssembler* assembler);
83 83
84 // Generates code to perform the unary operation via |callable| and stores 84 // Generates code to perform the unary operation via |callable| and stores
85 // the result to the accumulator. 85 // the result to the accumulator.
86 void DoUnaryOp(Callable callable, InterpreterAssembler* assembler); 86 void DoUnaryOp(const Callable& callable, InterpreterAssembler* assembler);
87 87
88 // Generates code to perform the unary operation via |Generator|. 88 // Generates code to perform the unary operation via |Generator|.
89 template <class Generator> 89 template <class Generator>
90 void DoUnaryOp(InterpreterAssembler* assembler); 90 void DoUnaryOp(InterpreterAssembler* assembler);
91 91
92 // Generates code to perform the comparison operation associated with 92 // Generates code to perform the comparison operation associated with
93 // |compare_op|. 93 // |compare_op|.
94 void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler); 94 void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler);
95 95
96 // Generates code to perform a global store via |ic|. 96 // Generates code to perform a global store via |ic|.
97 template <typename Descriptor>
97 void DoStaGlobal(Callable ic, InterpreterAssembler* assembler); 98 void DoStaGlobal(Callable ic, InterpreterAssembler* assembler);
98 99
99 // Generates code to perform a named property store via |ic|. 100 // Generates code to perform a named property store via |ic|.
101 template <typename Descriptor>
100 void DoStoreIC(Callable ic, InterpreterAssembler* assembler); 102 void DoStoreIC(Callable ic, InterpreterAssembler* assembler);
101 103
102 // Generates code to perform a keyed property store via |ic|. 104 // Generates code to perform a keyed property store via |ic|.
105 template <typename Descriptor>
103 void DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler); 106 void DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler);
104 107
105 // Generates code to perform a JS call that collects type feedback. 108 // Generates code to perform a JS call that collects type feedback.
106 void DoJSCall(InterpreterAssembler* assembler, TailCallMode tail_call_mode); 109 void DoJSCall(InterpreterAssembler* assembler, TailCallMode tail_call_mode);
107 110
108 // Generates code to perform a runtime call. 111 // Generates code to perform a runtime call.
109 void DoCallRuntimeCommon(InterpreterAssembler* assembler); 112 void DoCallRuntimeCommon(InterpreterAssembler* assembler);
110 113
111 // Generates code to perform a runtime call returning a pair. 114 // Generates code to perform a runtime call returning a pair.
112 void DoCallRuntimeForPairCommon(InterpreterAssembler* assembler); 115 void DoCallRuntimeForPairCommon(InterpreterAssembler* assembler);
(...skipping 16 matching lines...) Expand all
129 void DoStaLookupSlot(LanguageMode language_mode, 132 void DoStaLookupSlot(LanguageMode language_mode,
130 InterpreterAssembler* assembler); 133 InterpreterAssembler* assembler);
131 134
132 // Generates a node with the undefined constant. 135 // Generates a node with the undefined constant.
133 compiler::Node* BuildLoadUndefined(InterpreterAssembler* assembler); 136 compiler::Node* BuildLoadUndefined(InterpreterAssembler* assembler);
134 137
135 // Generates code to load a context slot. 138 // Generates code to load a context slot.
136 compiler::Node* BuildLoadContextSlot(InterpreterAssembler* assembler); 139 compiler::Node* BuildLoadContextSlot(InterpreterAssembler* assembler);
137 140
138 // Generates code to load a global. 141 // Generates code to load a global.
142 template <typename Descriptor>
139 compiler::Node* BuildLoadGlobal(Callable ic, InterpreterAssembler* assembler); 143 compiler::Node* BuildLoadGlobal(Callable ic, InterpreterAssembler* assembler);
140 144
141 // Generates code to load a named property. 145 // Generates code to load a named property.
146 template <typename Descriptor>
142 compiler::Node* BuildLoadNamedProperty(Callable ic, 147 compiler::Node* BuildLoadNamedProperty(Callable ic,
143 InterpreterAssembler* assembler); 148 InterpreterAssembler* assembler);
144 149
145 // Generates code to load a keyed property. 150 // Generates code to load a keyed property.
151 template <typename Descriptor>
146 compiler::Node* BuildLoadKeyedProperty(Callable ic, 152 compiler::Node* BuildLoadKeyedProperty(Callable ic,
147 InterpreterAssembler* assembler); 153 InterpreterAssembler* assembler);
148 154
149 // Generates code to prepare the result for ForInPrepare. Cache data 155 // Generates code to prepare the result for ForInPrepare. Cache data
150 // are placed into the consecutive series of registers starting at 156 // are placed into the consecutive series of registers starting at
151 // |output_register|. 157 // |output_register|.
152 void BuildForInPrepareResult(compiler::Node* output_register, 158 void BuildForInPrepareResult(compiler::Node* output_register,
153 compiler::Node* cache_type, 159 compiler::Node* cache_type,
154 compiler::Node* cache_array, 160 compiler::Node* cache_array,
155 compiler::Node* cache_length, 161 compiler::Node* cache_length,
156 InterpreterAssembler* assembler); 162 InterpreterAssembler* assembler);
157 163
158 // Generates code to perform the unary operation via |callable|. 164 // Generates code to perform the unary operation via |callable|.
159 compiler::Node* BuildUnaryOp(Callable callable, 165 compiler::Node* BuildUnaryOp(const Callable& callable,
160 InterpreterAssembler* assembler); 166 InterpreterAssembler* assembler);
161 167
162 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const; 168 uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const;
163 169
164 // Get dispatch table index of bytecode. 170 // Get dispatch table index of bytecode.
165 static size_t GetDispatchTableIndex(Bytecode bytecode, 171 static size_t GetDispatchTableIndex(Bytecode bytecode,
166 OperandScale operand_scale); 172 OperandScale operand_scale);
167 173
168 bool IsDispatchTableInitialized(); 174 bool IsDispatchTableInitialized();
169 175
170 static const int kNumberOfWideVariants = 3; 176 static const int kNumberOfWideVariants = 3;
171 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1); 177 static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1);
172 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1; 178 static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1;
173 179
174 Isolate* isolate_; 180 Isolate* isolate_;
175 Address dispatch_table_[kDispatchTableSize]; 181 Address dispatch_table_[kDispatchTableSize];
176 std::unique_ptr<uintptr_t[]> bytecode_dispatch_counters_table_; 182 std::unique_ptr<uintptr_t[]> bytecode_dispatch_counters_table_;
177 183
178 DISALLOW_COPY_AND_ASSIGN(Interpreter); 184 DISALLOW_COPY_AND_ASSIGN(Interpreter);
179 }; 185 };
180 186
181 } // namespace interpreter 187 } // namespace interpreter
182 } // namespace internal 188 } // namespace internal
183 } // namespace v8 189 } // namespace v8
184 190
185 #endif // V8_INTERPRETER_INTERPRETER_H_ 191 #endif // V8_INTERPRETER_INTERPRETER_H_
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698