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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Smi::RawValue(true_value) - Smi::RawValue(false_value); | 175 Smi::RawValue(true_value) - Smi::RawValue(false_value); |
176 __ AndImmediate(result, result, val); | 176 __ AndImmediate(result, result, val); |
177 if (false_value != 0) { | 177 if (false_value != 0) { |
178 __ AddImmediate(result, Smi::RawValue(false_value)); | 178 __ AddImmediate(result, Smi::RawValue(false_value)); |
179 } | 179 } |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 | 183 |
184 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { | 184 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { |
185 return MakeCallSummary(); | 185 const intptr_t kNumInputs = 1; |
| 186 const intptr_t kNumTemps = 0; |
| 187 LocationSummary* summary = |
| 188 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 189 summary->set_in(0, Location::RegisterLocation(R0)); // Function. |
| 190 summary->set_out(0, Location::RegisterLocation(R0)); |
| 191 return summary; |
186 } | 192 } |
187 | 193 |
188 | 194 |
189 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 195 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
190 // Load closure object (first argument) in R1. | 196 // Load arguments descriptor in R4. |
191 int argument_count = ArgumentCount(); | 197 int argument_count = ArgumentCount(); |
192 __ ldr(R1, Address(SP, (argument_count - 1) * kWordSize)); | |
193 | |
194 // Load arguments descriptor in R4. | |
195 const Array& arguments_descriptor = | 198 const Array& arguments_descriptor = |
196 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 199 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
197 argument_names())); | 200 argument_names())); |
198 __ LoadObject(R4, arguments_descriptor); | 201 __ LoadObject(R4, arguments_descriptor); |
199 | 202 |
200 // Load the closure function into R0. | |
201 __ ldr(R0, FieldAddress(R1, Closure::function_offset())); | |
202 | |
203 // Load closure context in CTX; note that CTX has already been preserved. | |
204 __ ldr(CTX, FieldAddress(R1, Closure::context_offset())); | |
205 | |
206 // R4: Arguments descriptor. | 203 // R4: Arguments descriptor. |
207 // R0: Function. | 204 // R0: Function. |
| 205 ASSERT(locs()->in(0).reg() == R0); |
208 __ ldr(R2, FieldAddress(R0, Function::code_offset())); | 206 __ ldr(R2, FieldAddress(R0, Function::code_offset())); |
209 | 207 |
210 // R2: code. | 208 // R2: code. |
211 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 209 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
212 __ LoadImmediate(R5, 0); | 210 __ LoadImmediate(R5, 0); |
213 __ ldr(R2, FieldAddress(R2, Code::instructions_offset())); | 211 __ ldr(R2, FieldAddress(R2, Code::instructions_offset())); |
214 __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag); | 212 __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag); |
215 __ blx(R2); | 213 __ blx(R2); |
216 compiler->AddCurrentDescriptor(PcDescriptors::kClosureCall, | 214 compiler->AddCurrentDescriptor(PcDescriptors::kClosureCall, |
217 deopt_id(), | 215 deopt_id(), |
218 token_pos()); | 216 token_pos()); |
219 compiler->RecordSafepoint(locs()); | 217 compiler->RecordSafepoint(locs()); |
220 // Marks either the continuation point in unoptimized code or the | 218 // Marks either the continuation point in unoptimized code or the |
221 // deoptimization point in optimized code, after call. | 219 // deoptimization point in optimized code, after call. |
222 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); | 220 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); |
223 if (compiler->is_optimizing()) { | 221 if (compiler->is_optimizing()) { |
224 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); | 222 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos(), InputCount()); |
225 } else { | 223 } else { |
226 // Add deoptimization continuation point after the call and before the | 224 // Add deoptimization continuation point after the call and before the |
227 // arguments are removed. | 225 // arguments are removed. |
228 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 226 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
229 deopt_id_after, | 227 deopt_id_after, |
230 token_pos()); | 228 token_pos()); |
231 } | 229 } |
232 __ Drop(argument_count); | 230 __ Drop(argument_count); |
233 } | 231 } |
234 | 232 |
(...skipping 5786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6021 compiler->GenerateCall(token_pos(), | 6019 compiler->GenerateCall(token_pos(), |
6022 &label, | 6020 &label, |
6023 PcDescriptors::kOther, | 6021 PcDescriptors::kOther, |
6024 locs()); | 6022 locs()); |
6025 __ Drop(ArgumentCount()); // Discard arguments. | 6023 __ Drop(ArgumentCount()); // Discard arguments. |
6026 } | 6024 } |
6027 | 6025 |
6028 } // namespace dart | 6026 } // namespace dart |
6029 | 6027 |
6030 #endif // defined TARGET_ARCH_ARM | 6028 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |