| 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_MIPS_H_ | 6 #ifndef VM_INSTRUCTIONS_MIPS_H_ |
| 7 #define VM_INSTRUCTIONS_MIPS_H_ | 7 #define VM_INSTRUCTIONS_MIPS_H_ |
| 8 | 8 |
| 9 #ifndef VM_INSTRUCTIONS_H_ | 9 #ifndef VM_INSTRUCTIONS_H_ |
| 10 #error Do not include instructions_mips.h directly; use instructions.h instead. | 10 #error Do not include instructions_mips.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 RawCode* TargetCode() const; | 57 uword TargetAddress() const; |
| 58 void SetTargetCode(const Code& target) const; | 58 void SetTargetAddress(uword target_address) const; |
| 59 | 59 |
| 60 static const int kDeoptCallLengthInBytes = 4 * Instr::kInstrSize; | 60 // This constant length is only valid for inserted call patterns used for |
| 61 // lazy deoptimization. Regular call pattern may vary in length. |
| 62 static const int kFixedLengthInBytes = 4 * Instr::kInstrSize; |
| 61 | 63 |
| 62 static void InsertDeoptCallAt(uword pc, uword target_address); | 64 static void InsertAt(uword pc, uword target_address); |
| 63 | 65 |
| 64 private: | 66 private: |
| 65 const ObjectPool& object_pool_; | 67 const ObjectPool& object_pool_; |
| 66 | 68 |
| 67 uword end_; | 69 uword end_; |
| 68 uword ic_data_load_end_; | 70 uword ic_data_load_end_; |
| 69 | 71 |
| 70 intptr_t target_code_pool_index_; | 72 intptr_t target_address_pool_index_; |
| 71 ICData& ic_data_; | 73 ICData& ic_data_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(CallPattern); | 75 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 | 78 |
| 77 class NativeCallPattern : public ValueObject { | 79 class NativeCallPattern : public ValueObject { |
| 78 public: | 80 public: |
| 79 NativeCallPattern(uword pc, const Code& code); | 81 NativeCallPattern(uword pc, const Code& code); |
| 80 | 82 |
| 81 RawCode* target() const; | 83 uword target() const; |
| 82 void set_target(const Code& target) const; | 84 void set_target(uword target_address) const; |
| 83 | 85 |
| 84 NativeFunction native_function() const; | 86 NativeFunction native_function() const; |
| 85 void set_native_function(NativeFunction target) const; | 87 void set_native_function(NativeFunction target) const; |
| 86 | 88 |
| 87 private: | 89 private: |
| 88 const ObjectPool& object_pool_; | 90 const ObjectPool& object_pool_; |
| 89 | 91 |
| 90 uword end_; | 92 uword end_; |
| 91 intptr_t native_function_pool_index_; | 93 intptr_t native_function_pool_index_; |
| 92 intptr_t target_code_pool_index_; | 94 intptr_t target_address_pool_index_; |
| 93 | 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); | 96 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 | 99 |
| 100 class JumpPattern : public ValueObject { |
| 101 public: |
| 102 JumpPattern(uword pc, const Code& code); |
| 103 |
| 104 // lui; ori; jr; nop (in delay slot) = 4. |
| 105 static const int kLengthInBytes = 4*Instr::kInstrSize; |
| 106 |
| 107 int pattern_length_in_bytes() const { |
| 108 return kLengthInBytes; |
| 109 } |
| 110 |
| 111 bool IsValid() const; |
| 112 uword TargetAddress() const; |
| 113 void SetTargetAddress(uword target_address) const; |
| 114 |
| 115 private: |
| 116 const uword pc_; |
| 117 |
| 118 DISALLOW_COPY_AND_ASSIGN(JumpPattern); |
| 119 }; |
| 120 |
| 121 |
| 98 class ReturnPattern : public ValueObject { | 122 class ReturnPattern : public ValueObject { |
| 99 public: | 123 public: |
| 100 explicit ReturnPattern(uword pc); | 124 explicit ReturnPattern(uword pc); |
| 101 | 125 |
| 102 // jr(RA) = 1 | 126 // jr(RA) = 1 |
| 103 static const int kLengthInBytes = 1 * Instr::kInstrSize; | 127 static const int kLengthInBytes = 1 * Instr::kInstrSize; |
| 104 | 128 |
| 105 int pattern_length_in_bytes() const { | 129 int pattern_length_in_bytes() const { |
| 106 return kLengthInBytes; | 130 return kLengthInBytes; |
| 107 } | 131 } |
| 108 | 132 |
| 109 bool IsValid() const; | 133 bool IsValid() const; |
| 110 | 134 |
| 111 private: | 135 private: |
| 112 const uword pc_; | 136 const uword pc_; |
| 113 }; | 137 }; |
| 114 | 138 |
| 115 } // namespace dart | 139 } // namespace dart |
| 116 | 140 |
| 117 #endif // VM_INSTRUCTIONS_MIPS_H_ | 141 #endif // VM_INSTRUCTIONS_MIPS_H_ |
| OLD | NEW |