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

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

Issue 2673833003: [interpreter] Create custom call opcodes for specific argument counts (Closed)
Patch Set: Rebase Created 3 years, 10 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-pipeline.h ('k') | src/interpreter/interpreter.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_BYTECODES_H_ 5 #ifndef V8_INTERPRETER_BYTECODES_H_
6 #define V8_INTERPRETER_BYTECODES_H_ 6 #define V8_INTERPRETER_BYTECODES_H_
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <string> 10 #include <string>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 V(TypeOf, AccumulatorUse::kReadWrite) \ 142 V(TypeOf, AccumulatorUse::kReadWrite) \
143 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ 143 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \
144 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ 144 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \
145 \ 145 \
146 /* GetSuperConstructor operator */ \ 146 /* GetSuperConstructor operator */ \
147 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ 147 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \
148 \ 148 \
149 /* Call operations */ \ 149 /* Call operations */ \
150 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ 150 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \
151 OperandType::kRegCount, OperandType::kIdx) \ 151 OperandType::kRegCount, OperandType::kIdx) \
152 V(Call0, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \
153 OperandType::kIdx) \
154 V(Call1, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \
155 OperandType::kReg, OperandType::kIdx) \
156 V(Call2, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \
157 OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
152 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ 158 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \
153 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ 159 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
160 V(CallProperty0, AccumulatorUse::kWrite, OperandType::kReg, \
161 OperandType::kReg, OperandType::kIdx) \
162 V(CallProperty1, AccumulatorUse::kWrite, OperandType::kReg, \
163 OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
164 V(CallProperty2, AccumulatorUse::kWrite, OperandType::kReg, \
165 OperandType::kReg, OperandType::kReg, OperandType::kReg, \
166 OperandType::kIdx) \
154 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ 167 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \
155 OperandType::kRegList, OperandType::kRegCount) \ 168 OperandType::kRegList, OperandType::kRegCount) \
156 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ 169 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \
157 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ 170 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \
158 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ 171 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \
159 OperandType::kRegList, OperandType::kRegCount) \ 172 OperandType::kRegList, OperandType::kRegCount) \
160 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ 173 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \
161 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ 174 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \
162 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ 175 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \
163 OperandType::kRegList, OperandType::kRegCount) \ 176 OperandType::kRegList, OperandType::kRegCount) \
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 #define COUNT_BYTECODE(x, ...) +1 408 #define COUNT_BYTECODE(x, ...) +1
396 // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will 409 // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will
397 // evaluate to the same value as the last real bytecode. 410 // evaluate to the same value as the last real bytecode.
398 kLast = -1 BYTECODE_LIST(COUNT_BYTECODE) 411 kLast = -1 BYTECODE_LIST(COUNT_BYTECODE)
399 #undef COUNT_BYTECODE 412 #undef COUNT_BYTECODE
400 }; 413 };
401 414
402 class V8_EXPORT_PRIVATE Bytecodes final { 415 class V8_EXPORT_PRIVATE Bytecodes final {
403 public: 416 public:
404 // The maximum number of operands a bytecode may have. 417 // The maximum number of operands a bytecode may have.
405 static const int kMaxOperands = 4; 418 static const int kMaxOperands = 5;
406 419
407 // Returns string representation of |bytecode|. 420 // Returns string representation of |bytecode|.
408 static const char* ToString(Bytecode bytecode); 421 static const char* ToString(Bytecode bytecode);
409 422
410 // Returns string representation of |bytecode|. 423 // Returns string representation of |bytecode|.
411 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); 424 static std::string ToString(Bytecode bytecode, OperandScale operand_scale);
412 425
413 // Returns byte value of bytecode. 426 // Returns byte value of bytecode.
414 static uint8_t ToByte(Bytecode bytecode) { 427 static uint8_t ToByte(Bytecode bytecode) {
415 DCHECK_LE(bytecode, Bytecode::kLast); 428 DCHECK_LE(bytecode, Bytecode::kLast);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kStar; 619 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kStar;
607 } 620 }
608 621
609 // Returns true if |bytecode| puts a name in the accumulator. 622 // Returns true if |bytecode| puts a name in the accumulator.
610 static constexpr bool PutsNameInAccumulator(Bytecode bytecode) { 623 static constexpr bool PutsNameInAccumulator(Bytecode bytecode) {
611 return bytecode == Bytecode::kTypeOf; 624 return bytecode == Bytecode::kTypeOf;
612 } 625 }
613 626
614 // Returns true if the bytecode is a call or a constructor call. 627 // Returns true if the bytecode is a call or a constructor call.
615 static constexpr bool IsCallOrConstruct(Bytecode bytecode) { 628 static constexpr bool IsCallOrConstruct(Bytecode bytecode) {
616 return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty || 629 return bytecode == Bytecode::kCall || bytecode == Bytecode::kCall0 ||
630 bytecode == Bytecode::kCall1 || bytecode == Bytecode::kCall2 ||
631 bytecode == Bytecode::kCallProperty ||
632 bytecode == Bytecode::kCallProperty0 ||
633 bytecode == Bytecode::kCallProperty1 ||
634 bytecode == Bytecode::kCallProperty2 ||
617 bytecode == Bytecode::kTailCall || bytecode == Bytecode::kConstruct; 635 bytecode == Bytecode::kTailCall || bytecode == Bytecode::kConstruct;
618 } 636 }
619 637
620 // Returns true if the bytecode is a call to the runtime. 638 // Returns true if the bytecode is a call to the runtime.
621 static constexpr bool IsCallRuntime(Bytecode bytecode) { 639 static constexpr bool IsCallRuntime(Bytecode bytecode) {
622 return bytecode == Bytecode::kCallRuntime || 640 return bytecode == Bytecode::kCallRuntime ||
623 bytecode == Bytecode::kCallRuntimeForPair || 641 bytecode == Bytecode::kCallRuntimeForPair ||
624 bytecode == Bytecode::kInvokeIntrinsic; 642 bytecode == Bytecode::kInvokeIntrinsic;
625 } 643 }
626 644
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 }; 836 };
819 837
820 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, 838 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
821 const Bytecode& bytecode); 839 const Bytecode& bytecode);
822 840
823 } // namespace interpreter 841 } // namespace interpreter
824 } // namespace internal 842 } // namespace internal
825 } // namespace v8 843 } // namespace v8
826 844
827 #endif // V8_INTERPRETER_BYTECODES_H_ 845 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698