Chromium Code Reviews| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 112 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 113 \ | 113 \ |
| 114 /* Register-accumulator transfers */ \ | 114 /* Register-accumulator transfers */ \ |
| 115 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ | 115 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 116 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ | 116 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 117 \ | 117 \ |
| 118 /* Register-register transfers */ \ | 118 /* Register-register transfers */ \ |
| 119 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ | 119 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ |
| 120 \ | 120 \ |
| 121 /* LoadIC operations */ \ | 121 /* LoadIC operations */ \ |
| 122 V(LoadIC, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kIdx, \ | 122 V(LdaNamedProperty, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 123 OperandType::kIdx) \ | 123 OperandType::kIdx, OperandType::kIdx) \ |
| 124 V(KeyedLoadIC, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 124 V(LdaKeyedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 125 OperandType::kIdx) \ | 125 OperandType::kIdx) \ |
| 126 \ | 126 \ |
| 127 /* StoreIC operations */ \ | 127 /* StoreIC operations */ \ |
| 128 V(StoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ | 128 V(StaNamedPropertySloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 129 OperandType::kIdx, OperandType::kIdx) \ | 129 OperandType::kIdx, OperandType::kIdx) \ |
| 130 V(StoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ | 130 V(StaNamedPropertyStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 131 OperandType::kIdx, OperandType::kIdx) \ | 131 OperandType::kIdx, OperandType::kIdx) \ |
| 132 V(KeyedStoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ | 132 V(StaKeyedPropertySloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 133 OperandType::kReg, OperandType::kIdx) \ | 133 OperandType::kReg, OperandType::kIdx) \ |
| 134 V(KeyedStoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ | 134 V(StaKeyedPropertyStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
|
rmcilroy
2016/05/18 16:09:41
Could we do this renaming in a seperate CL as well
oth
2016/05/18 20:22:25
Done.
| |
| 135 OperandType::kReg, OperandType::kIdx) \ | 135 OperandType::kReg, OperandType::kIdx) \ |
| 136 \ | 136 \ |
| 137 /* Binary Operators */ \ | 137 /* Binary Operators */ \ |
| 138 V(Add, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 138 V(Add, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 139 V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 139 V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 140 V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 140 V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 141 V(Div, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 141 V(Div, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 142 V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 142 V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 143 V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 143 V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 144 V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 144 V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 \ | 247 \ |
| 248 /* Debugger */ \ | 248 /* Debugger */ \ |
| 249 V(Debugger, AccumulatorUse::kNone) \ | 249 V(Debugger, AccumulatorUse::kNone) \ |
| 250 DEBUG_BREAK_BYTECODE_LIST(V) \ | 250 DEBUG_BREAK_BYTECODE_LIST(V) \ |
| 251 \ | 251 \ |
| 252 /* Illegal bytecode (terminates execution) */ \ | 252 /* Illegal bytecode (terminates execution) */ \ |
| 253 V(Illegal, AccumulatorUse::kNone) \ | 253 V(Illegal, AccumulatorUse::kNone) \ |
| 254 \ | 254 \ |
| 255 /* No operation (used to maintain source positions for peephole */ \ | 255 /* No operation (used to maintain source positions for peephole */ \ |
| 256 /* eliminated bytecodes). */ \ | 256 /* eliminated bytecodes). */ \ |
| 257 V(Nop, AccumulatorUse::kNone) | 257 V(Nop, AccumulatorUse::kNone) \ |
| 258 \ | |
| 259 /* Fused bytecodes emitted by the peephole optimizer. */ \ | |
| 260 V(LdrUndefined, AccumulatorUse::kNone, OperandType::kRegOut) \ | |
| 261 V(LdrContextSlot, AccumulatorUse::kNone, OperandType::kReg, \ | |
| 262 OperandType::kIdx, OperandType::kRegOut) \ | |
| 263 V(LdrGlobal, AccumulatorUse::kNone, OperandType::kIdx, OperandType::kIdx, \ | |
| 264 OperandType::kRegOut) \ | |
| 265 V(LdrNamedProperty, AccumulatorUse::kNone, OperandType::kReg, \ | |
| 266 OperandType::kIdx, OperandType::kIdx, OperandType::kRegOut) \ | |
| 267 V(LdrKeyedProperty, AccumulatorUse::kRead, OperandType::kReg, \ | |
| 268 OperandType::kIdx, OperandType::kRegOut) | |
|
rmcilroy
2016/05/17 15:49:33
I'd prefer these lived next to the Lda versions -
oth
2016/05/18 20:22:25
Done.
| |
| 258 | 269 |
| 259 enum class AccumulatorUse : uint8_t { | 270 enum class AccumulatorUse : uint8_t { |
| 260 kNone = 0, | 271 kNone = 0, |
| 261 kRead = 1 << 0, | 272 kRead = 1 << 0, |
| 262 kWrite = 1 << 1, | 273 kWrite = 1 << 1, |
| 263 kReadWrite = kRead | kWrite | 274 kReadWrite = kRead | kWrite |
| 264 }; | 275 }; |
| 265 | 276 |
| 266 V8_INLINE AccumulatorUse operator&(AccumulatorUse lhs, AccumulatorUse rhs) { | 277 V8_INLINE AccumulatorUse operator&(AccumulatorUse lhs, AccumulatorUse rhs) { |
| 267 int result = static_cast<int>(lhs) & static_cast<int>(rhs); | 278 int result = static_cast<int>(lhs) & static_cast<int>(rhs); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 // Returns string representation of |operand_type|. | 445 // Returns string representation of |operand_type|. |
| 435 static const char* OperandTypeToString(OperandType operand_type); | 446 static const char* OperandTypeToString(OperandType operand_type); |
| 436 | 447 |
| 437 // Returns string representation of |operand_scale|. | 448 // Returns string representation of |operand_scale|. |
| 438 static const char* OperandScaleToString(OperandScale operand_scale); | 449 static const char* OperandScaleToString(OperandScale operand_scale); |
| 439 | 450 |
| 440 // Returns string representation of |operand_size|. | 451 // Returns string representation of |operand_size|. |
| 441 static const char* OperandSizeToString(OperandSize operand_size); | 452 static const char* OperandSizeToString(OperandSize operand_size); |
| 442 | 453 |
| 443 // Returns byte value of bytecode. | 454 // Returns byte value of bytecode. |
| 444 static uint8_t ToByte(Bytecode bytecode); | 455 static uint8_t ToByte(Bytecode bytecode) { |
| 456 DCHECK_LE(bytecode, Bytecode::kLast); | |
| 457 return static_cast<uint8_t>(bytecode); | |
| 458 } | |
| 445 | 459 |
| 446 // Returns bytecode for |value|. | 460 // Returns bytecode for |value|. |
| 447 static Bytecode FromByte(uint8_t value); | 461 static Bytecode FromByte(uint8_t value); |
| 448 | 462 |
| 449 // Returns the number of operands expected by |bytecode|. | 463 // Returns the number of operands expected by |bytecode|. |
| 450 static int NumberOfOperands(Bytecode bytecode); | 464 static int NumberOfOperands(Bytecode bytecode); |
| 451 | 465 |
| 452 // Returns the number of register operands expected by |bytecode|. | 466 // Returns the number of register operands expected by |bytecode|. |
| 453 static int NumberOfRegisterOperands(Bytecode bytecode); | 467 static int NumberOfRegisterOperands(Bytecode bytecode); |
| 454 | 468 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | 655 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); |
| 642 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 656 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
| 643 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 657 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
| 644 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 658 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
| 645 | 659 |
| 646 } // namespace interpreter | 660 } // namespace interpreter |
| 647 } // namespace internal | 661 } // namespace internal |
| 648 } // namespace v8 | 662 } // namespace v8 |
| 649 | 663 |
| 650 #endif // V8_INTERPRETER_BYTECODES_H_ | 664 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |