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/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/constants_arm.h" | 9 #include "vm/constants_arm.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
11 #include "vm/instructions.h" | 11 #include "vm/instructions.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 CallPattern::CallPattern(uword pc, const Code& code) | 16 CallPattern::CallPattern(uword pc, const Code& code) |
17 : object_pool_(ObjectPool::Handle(code.GetObjectPool())), | 17 : object_pool_(ObjectPool::Handle(code.GetObjectPool())), |
18 end_(pc), | 18 end_(pc), |
19 args_desc_load_end_(0), | |
20 ic_data_load_end_(0), | 19 ic_data_load_end_(0), |
21 target_address_pool_index_(-1), | 20 target_address_pool_index_(-1), |
22 args_desc_(Array::Handle()), | |
23 ic_data_(ICData::Handle()) { | 21 ic_data_(ICData::Handle()) { |
24 ASSERT(code.ContainsInstructionAt(pc)); | 22 ASSERT(code.ContainsInstructionAt(pc)); |
25 // Last instruction: blx lr. | 23 // Last instruction: blx lr. |
26 ASSERT(*(reinterpret_cast<uword*>(end_) - 1) == 0xe12fff3e); | 24 ASSERT(*(reinterpret_cast<uword*>(end_) - 1) == 0xe12fff3e); |
27 | 25 |
28 Register reg; | 26 Register reg; |
29 ic_data_load_end_ = | 27 ic_data_load_end_ = |
30 InstructionPattern::DecodeLoadWordFromPool(end_ - Instr::kInstrSize, | 28 InstructionPattern::DecodeLoadWordFromPool(end_ - Instr::kInstrSize, |
31 ®, | 29 ®, |
32 &target_address_pool_index_); | 30 &target_address_pool_index_); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 149 } |
152 } | 150 } |
153 *index = ObjectPool::IndexFromOffset(offset); | 151 *index = ObjectPool::IndexFromOffset(offset); |
154 return start; | 152 return start; |
155 } | 153 } |
156 | 154 |
157 | 155 |
158 RawICData* CallPattern::IcData() { | 156 RawICData* CallPattern::IcData() { |
159 if (ic_data_.IsNull()) { | 157 if (ic_data_.IsNull()) { |
160 Register reg; | 158 Register reg; |
161 args_desc_load_end_ = | 159 InstructionPattern::DecodeLoadObject(ic_data_load_end_, |
162 InstructionPattern::DecodeLoadObject(ic_data_load_end_, | 160 object_pool_, |
163 object_pool_, | 161 ®, |
164 ®, | 162 &ic_data_); |
165 &ic_data_); | |
166 ASSERT(reg == R5); | 163 ASSERT(reg == R5); |
167 } | 164 } |
168 return ic_data_.raw(); | 165 return ic_data_.raw(); |
169 } | 166 } |
170 | 167 |
171 | 168 |
172 RawArray* CallPattern::ClosureArgumentsDescriptor() { | |
173 if (args_desc_.IsNull()) { | |
174 IcData(); // Loading of the ic_data must be decoded first, if not already. | |
175 Register reg; | |
176 InstructionPattern::DecodeLoadObject(args_desc_load_end_, | |
177 object_pool_, | |
178 ®, | |
179 &args_desc_); | |
180 ASSERT(reg == R4); | |
181 } | |
182 return args_desc_.raw(); | |
183 } | |
184 | |
185 | |
186 uword CallPattern::TargetAddress() const { | 169 uword CallPattern::TargetAddress() const { |
187 return object_pool_.RawValueAt(target_address_pool_index_); | 170 return object_pool_.RawValueAt(target_address_pool_index_); |
188 } | 171 } |
189 | 172 |
190 | 173 |
191 void CallPattern::SetTargetAddress(uword target_address) const { | 174 void CallPattern::SetTargetAddress(uword target_address) const { |
192 object_pool_.SetRawValueAt(target_address_pool_index_, target_address); | 175 object_pool_.SetRawValueAt(target_address_pool_index_, target_address); |
193 // No need to flush the instruction cache, since the code is not modified. | 176 // No need to flush the instruction cache, since the code is not modified. |
194 } | 177 } |
195 | 178 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } else { | 337 } else { |
355 ASSERT(version == ARMv7); | 338 ASSERT(version == ARMv7); |
356 return bx_lr->InstructionBits() == instruction; | 339 return bx_lr->InstructionBits() == instruction; |
357 } | 340 } |
358 return false; | 341 return false; |
359 } | 342 } |
360 | 343 |
361 } // namespace dart | 344 } // namespace dart |
362 | 345 |
363 #endif // defined TARGET_ARCH_ARM | 346 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |