| OLD | NEW |
| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 V(TypeOf, AccumulatorUse::kReadWrite) \ | 145 V(TypeOf, AccumulatorUse::kReadWrite) \ |
| 146 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 146 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 147 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 147 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 148 \ | 148 \ |
| 149 /* GetSuperConstructor operator */ \ | 149 /* GetSuperConstructor operator */ \ |
| 150 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ | 150 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 151 \ | 151 \ |
| 152 /* Call operations */ \ | 152 /* Call operations */ \ |
| 153 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ | 153 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ |
| 154 OperandType::kRegCount, OperandType::kIdx) \ | 154 OperandType::kRegCount, OperandType::kIdx) \ |
| 155 V(Call0, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 156 OperandType::kIdx) \ |
| 157 V(Call1, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 158 OperandType::kReg, OperandType::kIdx) \ |
| 159 V(Call2, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 160 OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ |
| 155 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ | 161 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 156 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 162 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 163 V(CallProperty0, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 164 OperandType::kReg, OperandType::kIdx) \ |
| 165 V(CallProperty1, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 166 OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ |
| 167 V(CallProperty2, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 168 OperandType::kReg, OperandType::kReg, OperandType::kReg, \ |
| 169 OperandType::kIdx) \ |
| 157 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ | 170 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 158 OperandType::kRegList, OperandType::kRegCount) \ | 171 OperandType::kRegList, OperandType::kRegCount) \ |
| 159 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ | 172 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 160 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 173 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 161 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ | 174 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ |
| 162 OperandType::kRegList, OperandType::kRegCount) \ | 175 OperandType::kRegList, OperandType::kRegCount) \ |
| 163 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ | 176 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ |
| 164 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ | 177 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ |
| 165 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ | 178 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 166 OperandType::kRegList, OperandType::kRegCount) \ | 179 OperandType::kRegList, OperandType::kRegCount) \ |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 #define COUNT_BYTECODE(x, ...) +1 | 411 #define COUNT_BYTECODE(x, ...) +1 |
| 399 // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will | 412 // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will |
| 400 // evaluate to the same value as the last real bytecode. | 413 // evaluate to the same value as the last real bytecode. |
| 401 kLast = -1 BYTECODE_LIST(COUNT_BYTECODE) | 414 kLast = -1 BYTECODE_LIST(COUNT_BYTECODE) |
| 402 #undef COUNT_BYTECODE | 415 #undef COUNT_BYTECODE |
| 403 }; | 416 }; |
| 404 | 417 |
| 405 class V8_EXPORT_PRIVATE Bytecodes final { | 418 class V8_EXPORT_PRIVATE Bytecodes final { |
| 406 public: | 419 public: |
| 407 // The maximum number of operands a bytecode may have. | 420 // The maximum number of operands a bytecode may have. |
| 408 static const int kMaxOperands = 4; | 421 static const int kMaxOperands = 5; |
| 409 | 422 |
| 410 // Returns string representation of |bytecode|. | 423 // Returns string representation of |bytecode|. |
| 411 static const char* ToString(Bytecode bytecode); | 424 static const char* ToString(Bytecode bytecode); |
| 412 | 425 |
| 413 // Returns string representation of |bytecode|. | 426 // Returns string representation of |bytecode|. |
| 414 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); | 427 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); |
| 415 | 428 |
| 416 // Returns byte value of bytecode. | 429 // Returns byte value of bytecode. |
| 417 static uint8_t ToByte(Bytecode bytecode) { | 430 static uint8_t ToByte(Bytecode bytecode) { |
| 418 DCHECK_LE(bytecode, Bytecode::kLast); | 431 DCHECK_LE(bytecode, Bytecode::kLast); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 625 } |
| 613 | 626 |
| 614 // Returns true if |bytecode| puts a name in the accumulator. | 627 // Returns true if |bytecode| puts a name in the accumulator. |
| 615 static constexpr bool PutsNameInAccumulator(Bytecode bytecode) { | 628 static constexpr bool PutsNameInAccumulator(Bytecode bytecode) { |
| 616 return bytecode == Bytecode::kTypeOf; | 629 return bytecode == Bytecode::kTypeOf; |
| 617 } | 630 } |
| 618 | 631 |
| 619 // Returns true if the bytecode is a call or a constructor call. | 632 // Returns true if the bytecode is a call or a constructor call. |
| 620 static constexpr bool IsCallOrConstruct(Bytecode bytecode) { | 633 static constexpr bool IsCallOrConstruct(Bytecode bytecode) { |
| 621 return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty || | 634 return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty || |
| 635 bytecode == Bytecode::kCall0 || |
| 636 bytecode == Bytecode::kCallProperty0 || |
| 637 bytecode == Bytecode::kCall1 || |
| 638 bytecode == Bytecode::kCallProperty1 || |
| 639 bytecode == Bytecode::kCall2 || |
| 640 bytecode == Bytecode::kCallProperty2 || |
| 622 bytecode == Bytecode::kTailCall || | 641 bytecode == Bytecode::kTailCall || |
| 623 bytecode == Bytecode::kConstruct || | 642 bytecode == Bytecode::kConstruct || |
| 624 bytecode == Bytecode::kCallWithSpread || | 643 bytecode == Bytecode::kCallWithSpread || |
| 625 bytecode == Bytecode::kConstructWithSpread || | 644 bytecode == Bytecode::kConstructWithSpread || |
| 626 bytecode == Bytecode::kInvokeIntrinsic || | 645 bytecode == Bytecode::kInvokeIntrinsic || |
| 627 bytecode == Bytecode::kCallJSRuntime; | 646 bytecode == Bytecode::kCallJSRuntime; |
| 628 } | 647 } |
| 629 | 648 |
| 630 // Returns true if the bytecode is a call to the runtime. | 649 // Returns true if the bytecode is a call to the runtime. |
| 631 static constexpr bool IsCallRuntime(Bytecode bytecode) { | 650 static constexpr bool IsCallRuntime(Bytecode bytecode) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 }; | 851 }; |
| 833 | 852 |
| 834 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 853 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
| 835 const Bytecode& bytecode); | 854 const Bytecode& bytecode); |
| 836 | 855 |
| 837 } // namespace interpreter | 856 } // namespace interpreter |
| 838 } // namespace internal | 857 } // namespace internal |
| 839 } // namespace v8 | 858 } // namespace v8 |
| 840 | 859 |
| 841 #endif // V8_INTERPRETER_BYTECODES_H_ | 860 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |