| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_CONSTANTS_X64_H_ | 5 #ifndef VM_CONSTANTS_X64_H_ |
| 6 #define VM_CONSTANTS_X64_H_ | 6 #define VM_CONSTANTS_X64_H_ |
| 7 | 7 |
| 8 namespace dart { | 8 namespace dart { |
| 9 | 9 |
| 10 enum Register { | 10 enum Register { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 R10 = 10, | 21 R10 = 10, |
| 22 R11 = 11, | 22 R11 = 11, |
| 23 R12 = 12, | 23 R12 = 12, |
| 24 R13 = 13, | 24 R13 = 13, |
| 25 R14 = 14, | 25 R14 = 14, |
| 26 R15 = 15, | 26 R15 = 15, |
| 27 kNumberOfCpuRegisters = 16, | 27 kNumberOfCpuRegisters = 16, |
| 28 kNoRegister = -1 // Signals an illegal register. | 28 kNoRegister = -1 // Signals an illegal register. |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 |
| 32 enum ByteRegister { |
| 33 AL = 0, |
| 34 CL = 1, |
| 35 DL = 2, |
| 36 BL = 3, |
| 37 AH = 4, |
| 38 CH = 5, |
| 39 DH = 6, |
| 40 BH = 7, |
| 41 kNoByteRegister = -1 // Signals an illegal register. |
| 42 }; |
| 43 |
| 44 |
| 45 enum XmmRegister { |
| 46 XMM0 = 0, |
| 47 XMM1 = 1, |
| 48 XMM2 = 2, |
| 49 XMM3 = 3, |
| 50 XMM4 = 4, |
| 51 XMM5 = 5, |
| 52 XMM6 = 6, |
| 53 XMM7 = 7, |
| 54 kNumberOfXmmRegisters = 8, |
| 55 kNoXmmRegister = -1 // Signals an illegal register. |
| 56 }; |
| 57 |
| 58 |
| 59 // Register aliases. |
| 60 const Register CTX = R12; // Caches current context in generated code. |
| 61 |
| 62 // Exception object is passed in this register to the catch handlers when an |
| 63 // exception is thrown. |
| 64 const Register kExceptionObjectReg = RAX; |
| 65 |
| 66 // Stack trace object is passed in this register to the catch handlers when |
| 67 // an exception is thrown. |
| 68 const Register kStackTraceObjectReg = RDX; |
| 69 |
| 70 enum ScaleFactor { |
| 71 TIMES_1 = 0, |
| 72 TIMES_2 = 1, |
| 73 TIMES_4 = 2, |
| 74 TIMES_8 = 3 |
| 75 }; |
| 76 |
| 77 |
| 78 enum Condition { |
| 79 OVERFLOW = 0, |
| 80 NO_OVERFLOW = 1, |
| 81 BELOW = 2, |
| 82 ABOVE_EQUAL = 3, |
| 83 EQUAL = 4, |
| 84 NOT_EQUAL = 5, |
| 85 BELOW_EQUAL = 6, |
| 86 ABOVE = 7, |
| 87 SIGN = 8, |
| 88 NOT_SIGN = 9, |
| 89 PARITY_EVEN = 10, |
| 90 PARITY_ODD = 11, |
| 91 LESS = 12, |
| 92 GREATER_EQUAL = 13, |
| 93 LESS_EQUAL = 14, |
| 94 GREATER = 15, |
| 95 |
| 96 ZERO = EQUAL, |
| 97 NOT_ZERO = NOT_EQUAL, |
| 98 NEGATIVE = SIGN, |
| 99 POSITIVE = NOT_SIGN |
| 100 }; |
| 101 |
| 102 |
| 103 class Instr { |
| 104 public: |
| 105 static const uint8_t kHltInstruction = 0xF4; |
| 106 // We prefer not to use the int3 instruction since it conflicts with gdb. |
| 107 static const uint8_t kBreakPointInstruction = kHltInstruction; |
| 108 static const int kBreakPointInstructionSize = 1; |
| 109 |
| 110 bool IsBreakPoint() { |
| 111 ASSERT(kBreakPointInstructionSize == 1); |
| 112 return (*reinterpret_cast<const uint8_t*>(this)) == kBreakPointInstruction; |
| 113 } |
| 114 |
| 115 // Instructions are read out of a code stream. The only way to get a |
| 116 // reference to an instruction is to convert a pointer. There is no way |
| 117 // to allocate or create instances of class Instr. |
| 118 // Use the At(pc) function to create references to Instr. |
| 119 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 120 |
| 121 private: |
| 122 DISALLOW_ALLOCATION(); |
| 123 // We need to prevent the creation of instances of class Instr. |
| 124 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 125 }; |
| 126 |
| 31 } // namespace dart | 127 } // namespace dart |
| 32 | 128 |
| 33 #endif // VM_CONSTANTS_X64_H_ | 129 #endif // VM_CONSTANTS_X64_H_ |
| OLD | NEW |