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 19 matching lines...) Expand all Loading... |
30 /* Loading the accumulator */ \ | 30 /* Loading the accumulator */ \ |
31 V(LdaZero, AccumulatorUse::kWrite) \ | 31 V(LdaZero, AccumulatorUse::kWrite) \ |
32 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ | 32 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ |
33 V(LdaUndefined, AccumulatorUse::kWrite) \ | 33 V(LdaUndefined, AccumulatorUse::kWrite) \ |
34 V(LdaNull, AccumulatorUse::kWrite) \ | 34 V(LdaNull, AccumulatorUse::kWrite) \ |
35 V(LdaTheHole, AccumulatorUse::kWrite) \ | 35 V(LdaTheHole, AccumulatorUse::kWrite) \ |
36 V(LdaTrue, AccumulatorUse::kWrite) \ | 36 V(LdaTrue, AccumulatorUse::kWrite) \ |
37 V(LdaFalse, AccumulatorUse::kWrite) \ | 37 V(LdaFalse, AccumulatorUse::kWrite) \ |
38 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ | 38 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ |
39 \ | 39 \ |
40 /* Loading registers */ \ | |
41 V(LdrUndefined, AccumulatorUse::kNone, OperandType::kRegOut) \ | |
42 \ | |
43 /* Globals */ \ | 40 /* Globals */ \ |
44 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx) \ | 41 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx) \ |
45 V(LdrGlobal, AccumulatorUse::kNone, OperandType::kIdx, OperandType::kRegOut) \ | |
46 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ | 42 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ |
47 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ | 43 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ |
48 OperandType::kIdx) \ | 44 OperandType::kIdx) \ |
49 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ | 45 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ |
50 OperandType::kIdx) \ | 46 OperandType::kIdx) \ |
51 \ | 47 \ |
52 /* Context operations */ \ | 48 /* Context operations */ \ |
53 V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \ | 49 V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \ |
54 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ | 50 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ |
55 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ | 51 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ |
56 OperandType::kIdx, OperandType::kUImm) \ | 52 OperandType::kIdx, OperandType::kUImm) \ |
57 V(LdaCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ | 53 V(LdaCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
58 V(LdrContextSlot, AccumulatorUse::kNone, OperandType::kReg, \ | |
59 OperandType::kIdx, OperandType::kUImm, OperandType::kRegOut) \ | |
60 V(LdrCurrentContextSlot, AccumulatorUse::kNone, OperandType::kIdx, \ | |
61 OperandType::kRegOut) \ | |
62 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ | 54 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ |
63 OperandType::kIdx, OperandType::kUImm) \ | 55 OperandType::kIdx, OperandType::kUImm) \ |
64 V(StaCurrentContextSlot, AccumulatorUse::kRead, OperandType::kIdx) \ | 56 V(StaCurrentContextSlot, AccumulatorUse::kRead, OperandType::kIdx) \ |
65 \ | 57 \ |
66 /* Load-Store lookup slots */ \ | 58 /* Load-Store lookup slots */ \ |
67 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ | 59 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
68 V(LdaLookupContextSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ | 60 V(LdaLookupContextSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ |
69 OperandType::kIdx, OperandType::kUImm) \ | 61 OperandType::kIdx, OperandType::kUImm) \ |
70 V(LdaLookupGlobalSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ | 62 V(LdaLookupGlobalSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ |
71 OperandType::kIdx, OperandType::kUImm) \ | 63 OperandType::kIdx, OperandType::kUImm) \ |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 415 } |
424 | 416 |
425 // Return true if |bytecode| is an accumulator load without effects, | 417 // Return true if |bytecode| is an accumulator load without effects, |
426 // e.g. LdaConstant, LdaTrue, Ldar. | 418 // e.g. LdaConstant, LdaTrue, Ldar. |
427 static CONSTEXPR bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) { | 419 static CONSTEXPR bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) { |
428 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kLdaZero || | 420 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kLdaZero || |
429 bytecode == Bytecode::kLdaSmi || bytecode == Bytecode::kLdaNull || | 421 bytecode == Bytecode::kLdaSmi || bytecode == Bytecode::kLdaNull || |
430 bytecode == Bytecode::kLdaTrue || bytecode == Bytecode::kLdaFalse || | 422 bytecode == Bytecode::kLdaTrue || bytecode == Bytecode::kLdaFalse || |
431 bytecode == Bytecode::kLdaUndefined || | 423 bytecode == Bytecode::kLdaUndefined || |
432 bytecode == Bytecode::kLdaTheHole || | 424 bytecode == Bytecode::kLdaTheHole || |
433 bytecode == Bytecode::kLdaConstant; | 425 bytecode == Bytecode::kLdaConstant || |
| 426 bytecode == Bytecode::kLdaContextSlot || |
| 427 bytecode == Bytecode::kLdaCurrentContextSlot; |
434 } | 428 } |
435 | 429 |
436 // Return true if |bytecode| is a register load without effects, | 430 // Return true if |bytecode| is a register load without effects, |
437 // e.g. Mov, Star, LdrUndefined. | 431 // e.g. Mov, Star. |
438 static CONSTEXPR bool IsRegisterLoadWithoutEffects(Bytecode bytecode) { | 432 static CONSTEXPR bool IsRegisterLoadWithoutEffects(Bytecode bytecode) { |
439 return bytecode == Bytecode::kMov || bytecode == Bytecode::kPopContext || | 433 return bytecode == Bytecode::kMov || bytecode == Bytecode::kPopContext || |
440 bytecode == Bytecode::kPushContext || bytecode == Bytecode::kStar || | 434 bytecode == Bytecode::kPushContext || bytecode == Bytecode::kStar; |
441 bytecode == Bytecode::kLdrUndefined; | |
442 } | 435 } |
443 | 436 |
444 // Returns true if the bytecode is a conditional jump taking | 437 // Returns true if the bytecode is a conditional jump taking |
445 // an immediate byte operand (OperandType::kImm). | 438 // an immediate byte operand (OperandType::kImm). |
446 static CONSTEXPR bool IsConditionalJumpImmediate(Bytecode bytecode) { | 439 static CONSTEXPR bool IsConditionalJumpImmediate(Bytecode bytecode) { |
447 return bytecode == Bytecode::kJumpIfTrue || | 440 return bytecode == Bytecode::kJumpIfTrue || |
448 bytecode == Bytecode::kJumpIfFalse || | 441 bytecode == Bytecode::kJumpIfFalse || |
449 bytecode == Bytecode::kJumpIfToBooleanTrue || | 442 bytecode == Bytecode::kJumpIfToBooleanTrue || |
450 bytecode == Bytecode::kJumpIfToBooleanFalse || | 443 bytecode == Bytecode::kJumpIfToBooleanFalse || |
451 bytecode == Bytecode::kJumpIfNotHole || | 444 bytecode == Bytecode::kJumpIfNotHole || |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 #undef CONSTEXPR | 735 #undef CONSTEXPR |
743 | 736 |
744 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 737 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
745 const Bytecode& bytecode); | 738 const Bytecode& bytecode); |
746 | 739 |
747 } // namespace interpreter | 740 } // namespace interpreter |
748 } // namespace internal | 741 } // namespace internal |
749 } // namespace v8 | 742 } // namespace v8 |
750 | 743 |
751 #endif // V8_INTERPRETER_BYTECODES_H_ | 744 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |