| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM_H_ | 6 #ifndef VM_INSTRUCTIONS_ARM_H_ |
| 7 #define VM_INSTRUCTIONS_ARM_H_ | 7 #define VM_INSTRUCTIONS_ARM_H_ |
| 8 | 8 |
| 9 #ifndef VM_INSTRUCTIONS_H_ | 9 #ifndef VM_INSTRUCTIONS_H_ |
| 10 #error Do not include instructions_arm.h directly; use instructions.h instead. | 10 #error Do not include instructions_arm.h directly; use instructions.h instead. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 intptr_t* index); | 47 intptr_t* index); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 | 50 |
| 51 class CallPattern : public ValueObject { | 51 class CallPattern : public ValueObject { |
| 52 public: | 52 public: |
| 53 CallPattern(uword pc, const Code& code); | 53 CallPattern(uword pc, const Code& code); |
| 54 | 54 |
| 55 RawICData* IcData(); | 55 RawICData* IcData(); |
| 56 | 56 |
| 57 uword TargetAddress() const; | 57 RawCode* TargetCode() const; |
| 58 void SetTargetAddress(uword target_address) const; | 58 void SetTargetCode(const Code& code) const; |
| 59 | 59 |
| 60 // This constant length is only valid for inserted call patterns used for | 60 // This constant length is only valid for inserted call patterns used for |
| 61 // lazy deoptimization. Regular call pattern may vary in length. | 61 // lazy deoptimization. Regular call pattern may vary in length. |
| 62 static int LengthInBytes(); | 62 static int DeoptCallPatternLengthInBytes(); |
| 63 | 63 |
| 64 static void InsertAt(uword pc, uword target_address); | 64 static void InsertDeoptCallAt(uword pc, uword target_address); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 const ObjectPool& object_pool_; | 67 const ObjectPool& object_pool_; |
| 68 | 68 |
| 69 uword end_; | 69 uword end_; |
| 70 uword ic_data_load_end_; | 70 uword ic_data_load_end_; |
| 71 | 71 |
| 72 intptr_t target_address_pool_index_; | 72 intptr_t target_code_pool_index_; |
| 73 ICData& ic_data_; | 73 ICData& ic_data_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(CallPattern); | 75 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 | 78 |
| 79 class NativeCallPattern : public ValueObject { | 79 class NativeCallPattern : public ValueObject { |
| 80 public: | 80 public: |
| 81 NativeCallPattern(uword pc, const Code& code); | 81 NativeCallPattern(uword pc, const Code& code); |
| 82 | 82 |
| 83 uword target() const; | 83 RawCode* target() const; |
| 84 void set_target(uword target_address) const; | 84 void set_target(const Code& target) const; |
| 85 | 85 |
| 86 NativeFunction native_function() const; | 86 NativeFunction native_function() const; |
| 87 void set_native_function(NativeFunction target) const; | 87 void set_native_function(NativeFunction target) const; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 const ObjectPool& object_pool_; | 90 const ObjectPool& object_pool_; |
| 91 | 91 |
| 92 uword end_; | 92 uword end_; |
| 93 intptr_t native_function_pool_index_; | 93 intptr_t native_function_pool_index_; |
| 94 intptr_t target_address_pool_index_; | 94 intptr_t target_code_pool_index_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); | 96 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 | 99 |
| 100 class JumpPattern : public ValueObject { | |
| 101 public: | |
| 102 JumpPattern(uword pc, const Code& code); | |
| 103 | |
| 104 static const int kLengthInBytes = 3 * Instr::kInstrSize; | |
| 105 | |
| 106 static int pattern_length_in_bytes(); | |
| 107 | |
| 108 bool IsValid() const; | |
| 109 uword TargetAddress() const; | |
| 110 void SetTargetAddress(uword target_address) const; | |
| 111 | |
| 112 private: | |
| 113 const uword pc_; | |
| 114 | |
| 115 DISALLOW_COPY_AND_ASSIGN(JumpPattern); | |
| 116 }; | |
| 117 | |
| 118 | |
| 119 class ReturnPattern : public ValueObject { | 100 class ReturnPattern : public ValueObject { |
| 120 public: | 101 public: |
| 121 explicit ReturnPattern(uword pc); | 102 explicit ReturnPattern(uword pc); |
| 122 | 103 |
| 123 // bx_lr = 1. | 104 // bx_lr = 1. |
| 124 static const int kLengthInBytes = 1 * Instr::kInstrSize; | 105 static const int kLengthInBytes = 1 * Instr::kInstrSize; |
| 125 | 106 |
| 126 int pattern_length_in_bytes() const { | 107 int pattern_length_in_bytes() const { |
| 127 return kLengthInBytes; | 108 return kLengthInBytes; |
| 128 } | 109 } |
| 129 | 110 |
| 130 bool IsValid() const; | 111 bool IsValid() const; |
| 131 | 112 |
| 132 private: | 113 private: |
| 133 const uword pc_; | 114 const uword pc_; |
| 134 }; | 115 }; |
| 135 | 116 |
| 136 } // namespace dart | 117 } // namespace dart |
| 137 | 118 |
| 138 #endif // VM_INSTRUCTIONS_ARM_H_ | 119 #endif // VM_INSTRUCTIONS_ARM_H_ |
| OLD | NEW |