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

Side by Side Diff: src/interpreter/bytecode-pipeline.h

Issue 2684993002: [interpreter] Create custom call opcodes for specific argument counts (Closed)
Patch Set: Fix golden files again Created 3 years, 9 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/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('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_BYTECODE_PIPELINE_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_PIPELINE_H_
6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_ 6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_
7 7
8 #include "src/base/compiler-specific.h" 8 #include "src/base/compiler-specific.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/interpreter/bytecode-register-allocator.h" 10 #include "src/interpreter/bytecode-register-allocator.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 operand_count_(4), 184 operand_count_(4),
185 operand_scale_(OperandScale::kSingle), 185 operand_scale_(OperandScale::kSingle),
186 source_info_(source_info) { 186 source_info_(source_info) {
187 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count()); 187 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
188 SetOperand(0, operand0); 188 SetOperand(0, operand0);
189 SetOperand(1, operand1); 189 SetOperand(1, operand1);
190 SetOperand(2, operand2); 190 SetOperand(2, operand2);
191 SetOperand(3, operand3); 191 SetOperand(3, operand3);
192 } 192 }
193 193
194 INLINE(BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
195 uint32_t operand2, uint32_t operand3, uint32_t operand4,
196 BytecodeSourceInfo source_info = BytecodeSourceInfo()))
197 : bytecode_(bytecode),
198 operand_count_(5),
199 operand_scale_(OperandScale::kSingle),
200 source_info_(source_info) {
201 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count());
202 SetOperand(0, operand0);
203 SetOperand(1, operand1);
204 SetOperand(2, operand2);
205 SetOperand(3, operand3);
206 SetOperand(4, operand4);
207 }
208
194 #define DEFINE_BYTECODE_NODE_CREATOR(Name, ...) \ 209 #define DEFINE_BYTECODE_NODE_CREATOR(Name, ...) \
195 template <typename... Operands> \ 210 template <typename... Operands> \
196 INLINE(static BytecodeNode Name(BytecodeSourceInfo source_info, \ 211 INLINE(static BytecodeNode Name(BytecodeSourceInfo source_info, \
197 Operands... operands)) { \ 212 Operands... operands)) { \
198 return Create<Bytecode::k##Name, __VA_ARGS__>(source_info, operands...); \ 213 return Create<Bytecode::k##Name, __VA_ARGS__>(source_info, operands...); \
199 } 214 }
200 BYTECODE_LIST(DEFINE_BYTECODE_NODE_CREATOR) 215 BYTECODE_LIST(DEFINE_BYTECODE_NODE_CREATOR)
201 #undef DEFINE_BYTECODE_NODE_CREATOR 216 #undef DEFINE_BYTECODE_NODE_CREATOR
202 217
203 // Replace the bytecode of this node with |bytecode| and keep the operands. 218 // Replace the bytecode of this node with |bytecode| and keep the operands.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 269
255 private: 270 private:
256 template <Bytecode bytecode, AccumulatorUse accumulator_use, 271 template <Bytecode bytecode, AccumulatorUse accumulator_use,
257 OperandType... operand_types> 272 OperandType... operand_types>
258 friend class BytecodeNodeBuilder; 273 friend class BytecodeNodeBuilder;
259 274
260 INLINE(BytecodeNode(Bytecode bytecode, int operand_count, 275 INLINE(BytecodeNode(Bytecode bytecode, int operand_count,
261 OperandScale operand_scale, 276 OperandScale operand_scale,
262 BytecodeSourceInfo source_info, uint32_t operand0 = 0, 277 BytecodeSourceInfo source_info, uint32_t operand0 = 0,
263 uint32_t operand1 = 0, uint32_t operand2 = 0, 278 uint32_t operand1 = 0, uint32_t operand2 = 0,
264 uint32_t operand3 = 0)) 279 uint32_t operand3 = 0, uint32_t operand4 = 0))
265 : bytecode_(bytecode), 280 : bytecode_(bytecode),
266 operand_count_(operand_count), 281 operand_count_(operand_count),
267 operand_scale_(operand_scale), 282 operand_scale_(operand_scale),
268 source_info_(source_info) { 283 source_info_(source_info) {
269 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count); 284 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count);
270 operands_[0] = operand0; 285 operands_[0] = operand0;
271 operands_[1] = operand1; 286 operands_[1] = operand1;
272 operands_[2] = operand2; 287 operands_[2] = operand2;
273 operands_[3] = operand3; 288 operands_[3] = operand3;
289 operands_[4] = operand4;
274 } 290 }
275 291
276 template <Bytecode bytecode, AccumulatorUse accum_use> 292 template <Bytecode bytecode, AccumulatorUse accum_use>
277 INLINE(static BytecodeNode Create(BytecodeSourceInfo source_info)) { 293 INLINE(static BytecodeNode Create(BytecodeSourceInfo source_info)) {
278 return BytecodeNode(bytecode, 0, OperandScale::kSingle, source_info); 294 return BytecodeNode(bytecode, 0, OperandScale::kSingle, source_info);
279 } 295 }
280 296
281 template <Bytecode bytecode, AccumulatorUse accum_use, 297 template <Bytecode bytecode, AccumulatorUse accum_use,
282 OperandType operand0_type> 298 OperandType operand0_type>
283 INLINE(static BytecodeNode Create(BytecodeSourceInfo source_info, 299 INLINE(static BytecodeNode Create(BytecodeSourceInfo source_info,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 3), operand3_type); 345 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 3), operand3_type);
330 OperandScale scale = OperandScale::kSingle; 346 OperandScale scale = OperandScale::kSingle;
331 scale = std::max(scale, ScaleForOperand<operand0_type>(operand0)); 347 scale = std::max(scale, ScaleForOperand<operand0_type>(operand0));
332 scale = std::max(scale, ScaleForOperand<operand1_type>(operand1)); 348 scale = std::max(scale, ScaleForOperand<operand1_type>(operand1));
333 scale = std::max(scale, ScaleForOperand<operand2_type>(operand2)); 349 scale = std::max(scale, ScaleForOperand<operand2_type>(operand2));
334 scale = std::max(scale, ScaleForOperand<operand3_type>(operand3)); 350 scale = std::max(scale, ScaleForOperand<operand3_type>(operand3));
335 return BytecodeNode(bytecode, 4, scale, source_info, operand0, operand1, 351 return BytecodeNode(bytecode, 4, scale, source_info, operand0, operand1,
336 operand2, operand3); 352 operand2, operand3);
337 } 353 }
338 354
355 template <Bytecode bytecode, AccumulatorUse accum_use,
356 OperandType operand0_type, OperandType operand1_type,
357 OperandType operand2_type, OperandType operand3_type,
358 OperandType operand4_type>
359 INLINE(static BytecodeNode Create(BytecodeSourceInfo source_info,
360 uint32_t operand0, uint32_t operand1,
361 uint32_t operand2, uint32_t operand3,
362 uint32_t operand4)) {
363 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 0), operand0_type);
364 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 1), operand1_type);
365 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 2), operand2_type);
366 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 3), operand3_type);
367 DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 4), operand4_type);
368 OperandScale scale = OperandScale::kSingle;
369 scale = std::max(scale, ScaleForOperand<operand0_type>(operand0));
370 scale = std::max(scale, ScaleForOperand<operand1_type>(operand1));
371 scale = std::max(scale, ScaleForOperand<operand2_type>(operand2));
372 scale = std::max(scale, ScaleForOperand<operand3_type>(operand3));
373 scale = std::max(scale, ScaleForOperand<operand4_type>(operand4));
374 return BytecodeNode(bytecode, 5, scale, source_info, operand0, operand1,
375 operand2, operand3, operand4);
376 }
377
339 template <OperandType operand_type> 378 template <OperandType operand_type>
340 INLINE(static OperandScale ScaleForOperand(uint32_t operand)) { 379 INLINE(static OperandScale ScaleForOperand(uint32_t operand)) {
341 if (BytecodeOperands::IsScalableUnsignedByte(operand_type)) { 380 if (BytecodeOperands::IsScalableUnsignedByte(operand_type)) {
342 return Bytecodes::ScaleForUnsignedOperand(operand); 381 return Bytecodes::ScaleForUnsignedOperand(operand);
343 } else if (BytecodeOperands::IsScalableSignedByte(operand_type)) { 382 } else if (BytecodeOperands::IsScalableSignedByte(operand_type)) {
344 return Bytecodes::ScaleForSignedOperand(operand); 383 return Bytecodes::ScaleForSignedOperand(operand);
345 } else { 384 } else {
346 return OperandScale::kSingle; 385 return OperandScale::kSingle;
347 } 386 }
348 } 387 }
(...skipping 24 matching lines...) Expand all
373 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, 412 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
374 const BytecodeSourceInfo& info); 413 const BytecodeSourceInfo& info);
375 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, 414 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
376 const BytecodeNode& node); 415 const BytecodeNode& node);
377 416
378 } // namespace interpreter 417 } // namespace interpreter
379 } // namespace internal 418 } // namespace internal
380 } // namespace v8 419 } // namespace v8
381 420
382 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_ 421 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698