| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Classes that describe assembly patterns as used by inline caches. | 4 // Classes that describe assembly patterns as used by inline caches. |
| 5 | 5 |
| 6 #ifndef VM_INSTRUCTIONS_X64_H_ | 6 #ifndef VM_INSTRUCTIONS_X64_H_ |
| 7 #define VM_INSTRUCTIONS_X64_H_ | 7 #define VM_INSTRUCTIONS_X64_H_ |
| 8 | 8 |
| 9 #ifndef VM_INSTRUCTIONS_H_ | 9 #ifndef VM_INSTRUCTIONS_H_ |
| 10 #error Do not include instructions_ia32.h directly; use instructions.h instead. | 10 #error Do not include instructions_ia32.h directly; use instructions.h instead. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 return true; | 59 return true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 const uword start_; | 62 const uword start_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); | 64 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 | 67 |
| 68 class JumpPattern : public InstructionPattern<JumpPattern> { | |
| 69 public: | |
| 70 JumpPattern(uword pc, const Code& code) | |
| 71 : InstructionPattern(pc), | |
| 72 object_pool_(ObjectPool::Handle(code.GetObjectPool())) {} | |
| 73 | |
| 74 uword TargetAddress() const; | |
| 75 void SetTargetAddress(uword new_target) const; | |
| 76 | |
| 77 static const int kLengthInBytes = 7; | |
| 78 static int pattern_length_in_bytes() { return kLengthInBytes; } | |
| 79 static const int* pattern() { | |
| 80 // 07: 41 ff a7 imm32 jmpq [reg + off] | |
| 81 static const int kJumpPattern[kLengthInBytes] = | |
| 82 {0x41, 0xFF, -1, -1, -1, -1, -1}; | |
| 83 return kJumpPattern; | |
| 84 } | |
| 85 private: | |
| 86 const ObjectPool& object_pool_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(JumpPattern); | |
| 89 }; | |
| 90 | |
| 91 | |
| 92 // 5 byte call instruction. | 68 // 5 byte call instruction. |
| 93 class ShortCallPattern : public InstructionPattern<ShortCallPattern> { | 69 class ShortCallPattern : public InstructionPattern<ShortCallPattern> { |
| 94 public: | 70 public: |
| 95 explicit ShortCallPattern(uword pc) : InstructionPattern(pc) {} | 71 explicit ShortCallPattern(uword pc) : InstructionPattern(pc) {} |
| 96 | 72 |
| 97 void SetTargetAddress(uword new_target) const; | 73 void SetTargetAddress(uword new_target) const; |
| 98 | 74 |
| 99 static int pattern_length_in_bytes() { return kLengthInBytes; } | 75 static int pattern_length_in_bytes() { return kLengthInBytes; } |
| 100 static const int* pattern() { | 76 static const int* pattern() { |
| 101 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; | 77 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 133 |
| 158 static int pattern_length_in_bytes() { return kLengthInBytes; } | 134 static int pattern_length_in_bytes() { return kLengthInBytes; } |
| 159 | 135 |
| 160 private: | 136 private: |
| 161 static const int kLengthInBytes = 3; | 137 static const int kLengthInBytes = 3; |
| 162 }; | 138 }; |
| 163 | 139 |
| 164 } // namespace dart | 140 } // namespace dart |
| 165 | 141 |
| 166 #endif // VM_INSTRUCTIONS_X64_H_ | 142 #endif // VM_INSTRUCTIONS_X64_H_ |
| OLD | NEW |