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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 const uword start_; | 63 const uword start_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); | 65 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); |
66 }; | 66 }; |
67 | 67 |
68 | 68 |
69 // 5 byte call instruction. | |
70 class ShortCallPattern : public InstructionPattern<ShortCallPattern> { | |
71 public: | |
72 explicit ShortCallPattern(uword pc) : InstructionPattern(pc) {} | |
73 | |
74 void SetTargetAddress(uword new_target) const; | |
75 | |
76 static int pattern_length_in_bytes() { return kLengthInBytes; } | |
77 static const int* pattern() { | |
78 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; | |
79 return kCallPattern; | |
80 } | |
81 | |
82 private: | |
83 static const int kLengthInBytes = 5; | |
84 DISALLOW_COPY_AND_ASSIGN(ShortCallPattern); | |
85 }; | |
86 | |
87 | |
88 class ReturnPattern : public InstructionPattern<ReturnPattern> { | 69 class ReturnPattern : public InstructionPattern<ReturnPattern> { |
89 public: | 70 public: |
90 explicit ReturnPattern(uword pc) : InstructionPattern(pc) {} | 71 explicit ReturnPattern(uword pc) : InstructionPattern(pc) {} |
91 | 72 |
92 static const int* pattern() { | 73 static const int* pattern() { |
93 static const int kReturnPattern[kLengthInBytes] = { 0xC3 }; | 74 static const int kReturnPattern[kLengthInBytes] = { 0xC3 }; |
94 return kReturnPattern; | 75 return kReturnPattern; |
95 } | 76 } |
96 | 77 |
97 static int pattern_length_in_bytes() { return kLengthInBytes; } | 78 static int pattern_length_in_bytes() { return kLengthInBytes; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 115 |
135 static int pattern_length_in_bytes() { return kLengthInBytes; } | 116 static int pattern_length_in_bytes() { return kLengthInBytes; } |
136 | 117 |
137 private: | 118 private: |
138 static const int kLengthInBytes = 3; | 119 static const int kLengthInBytes = 3; |
139 }; | 120 }; |
140 | 121 |
141 } // namespace dart | 122 } // namespace dart |
142 | 123 |
143 #endif // VM_INSTRUCTIONS_X64_H_ | 124 #endif // VM_INSTRUCTIONS_X64_H_ |
OLD | NEW |