| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64_H_ | 6 #ifndef RUNTIME_VM_INSTRUCTIONS_ARM64_H_ |
| 7 #define RUNTIME_VM_INSTRUCTIONS_ARM64_H_ | 7 #define RUNTIME_VM_INSTRUCTIONS_ARM64_H_ |
| 8 | 8 |
| 9 #ifndef RUNTIME_VM_INSTRUCTIONS_H_ | 9 #ifndef RUNTIME_VM_INSTRUCTIONS_H_ |
| 10 #error Do not include instructions_arm64.h directly; use instructions.h instead. | 10 #error Do not include instructions_arm64.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 // Encodes a load sequence ending at 'end'. Encodes a fixed length two | 49 // Encodes a load sequence ending at 'end'. Encodes a fixed length two |
| 50 // instruction load from the pool pointer in PP using the destination | 50 // instruction load from the pool pointer in PP using the destination |
| 51 // register reg as a temporary for the base address. | 51 // register reg as a temporary for the base address. |
| 52 static void EncodeLoadWordFromPoolFixed(uword end, int32_t offset); | 52 static void EncodeLoadWordFromPoolFixed(uword end, int32_t offset); |
| 53 | 53 |
| 54 static intptr_t OffsetFromPPIndex(intptr_t index); | 54 static intptr_t OffsetFromPPIndex(intptr_t index); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 | |
| 58 class CallPattern : public ValueObject { | 57 class CallPattern : public ValueObject { |
| 59 public: | 58 public: |
| 60 CallPattern(uword pc, const Code& code); | 59 CallPattern(uword pc, const Code& code); |
| 61 | 60 |
| 62 RawICData* IcData(); | 61 RawICData* IcData(); |
| 63 | 62 |
| 64 RawCode* TargetCode() const; | 63 RawCode* TargetCode() const; |
| 65 void SetTargetCode(const Code& target) const; | 64 void SetTargetCode(const Code& target) const; |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 const ObjectPool& object_pool_; | 67 const ObjectPool& object_pool_; |
| 69 | 68 |
| 70 uword end_; | 69 uword end_; |
| 71 uword ic_data_load_end_; | 70 uword ic_data_load_end_; |
| 72 | 71 |
| 73 intptr_t target_code_pool_index_; | 72 intptr_t target_code_pool_index_; |
| 74 ICData& ic_data_; | 73 ICData& ic_data_; |
| 75 | 74 |
| 76 DISALLOW_COPY_AND_ASSIGN(CallPattern); | 75 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
| 77 }; | 76 }; |
| 78 | 77 |
| 79 | |
| 80 class NativeCallPattern : public ValueObject { | 78 class NativeCallPattern : public ValueObject { |
| 81 public: | 79 public: |
| 82 NativeCallPattern(uword pc, const Code& code); | 80 NativeCallPattern(uword pc, const Code& code); |
| 83 | 81 |
| 84 RawCode* target() const; | 82 RawCode* target() const; |
| 85 void set_target(const Code& target) const; | 83 void set_target(const Code& target) const; |
| 86 | 84 |
| 87 NativeFunction native_function() const; | 85 NativeFunction native_function() const; |
| 88 void set_native_function(NativeFunction target) const; | 86 void set_native_function(NativeFunction target) const; |
| 89 | 87 |
| 90 private: | 88 private: |
| 91 const ObjectPool& object_pool_; | 89 const ObjectPool& object_pool_; |
| 92 | 90 |
| 93 uword end_; | 91 uword end_; |
| 94 intptr_t native_function_pool_index_; | 92 intptr_t native_function_pool_index_; |
| 95 intptr_t target_code_pool_index_; | 93 intptr_t target_code_pool_index_; |
| 96 | 94 |
| 97 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); | 95 DISALLOW_COPY_AND_ASSIGN(NativeCallPattern); |
| 98 }; | 96 }; |
| 99 | 97 |
| 100 | |
| 101 // Instance call that can switch between a direct monomorphic call, an IC call, | 98 // Instance call that can switch between a direct monomorphic call, an IC call, |
| 102 // and a megamorphic call. | 99 // and a megamorphic call. |
| 103 // load guarded cid load ICData load MegamorphicCache | 100 // load guarded cid load ICData load MegamorphicCache |
| 104 // load monomorphic target <-> load ICLookup stub -> load MMLookup stub | 101 // load monomorphic target <-> load ICLookup stub -> load MMLookup stub |
| 105 // call target.entry call stub.entry call stub.entry | 102 // call target.entry call stub.entry call stub.entry |
| 106 class SwitchableCallPattern : public ValueObject { | 103 class SwitchableCallPattern : public ValueObject { |
| 107 public: | 104 public: |
| 108 SwitchableCallPattern(uword pc, const Code& code); | 105 SwitchableCallPattern(uword pc, const Code& code); |
| 109 | 106 |
| 110 RawObject* data() const; | 107 RawObject* data() const; |
| 111 RawCode* target() const; | 108 RawCode* target() const; |
| 112 void SetData(const Object& data) const; | 109 void SetData(const Object& data) const; |
| 113 void SetTarget(const Code& target) const; | 110 void SetTarget(const Code& target) const; |
| 114 | 111 |
| 115 private: | 112 private: |
| 116 const ObjectPool& object_pool_; | 113 const ObjectPool& object_pool_; |
| 117 intptr_t data_pool_index_; | 114 intptr_t data_pool_index_; |
| 118 intptr_t target_pool_index_; | 115 intptr_t target_pool_index_; |
| 119 | 116 |
| 120 DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); | 117 DISALLOW_COPY_AND_ASSIGN(SwitchableCallPattern); |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 | |
| 124 class ReturnPattern : public ValueObject { | 120 class ReturnPattern : public ValueObject { |
| 125 public: | 121 public: |
| 126 explicit ReturnPattern(uword pc); | 122 explicit ReturnPattern(uword pc); |
| 127 | 123 |
| 128 // bx_lr = 1. | 124 // bx_lr = 1. |
| 129 static const int kLengthInBytes = 1 * Instr::kInstrSize; | 125 static const int kLengthInBytes = 1 * Instr::kInstrSize; |
| 130 | 126 |
| 131 int pattern_length_in_bytes() const { return kLengthInBytes; } | 127 int pattern_length_in_bytes() const { return kLengthInBytes; } |
| 132 | 128 |
| 133 bool IsValid() const; | 129 bool IsValid() const; |
| 134 | 130 |
| 135 private: | 131 private: |
| 136 const uword pc_; | 132 const uword pc_; |
| 137 }; | 133 }; |
| 138 | 134 |
| 139 } // namespace dart | 135 } // namespace dart |
| 140 | 136 |
| 141 #endif // RUNTIME_VM_INSTRUCTIONS_ARM64_H_ | 137 #endif // RUNTIME_VM_INSTRUCTIONS_ARM64_H_ |
| OLD | NEW |