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 |
68 // 5 byte call instruction. | 92 // 5 byte call instruction. |
69 class ShortCallPattern : public InstructionPattern<ShortCallPattern> { | 93 class ShortCallPattern : public InstructionPattern<ShortCallPattern> { |
70 public: | 94 public: |
71 explicit ShortCallPattern(uword pc) : InstructionPattern(pc) {} | 95 explicit ShortCallPattern(uword pc) : InstructionPattern(pc) {} |
72 | 96 |
73 void SetTargetAddress(uword new_target) const; | 97 void SetTargetAddress(uword new_target) const; |
74 | 98 |
75 static int pattern_length_in_bytes() { return kLengthInBytes; } | 99 static int pattern_length_in_bytes() { return kLengthInBytes; } |
76 static const int* pattern() { | 100 static const int* pattern() { |
77 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; | 101 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 157 |
134 static int pattern_length_in_bytes() { return kLengthInBytes; } | 158 static int pattern_length_in_bytes() { return kLengthInBytes; } |
135 | 159 |
136 private: | 160 private: |
137 static const int kLengthInBytes = 3; | 161 static const int kLengthInBytes = 3; |
138 }; | 162 }; |
139 | 163 |
140 } // namespace dart | 164 } // namespace dart |
141 | 165 |
142 #endif // VM_INSTRUCTIONS_X64_H_ | 166 #endif // VM_INSTRUCTIONS_X64_H_ |
OLD | NEW |