| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 ASSERT(retval_offset == 3 * kWordSize); | 210 ASSERT(retval_offset == 3 * kWordSize); |
| 211 __ add(R3, FP, Operand(3 * kWordSize)); // Set retval in NativeArgs. | 211 __ add(R3, FP, Operand(3 * kWordSize)); // Set retval in NativeArgs. |
| 212 | 212 |
| 213 // Passing the structure by value as in runtime calls would require changing | 213 // Passing the structure by value as in runtime calls would require changing |
| 214 // Dart API for native functions. | 214 // Dart API for native functions. |
| 215 // For now, space is reserved on the stack and we pass a pointer to it. | 215 // For now, space is reserved on the stack and we pass a pointer to it. |
| 216 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); | 216 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); |
| 217 __ mov(R0, Operand(SP)); // Pass the pointer to the NativeArguments. | 217 __ mov(R0, Operand(SP)); // Pass the pointer to the NativeArguments. |
| 218 | 218 |
| 219 // Call native function (setsup scope if not leaf function). | |
| 220 Label leaf_call; | |
| 221 Label done; | |
| 222 __ TestImmediate(R1, NativeArguments::AutoSetupScopeMask()); | |
| 223 __ b(&leaf_call, EQ); | |
| 224 | |
| 225 __ mov(R1, Operand(R5)); // Pass the function entrypoint to call. | 219 __ mov(R1, Operand(R5)); // Pass the function entrypoint to call. |
| 226 // Call native function invocation wrapper or redirection via simulator. | 220 // Call native function invocation wrapper or redirection via simulator. |
| 227 #if defined(USING_SIMULATOR) | 221 #if defined(USING_SIMULATOR) |
| 228 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); | 222 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); |
| 229 entry = Simulator::RedirectExternalReference( | 223 entry = Simulator::RedirectExternalReference( |
| 230 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); | 224 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); |
| 231 __ LoadImmediate(R2, entry); | 225 __ LoadImmediate(R2, entry); |
| 232 __ blx(R2); | 226 __ blx(R2); |
| 233 #else | 227 #else |
| 234 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); | 228 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); |
| 235 #endif | 229 #endif |
| 236 __ b(&done); | |
| 237 | |
| 238 __ Bind(&leaf_call); | |
| 239 // Call native function or redirection via simulator. | |
| 240 __ blx(R5); | |
| 241 | |
| 242 __ Bind(&done); | |
| 243 | 230 |
| 244 // Mark that the isolate is executing Dart code. | 231 // Mark that the isolate is executing Dart code. |
| 245 __ LoadImmediate(R2, VMTag::kScriptTagId); | 232 __ LoadImmediate(R2, VMTag::kScriptTagId); |
| 246 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); | 233 __ StoreToOffset(kWord, R2, CTX, Isolate::vm_tag_offset()); |
| 247 | 234 |
| 248 // Reset exit frame information in Isolate structure. | 235 // Reset exit frame information in Isolate structure. |
| 249 __ LoadImmediate(R2, 0); | 236 __ LoadImmediate(R2, 0); |
| 250 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); | 237 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); |
| 251 | 238 |
| 252 // Load Context pointer from Isolate structure into R2. | 239 // Load Context pointer from Isolate structure into R2. |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 const Register right = R0; | 1830 const Register right = R0; |
| 1844 __ ldr(left, Address(SP, 1 * kWordSize)); | 1831 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 1845 __ ldr(right, Address(SP, 0 * kWordSize)); | 1832 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 1846 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1833 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1847 __ Ret(); | 1834 __ Ret(); |
| 1848 } | 1835 } |
| 1849 | 1836 |
| 1850 } // namespace dart | 1837 } // namespace dart |
| 1851 | 1838 |
| 1852 #endif // defined TARGET_ARCH_ARM | 1839 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |