| 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 <iosfwd> | 8 #include <iosfwd> |
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 /* Loading the accumulator */ \ | 81 /* Loading the accumulator */ \ |
| 82 V(LdaZero, AccumulatorUse::kWrite) \ | 82 V(LdaZero, AccumulatorUse::kWrite) \ |
| 83 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ | 83 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ |
| 84 V(LdaUndefined, AccumulatorUse::kWrite) \ | 84 V(LdaUndefined, AccumulatorUse::kWrite) \ |
| 85 V(LdaNull, AccumulatorUse::kWrite) \ | 85 V(LdaNull, AccumulatorUse::kWrite) \ |
| 86 V(LdaTheHole, AccumulatorUse::kWrite) \ | 86 V(LdaTheHole, AccumulatorUse::kWrite) \ |
| 87 V(LdaTrue, AccumulatorUse::kWrite) \ | 87 V(LdaTrue, AccumulatorUse::kWrite) \ |
| 88 V(LdaFalse, AccumulatorUse::kWrite) \ | 88 V(LdaFalse, AccumulatorUse::kWrite) \ |
| 89 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ | 89 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 90 \ | 90 \ |
| 91 /* Loading registers */ \ |
| 92 V(LdrUndefined, AccumulatorUse::kNone, OperandType::kRegOut) \ |
| 93 \ |
| 91 /* Globals */ \ | 94 /* Globals */ \ |
| 92 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \ | 95 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \ |
| 96 V(LdrGlobal, AccumulatorUse::kNone, OperandType::kIdx, OperandType::kIdx, \ |
| 97 OperandType::kRegOut) \ |
| 93 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \ | 98 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 94 OperandType::kIdx) \ | 99 OperandType::kIdx) \ |
| 95 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ | 100 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ |
| 96 OperandType::kIdx) \ | 101 OperandType::kIdx) \ |
| 97 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ | 102 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ |
| 98 OperandType::kIdx) \ | 103 OperandType::kIdx) \ |
| 99 \ | 104 \ |
| 100 /* Context operations */ \ | 105 /* Context operations */ \ |
| 101 V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \ | 106 V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 102 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ | 107 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ |
| 103 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ | 108 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 104 OperandType::kIdx) \ | 109 OperandType::kIdx) \ |
| 110 V(LdrContextSlot, AccumulatorUse::kNone, OperandType::kReg, \ |
| 111 OperandType::kIdx, OperandType::kRegOut) \ |
| 105 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ | 112 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ |
| 106 OperandType::kIdx) \ | 113 OperandType::kIdx) \ |
| 107 \ | 114 \ |
| 108 /* Load-Store lookup slots */ \ | 115 /* Load-Store lookup slots */ \ |
| 109 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ | 116 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 110 V(LdaLookupSlotInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ | 117 V(LdaLookupSlotInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 111 V(StaLookupSlotSloppy, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 118 V(StaLookupSlotSloppy, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 112 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 119 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 113 \ | 120 \ |
| 114 /* Register-accumulator transfers */ \ | 121 /* Register-accumulator transfers */ \ |
| 115 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ | 122 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 116 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ | 123 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 117 \ | 124 \ |
| 118 /* Register-register transfers */ \ | 125 /* Register-register transfers */ \ |
| 119 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ | 126 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ |
| 120 \ | 127 \ |
| 121 /* LoadIC operations */ \ | 128 /* LoadIC operations */ \ |
| 122 V(LoadIC, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kIdx, \ | 129 V(LoadIC, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kIdx, \ |
| 123 OperandType::kIdx) \ | 130 OperandType::kIdx) \ |
| 131 V(LdrNamedProperty, AccumulatorUse::kNone, OperandType::kReg, \ |
| 132 OperandType::kIdx, OperandType::kIdx, OperandType::kRegOut) \ |
| 124 V(KeyedLoadIC, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 133 V(KeyedLoadIC, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 125 OperandType::kIdx) \ | 134 OperandType::kIdx) \ |
| 135 V(LdrKeyedProperty, AccumulatorUse::kRead, OperandType::kReg, \ |
| 136 OperandType::kIdx, OperandType::kRegOut) \ |
| 126 \ | 137 \ |
| 127 /* StoreIC operations */ \ | 138 /* StoreIC operations */ \ |
| 128 V(StoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ | 139 V(StoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 129 OperandType::kIdx, OperandType::kIdx) \ | 140 OperandType::kIdx, OperandType::kIdx) \ |
| 130 V(StoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ | 141 V(StoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 131 OperandType::kIdx, OperandType::kIdx) \ | 142 OperandType::kIdx, OperandType::kIdx) \ |
| 132 V(KeyedStoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ | 143 V(KeyedStoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 133 OperandType::kReg, OperandType::kIdx) \ | 144 OperandType::kReg, OperandType::kIdx) \ |
| 134 V(KeyedStoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ | 145 V(KeyedStoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 135 OperandType::kReg, OperandType::kIdx) \ | 146 OperandType::kReg, OperandType::kIdx) \ |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // Returns string representation of |operand_type|. | 446 // Returns string representation of |operand_type|. |
| 436 static const char* OperandTypeToString(OperandType operand_type); | 447 static const char* OperandTypeToString(OperandType operand_type); |
| 437 | 448 |
| 438 // Returns string representation of |operand_scale|. | 449 // Returns string representation of |operand_scale|. |
| 439 static const char* OperandScaleToString(OperandScale operand_scale); | 450 static const char* OperandScaleToString(OperandScale operand_scale); |
| 440 | 451 |
| 441 // Returns string representation of |operand_size|. | 452 // Returns string representation of |operand_size|. |
| 442 static const char* OperandSizeToString(OperandSize operand_size); | 453 static const char* OperandSizeToString(OperandSize operand_size); |
| 443 | 454 |
| 444 // Returns byte value of bytecode. | 455 // Returns byte value of bytecode. |
| 445 static uint8_t ToByte(Bytecode bytecode); | 456 static uint8_t ToByte(Bytecode bytecode) { |
| 457 DCHECK_LE(bytecode, Bytecode::kLast); |
| 458 return static_cast<uint8_t>(bytecode); |
| 459 } |
| 446 | 460 |
| 447 // Returns bytecode for |value|. | 461 // Returns bytecode for |value|. |
| 448 static Bytecode FromByte(uint8_t value); | 462 static Bytecode FromByte(uint8_t value); |
| 449 | 463 |
| 450 // Returns the number of operands expected by |bytecode|. | 464 // Returns the number of operands expected by |bytecode|. |
| 451 static int NumberOfOperands(Bytecode bytecode); | 465 static int NumberOfOperands(Bytecode bytecode); |
| 452 | 466 |
| 453 // Returns the number of register operands expected by |bytecode|. | 467 // Returns the number of register operands expected by |bytecode|. |
| 454 static int NumberOfRegisterOperands(Bytecode bytecode); | 468 static int NumberOfRegisterOperands(Bytecode bytecode); |
| 455 | 469 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | 663 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); |
| 650 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 664 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
| 651 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 665 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
| 652 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 666 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
| 653 | 667 |
| 654 } // namespace interpreter | 668 } // namespace interpreter |
| 655 } // namespace internal | 669 } // namespace internal |
| 656 } // namespace v8 | 670 } // namespace v8 |
| 657 | 671 |
| 658 #endif // V8_INTERPRETER_BYTECODES_H_ | 672 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |