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" | 5 #include "vm/globals.h" |
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/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Set retval in NativeArgs. | 185 // Set retval in NativeArgs. |
186 __ add(R3, FP, Operand(kCallerSpSlotFromFp * kWordSize)); | 186 __ add(R3, FP, Operand(kCallerSpSlotFromFp * kWordSize)); |
187 | 187 |
188 // Passing the structure by value as in runtime calls would require changing | 188 // Passing the structure by value as in runtime calls would require changing |
189 // Dart API for native functions. | 189 // Dart API for native functions. |
190 // For now, space is reserved on the stack and we pass a pointer to it. | 190 // For now, space is reserved on the stack and we pass a pointer to it. |
191 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); | 191 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); |
192 __ mov(R0, Operand(SP)); // Pass the pointer to the NativeArguments. | 192 __ mov(R0, Operand(SP)); // Pass the pointer to the NativeArguments. |
193 | 193 |
194 __ mov(R1, Operand(R5)); // Pass the function entrypoint to call. | 194 __ mov(R1, Operand(R5)); // Pass the function entrypoint to call. |
| 195 |
195 // Call native function invocation wrapper or redirection via simulator. | 196 // Call native function invocation wrapper or redirection via simulator. |
196 #if defined(USING_SIMULATOR) | 197 __ ldr(LR, Address(THR, Thread::native_call_wrapper_entry_point_offset())); |
197 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); | |
198 const ExternalLabel label(Simulator::RedirectExternalReference( | |
199 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments)); | |
200 __ LoadExternalLabel(R2, &label, kNotPatchable); | |
201 __ blx(R2); | |
202 #else | |
203 __ LoadExternalLabel( | |
204 LR, &NativeEntry::NativeCallWrapperLabel(), kNotPatchable); | |
205 __ blx(LR); | 198 __ blx(LR); |
206 #endif | |
207 | 199 |
208 // Mark that the isolate is executing Dart code. | 200 // Mark that the isolate is executing Dart code. |
209 __ LoadImmediate(R2, VMTag::kDartTagId); | 201 __ LoadImmediate(R2, VMTag::kDartTagId); |
210 __ StoreToOffset(kWord, R2, R7, Isolate::vm_tag_offset()); | 202 __ StoreToOffset(kWord, R2, R7, Isolate::vm_tag_offset()); |
211 | 203 |
212 // Reset exit frame information in Isolate structure. | 204 // Reset exit frame information in Isolate structure. |
213 __ LoadImmediate(R2, 0); | 205 __ LoadImmediate(R2, 0); |
214 __ StoreToOffset(kWord, R2, THR, Thread::top_exit_frame_info_offset()); | 206 __ StoreToOffset(kWord, R2, THR, Thread::top_exit_frame_info_offset()); |
215 | 207 |
216 __ LeaveStubFrame(); | 208 __ LeaveStubFrame(); |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 // Result: | 2100 // Result: |
2109 // R1: entry point. | 2101 // R1: entry point. |
2110 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2102 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2111 EmitMegamorphicLookup(assembler, R0, R1, R1); | 2103 EmitMegamorphicLookup(assembler, R0, R1, R1); |
2112 __ Ret(); | 2104 __ Ret(); |
2113 } | 2105 } |
2114 | 2106 |
2115 } // namespace dart | 2107 } // namespace dart |
2116 | 2108 |
2117 #endif // defined TARGET_ARCH_ARM | 2109 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |