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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // array of integers 'data'. 'data' elements are either a byte or -1, which | 49 // array of integers 'data'. 'data' elements are either a byte or -1, which |
50 // represents any byte. | 50 // represents any byte. |
51 bool TestBytesWith(const int* data, int num_bytes) const; | 51 bool TestBytesWith(const int* data, int num_bytes) const; |
52 | 52 |
53 const uword start_; | 53 const uword start_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); | 55 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); |
56 }; | 56 }; |
57 | 57 |
58 | 58 |
59 class CallPattern : public InstructionPattern { | |
60 public: | |
61 CallPattern(uword pc, const Code& code) | |
62 : InstructionPattern(pc), | |
63 code_(code) {} | |
64 static int InstructionLength() { | |
65 return kLengthInBytes; | |
66 } | |
67 uword TargetAddress() const; | |
68 void SetTargetAddress(uword new_target) const; | |
69 virtual int pattern_length_in_bytes() const { | |
70 return kLengthInBytes; | |
71 } | |
72 | |
73 private: | |
74 static const int kLengthInBytes = 13; | |
75 virtual const int* pattern() const; | |
76 const Code& code_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(CallPattern); | |
79 }; | |
80 | |
81 | |
82 class JumpPattern : public InstructionPattern { | 59 class JumpPattern : public InstructionPattern { |
83 public: | 60 public: |
84 JumpPattern(uword pc, const Code& code) | 61 JumpPattern(uword pc, const Code& code) |
85 : InstructionPattern(pc), | 62 : InstructionPattern(pc), |
86 object_pool_(Array::Handle(code.ObjectPool())) {} | 63 object_pool_(Array::Handle(code.ObjectPool())) {} |
87 static int InstructionLength() { | 64 static int InstructionLength() { |
88 return kLengthInBytes; | 65 return kLengthInBytes; |
89 } | 66 } |
90 uword TargetAddress() const; | 67 uword TargetAddress() const; |
91 void SetTargetAddress(uword new_target) const; | 68 void SetTargetAddress(uword new_target) const; |
92 virtual int pattern_length_in_bytes() const { | 69 virtual int pattern_length_in_bytes() const { |
93 return kLengthInBytes; | 70 return kLengthInBytes; |
94 } | 71 } |
95 | 72 |
| 73 static const int kLengthInBytes = 7; |
96 private: | 74 private: |
97 static const int kLengthInBytes = 10; | |
98 virtual const int* pattern() const; | 75 virtual const int* pattern() const; |
99 const Array& object_pool_; | 76 const Array& object_pool_; |
100 | 77 |
101 DISALLOW_COPY_AND_ASSIGN(JumpPattern); | 78 DISALLOW_COPY_AND_ASSIGN(JumpPattern); |
102 }; | 79 }; |
103 | 80 |
104 | 81 |
105 // 5 byte call instruction. | 82 // 5 byte call instruction. |
106 class ShortCallPattern : public InstructionPattern { | 83 class ShortCallPattern : public InstructionPattern { |
107 public: | 84 public: |
(...skipping 12 matching lines...) Expand all Loading... |
120 static const int kLengthInBytes = 5; | 97 static const int kLengthInBytes = 5; |
121 virtual const int* pattern() const; | 98 virtual const int* pattern() const; |
122 | 99 |
123 DISALLOW_COPY_AND_ASSIGN(ShortCallPattern); | 100 DISALLOW_COPY_AND_ASSIGN(ShortCallPattern); |
124 }; | 101 }; |
125 | 102 |
126 | 103 |
127 } // namespace dart | 104 } // namespace dart |
128 | 105 |
129 #endif // VM_INSTRUCTIONS_X64_H_ | 106 #endif // VM_INSTRUCTIONS_X64_H_ |
OLD | NEW |