| 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 RUNTIME_VM_INSTRUCTIONS_ARM_H_ | 6 #ifndef RUNTIME_VM_INSTRUCTIONS_ARM_H_ |
| 7 #define RUNTIME_VM_INSTRUCTIONS_ARM_H_ | 7 #define RUNTIME_VM_INSTRUCTIONS_ARM_H_ |
| 8 | 8 |
| 9 #ifndef RUNTIME_VM_INSTRUCTIONS_H_ | 9 #ifndef RUNTIME_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 29 matching lines...) Expand all Loading... |
| 40 // Decodes a load sequence ending at 'end' (the last instruction of the | 40 // Decodes a load sequence ending at 'end' (the last instruction of the |
| 41 // load sequence is the instruction before the one at end). Returns the | 41 // load sequence is the instruction before the one at end). Returns the |
| 42 // address of the first instruction in the sequence. Returns the register | 42 // address of the first instruction in the sequence. Returns the register |
| 43 // being loaded and the index in the pool being read from in the output | 43 // being loaded and the index in the pool being read from in the output |
| 44 // parameters 'reg' and 'index' respectively. | 44 // parameters 'reg' and 'index' respectively. |
| 45 static uword DecodeLoadWordFromPool(uword end, | 45 static uword DecodeLoadWordFromPool(uword end, |
| 46 Register* reg, | 46 Register* reg, |
| 47 intptr_t* index); | 47 intptr_t* index); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 | |
| 51 class CallPattern : public ValueObject { | 50 class CallPattern : public ValueObject { |
| 52 public: | 51 public: |
| 53 CallPattern(uword pc, const Code& code); | 52 CallPattern(uword pc, const Code& code); |
| 54 | 53 |
| 55 RawICData* IcData(); | 54 RawICData* IcData(); |
| 56 | 55 |
| 57 RawCode* TargetCode() const; | 56 RawCode* TargetCode() const; |
| 58 void SetTargetCode(const Code& code) const; | 57 void SetTargetCode(const Code& code) const; |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 const ObjectPool& object_pool_; | 60 const ObjectPool& object_pool_; |
| 62 | 61 |
| 63 uword end_; | 62 uword end_; |
| 64 uword ic_data_load_end_; | 63 uword ic_data_load_end_; |
| 65 | 64 |
| 66 intptr_t target_code_pool_index_; | 65 intptr_t target_code_pool_index_; |
| 67 ICData& ic_data_; | 66 ICData& ic_data_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(CallPattern); | 68 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 | |
| 73 class NativeCallPattern : public ValueObject { | 71 class NativeCallPattern : public ValueObject { |
| 74 public: | 72 public: |
| 75 NativeCallPattern(uword pc, const Code& code); | 73 NativeCallPattern(uword pc, const Code& code); |
| 76 | 74 |
| 77 RawCode* target() const; | 75 RawCode* target() const; |
| 78 void set_target(const Code& target) const; | 76 void set_target(const Code& target) const; |
| 79 | 77 |
| 80 NativeFunction native_function() const; | 78 NativeFunction native_function() const; |
| 81 void set_native_function(NativeFunction target) const; | 79 void set_native_function(NativeFunction target) const; |
| 82 | 80 |
| 83 private: | 81 private: |
| 84 const ObjectPool& object_pool_; | 82 const ObjectPool& object_pool_; |
| 85 | 83 |
| 86 uword end_; | 84 uword end_; |
| 87 intptr_t native_function_pool_index_; | 85 intptr_t native_function_pool_index_; |
| 88 intptr_t target_code_pool_index_; | 86 intptr_t target_code_pool_index_; |
| 89 | 87 |
| 90 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); | 88 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 | |
| 94 // Instance call that can switch between a direct monomorphic call, an IC call, | 91 // Instance call that can switch between a direct monomorphic call, an IC call, |
| 95 // and a megamorphic call. | 92 // and a megamorphic call. |
| 96 // load guarded cid load ICData load MegamorphicCache | 93 // load guarded cid load ICData load MegamorphicCache |
| 97 // load monomorphic target <-> load ICLookup stub -> load MMLookup stub | 94 // load monomorphic target <-> load ICLookup stub -> load MMLookup stub |
| 98 // call target.entry call stub.entry call stub.entry | 95 // call target.entry call stub.entry call stub.entry |
| 99 class SwitchableCallPattern : public ValueObject { | 96 class SwitchableCallPattern : public ValueObject { |
| 100 public: | 97 public: |
| 101 SwitchableCallPattern(uword pc, const Code& code); | 98 SwitchableCallPattern(uword pc, const Code& code); |
| 102 | 99 |
| 103 RawObject* data() const; | 100 RawObject* data() const; |
| 104 RawCode* target() const; | 101 RawCode* target() const; |
| 105 void SetData(const Object& data) const; | 102 void SetData(const Object& data) const; |
| 106 void SetTarget(const Code& target) const; | 103 void SetTarget(const Code& target) const; |
| 107 | 104 |
| 108 private: | 105 private: |
| 109 const ObjectPool& object_pool_; | 106 const ObjectPool& object_pool_; |
| 110 intptr_t data_pool_index_; | 107 intptr_t data_pool_index_; |
| 111 intptr_t target_pool_index_; | 108 intptr_t target_pool_index_; |
| 112 | 109 |
| 113 DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); | 110 DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); |
| 114 }; | 111 }; |
| 115 | 112 |
| 116 | |
| 117 class ReturnPattern : public ValueObject { | 113 class ReturnPattern : public ValueObject { |
| 118 public: | 114 public: |
| 119 explicit ReturnPattern(uword pc); | 115 explicit ReturnPattern(uword pc); |
| 120 | 116 |
| 121 // bx_lr = 1. | 117 // bx_lr = 1. |
| 122 static const int kLengthInBytes = 1 * Instr::kInstrSize; | 118 static const int kLengthInBytes = 1 * Instr::kInstrSize; |
| 123 | 119 |
| 124 int pattern_length_in_bytes() const { return kLengthInBytes; } | 120 int pattern_length_in_bytes() const { return kLengthInBytes; } |
| 125 | 121 |
| 126 bool IsValid() const; | 122 bool IsValid() const; |
| 127 | 123 |
| 128 private: | 124 private: |
| 129 const uword pc_; | 125 const uword pc_; |
| 130 }; | 126 }; |
| 131 | 127 |
| 132 } // namespace dart | 128 } // namespace dart |
| 133 | 129 |
| 134 #endif // RUNTIME_VM_INSTRUCTIONS_ARM_H_ | 130 #endif // RUNTIME_VM_INSTRUCTIONS_ARM_H_ |
| OLD | NEW |