OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // Classes that describe assembly patterns as used by inline caches. |
| 5 |
| 6 #ifndef VM_INSTRUCTIONS_ARM64_H_ |
| 7 #define VM_INSTRUCTIONS_ARM64_H_ |
| 8 |
| 9 #ifndef VM_INSTRUCTIONS_H_ |
| 10 #error Do not include instructions_arm64.h directly; use instructions.h instead. |
| 11 #endif |
| 12 |
| 13 #include "vm/constants_arm64.h" |
| 14 #include "vm/object.h" |
| 15 |
| 16 namespace dart { |
| 17 |
| 18 class InstructionPattern : public AllStatic { |
| 19 public: |
| 20 // Decodes a load sequence ending at 'end' (the last instruction of the |
| 21 // load sequence is the instruction before the one at end). Returns the |
| 22 // address of the first instruction in the sequence. Returns the register |
| 23 // being loaded and the loaded object in the output parameters 'reg' and |
| 24 // 'obj' respectively. |
| 25 static uword DecodeLoadObject(uword end, |
| 26 const Array& object_pool, |
| 27 Register* reg, |
| 28 Object* obj); |
| 29 |
| 30 // Decodes a load sequence ending at 'end' (the last instruction of the |
| 31 // load sequence is the instruction before the one at end). Returns the |
| 32 // address of the first instruction in the sequence. Returns the register |
| 33 // being loaded and the loaded immediate value in the output parameters |
| 34 // 'reg' and 'value' respectively. |
| 35 static uword DecodeLoadWordImmediate(uword end, |
| 36 Register* reg, |
| 37 intptr_t* value); |
| 38 |
| 39 // Decodes a load sequence ending at 'end' (the last instruction of the |
| 40 // load sequence is the instruction before the one at end). Returns the |
| 41 // address of the first instruction in the sequence. Returns the register |
| 42 // being loaded and the index in the pool being read from in the output |
| 43 // parameters 'reg' and 'index' respectively. |
| 44 static uword DecodeLoadWordFromPool(uword end, |
| 45 Register* reg, |
| 46 intptr_t* index); |
| 47 }; |
| 48 |
| 49 |
| 50 class CallPattern : public ValueObject { |
| 51 public: |
| 52 CallPattern(uword pc, const Code& code); |
| 53 |
| 54 RawICData* IcData(); |
| 55 RawArray* ClosureArgumentsDescriptor(); |
| 56 |
| 57 uword TargetAddress() const; |
| 58 void SetTargetAddress(uword target_address) const; |
| 59 |
| 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 int LengthInBytes(); |
| 63 |
| 64 static void InsertAt(uword pc, uword target_address); |
| 65 |
| 66 private: |
| 67 const Array& object_pool_; |
| 68 |
| 69 uword end_; |
| 70 uword args_desc_load_end_; |
| 71 uword ic_data_load_end_; |
| 72 |
| 73 intptr_t target_address_pool_index_; |
| 74 Array& args_desc_; |
| 75 ICData& ic_data_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(CallPattern); |
| 78 }; |
| 79 |
| 80 |
| 81 class JumpPattern : public ValueObject { |
| 82 public: |
| 83 JumpPattern(uword pc, const Code& code); |
| 84 |
| 85 static const int kLengthInBytes = 3 * Instr::kInstrSize; |
| 86 |
| 87 static int pattern_length_in_bytes(); |
| 88 |
| 89 bool IsValid() const; |
| 90 uword TargetAddress() const; |
| 91 void SetTargetAddress(uword target_address) const; |
| 92 |
| 93 private: |
| 94 const uword pc_; |
| 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(JumpPattern); |
| 97 }; |
| 98 |
| 99 } // namespace dart |
| 100 |
| 101 #endif // VM_INSTRUCTIONS_ARM64_H_ |
OLD | NEW |