| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 V(TypeOf, AccumulatorUse::kReadWrite) \ | 147 V(TypeOf, AccumulatorUse::kReadWrite) \ |
| 148 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 148 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 149 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 149 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 150 \ | 150 \ |
| 151 /* GetSuperConstructor operator */ \ | 151 /* GetSuperConstructor operator */ \ |
| 152 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ | 152 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 153 \ | 153 \ |
| 154 /* Call operations */ \ | 154 /* Call operations */ \ |
| 155 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ | 155 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ |
| 156 OperandType::kRegCount, OperandType::kIdx) \ | 156 OperandType::kRegCount, OperandType::kIdx) \ |
| 157 V(Call0, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 158 OperandType::kIdx) \ |
| 159 V(Call1, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 160 OperandType::kReg, OperandType::kIdx) \ |
| 161 V(Call2, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 162 OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ |
| 157 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ | 163 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 158 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 164 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 165 V(CallProperty0, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 166 OperandType::kReg, OperandType::kIdx) \ |
| 167 V(CallProperty1, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 168 OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ |
| 169 V(CallProperty2, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 170 OperandType::kReg, OperandType::kReg, OperandType::kReg, \ |
| 171 OperandType::kIdx) \ |
| 159 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ | 172 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 160 OperandType::kRegList, OperandType::kRegCount) \ | 173 OperandType::kRegList, OperandType::kRegCount) \ |
| 161 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ | 174 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 162 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 175 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 163 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ | 176 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ |
| 164 OperandType::kRegList, OperandType::kRegCount) \ | 177 OperandType::kRegList, OperandType::kRegCount) \ |
| 165 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ | 178 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ |
| 166 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ | 179 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ |
| 167 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ | 180 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 168 OperandType::kRegList, OperandType::kRegCount) \ | 181 OperandType::kRegList, OperandType::kRegCount) \ |
| (...skipping 229 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 } | 624 } |
| 612 | 625 |
| 613 // Returns true if |bytecode| puts a name in the accumulator. | 626 // Returns true if |bytecode| puts a name in the accumulator. |
| 614 static constexpr bool PutsNameInAccumulator(Bytecode bytecode) { | 627 static constexpr bool PutsNameInAccumulator(Bytecode bytecode) { |
| 615 return bytecode == Bytecode::kTypeOf; | 628 return bytecode == Bytecode::kTypeOf; |
| 616 } | 629 } |
| 617 | 630 |
| 618 // Returns true if the bytecode is a call or a constructor call. | 631 // Returns true if the bytecode is a call or a constructor call. |
| 619 static constexpr bool IsCallOrConstruct(Bytecode bytecode) { | 632 static constexpr bool IsCallOrConstruct(Bytecode bytecode) { |
| 620 return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty || | 633 return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty || |
| 634 bytecode == Bytecode::kCall0 || |
| 635 bytecode == Bytecode::kCallProperty0 || |
| 636 bytecode == Bytecode::kCall1 || |
| 637 bytecode == Bytecode::kCallProperty1 || |
| 638 bytecode == Bytecode::kCall2 || |
| 639 bytecode == Bytecode::kCallProperty2 || |
| 621 bytecode == Bytecode::kTailCall || | 640 bytecode == Bytecode::kTailCall || |
| 622 bytecode == Bytecode::kConstruct || | 641 bytecode == Bytecode::kConstruct || |
| 623 bytecode == Bytecode::kCallWithSpread || | 642 bytecode == Bytecode::kCallWithSpread || |
| 624 bytecode == Bytecode::kConstructWithSpread || | 643 bytecode == Bytecode::kConstructWithSpread || |
| 625 bytecode == Bytecode::kInvokeIntrinsic || | 644 bytecode == Bytecode::kInvokeIntrinsic || |
| 626 bytecode == Bytecode::kCallJSRuntime; | 645 bytecode == Bytecode::kCallJSRuntime; |
| 627 } | 646 } |
| 628 | 647 |
| 629 // Returns true if the bytecode is a call to the runtime. | 648 // Returns true if the bytecode is a call to the runtime. |
| 630 static constexpr bool IsCallRuntime(Bytecode bytecode) { | 649 static constexpr bool IsCallRuntime(Bytecode bytecode) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 }; | 850 }; |
| 832 | 851 |
| 833 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 852 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
| 834 const Bytecode& bytecode); | 853 const Bytecode& bytecode); |
| 835 | 854 |
| 836 } // namespace interpreter | 855 } // namespace interpreter |
| 837 } // namespace internal | 856 } // namespace internal |
| 838 } // namespace v8 | 857 } // namespace v8 |
| 839 | 858 |
| 840 #endif // V8_INTERPRETER_BYTECODES_H_ | 859 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |