| 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 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/constants_arm.h" | 8 #include "vm/constants_arm.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 CallPattern::CallPattern(uword pc, const Code& code) | 15 CallPattern::CallPattern(uword pc, const Code& code) |
| 16 : end_(reinterpret_cast<uword*>(pc)), | 16 : end_(reinterpret_cast<uword*>(pc)), |
| 17 target_address_pool_index_(-1), | 17 target_address_pool_index_(-1), |
| 18 args_desc_load_end_(-1), | 18 args_desc_load_end_(-1), |
| 19 args_desc_(Array::Handle()), | 19 args_desc_(Array::Handle()), |
| 20 ic_data_load_end_(-1), | 20 ic_data_load_end_(-1), |
| 21 ic_data_(ICData::Handle()), | 21 ic_data_(ICData::Handle()), |
| 22 object_pool_(Array::Handle(code.ObjectPool())) { | 22 object_pool_(Array::Handle(code.ObjectPool())) { |
| 23 ASSERT(code.ContainsInstructionAt(pc)); | 23 ASSERT(code.ContainsInstructionAt(pc)); |
| 24 ASSERT(Back(1) == 0xe12fff3e); // Last instruction: blx lr | 24 ASSERT(Back(1) == 0xe12fff3e); // Last instruction: blx lr |
| 25 Register reg; | 25 Register reg; |
| 26 args_desc_load_end_ = | 26 ic_data_load_end_ = |
| 27 DecodeLoadWordFromPool(1, ®, &target_address_pool_index_); | 27 DecodeLoadWordFromPool(1, ®, &target_address_pool_index_); |
| 28 ASSERT(reg == LR); | 28 ASSERT(reg == LR); |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 |
| 32 uword CallPattern::Back(int n) const { | 32 uword CallPattern::Back(int n) const { |
| 33 ASSERT(n > 0); | 33 ASSERT(n > 0); |
| 34 return *(end_ - n); | 34 return *(end_ - n); |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 offset += kHeapObjectTag; | 105 offset += kHeapObjectTag; |
| 106 ASSERT(Utils::IsAligned(offset, 4)); | 106 ASSERT(Utils::IsAligned(offset, 4)); |
| 107 *index = (offset - Array::data_offset())/4; | 107 *index = (offset - Array::data_offset())/4; |
| 108 return end; | 108 return end; |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 RawICData* CallPattern::IcData() { | 112 RawICData* CallPattern::IcData() { |
| 113 if (ic_data_.IsNull()) { | 113 if (ic_data_.IsNull()) { |
| 114 Register reg; | 114 Register reg; |
| 115 // Loading of the argument descriptor must be decoded first, if not already. | 115 args_desc_load_end_ = DecodeLoadObject(ic_data_load_end_, ®, &ic_data_); |
| 116 if (args_desc_.IsNull()) { | |
| 117 ic_data_load_end_ = DecodeLoadObject( | |
| 118 args_desc_load_end_, ®, &args_desc_); | |
| 119 ASSERT(reg == R4); | |
| 120 } | |
| 121 DecodeLoadObject(ic_data_load_end_, ®, &ic_data_); | |
| 122 ASSERT(reg == R5); | 116 ASSERT(reg == R5); |
| 123 } | 117 } |
| 124 return ic_data_.raw(); | 118 return ic_data_.raw(); |
| 125 } | 119 } |
| 126 | 120 |
| 127 | 121 |
| 128 RawArray* CallPattern::ArgumentsDescriptor() { | 122 RawArray* CallPattern::ArgumentsDescriptor() { |
| 129 if (args_desc_.IsNull()) { | 123 if (args_desc_.IsNull()) { |
| 124 IcData(); // Loading of the ic_data must be decoded first, if not already. |
| 130 Register reg; | 125 Register reg; |
| 131 ic_data_load_end_ = DecodeLoadObject( | 126 DecodeLoadObject(args_desc_load_end_, ®, &args_desc_); |
| 132 args_desc_load_end_, ®, &args_desc_); | |
| 133 ASSERT(reg == R4); | 127 ASSERT(reg == R4); |
| 134 } | 128 } |
| 135 return args_desc_.raw(); | 129 return args_desc_.raw(); |
| 136 } | 130 } |
| 137 | 131 |
| 138 | 132 |
| 139 uword CallPattern::TargetAddress() const { | 133 uword CallPattern::TargetAddress() const { |
| 140 ASSERT(target_address_pool_index_ >= 0); | 134 ASSERT(target_address_pool_index_ >= 0); |
| 141 const Object& target_address = | 135 const Object& target_address = |
| 142 Object::Handle(object_pool_.At(target_address_pool_index_)); | 136 Object::Handle(object_pool_.At(target_address_pool_index_)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 uword movt = 0xe340c000 | ((target_hi >> 12) << 16) | (target_hi & 0xfff); | 178 uword movt = 0xe340c000 | ((target_hi >> 12) << 16) | (target_hi & 0xfff); |
| 185 *reinterpret_cast<uword*>(pc_ + (0 * Instr::kInstrSize)) = movw; | 179 *reinterpret_cast<uword*>(pc_ + (0 * Instr::kInstrSize)) = movw; |
| 186 *reinterpret_cast<uword*>(pc_ + (1 * Instr::kInstrSize)) = movt; | 180 *reinterpret_cast<uword*>(pc_ + (1 * Instr::kInstrSize)) = movt; |
| 187 CPU::FlushICache(pc_, 2 * Instr::kInstrSize); | 181 CPU::FlushICache(pc_, 2 * Instr::kInstrSize); |
| 188 } | 182 } |
| 189 | 183 |
| 190 } // namespace dart | 184 } // namespace dart |
| 191 | 185 |
| 192 #endif // defined TARGET_ARCH_ARM | 186 #endif // defined TARGET_ARCH_ARM |
| 193 | 187 |
| OLD | NEW |