| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 __ StoreToOffset(R2, SP, argv_offset, kNoPP); | 222 __ StoreToOffset(R2, SP, argv_offset, kNoPP); |
| 223 __ StoreToOffset(R3, SP, retval_offset, kNoPP); | 223 __ StoreToOffset(R3, SP, retval_offset, kNoPP); |
| 224 __ mov(R0, SP); // Pass the pointer to the NativeArguments. | 224 __ mov(R0, SP); // Pass the pointer to the NativeArguments. |
| 225 | 225 |
| 226 // We are entering runtime code, so the C stack pointer must be restored from | 226 // We are entering runtime code, so the C stack pointer must be restored from |
| 227 // the stack limit to the top of the stack. We cache the stack limit address | 227 // the stack limit to the top of the stack. We cache the stack limit address |
| 228 // in the Dart SP register, which is callee-saved in the C ABI. | 228 // in the Dart SP register, which is callee-saved in the C ABI. |
| 229 __ mov(R26, CSP); | 229 __ mov(R26, CSP); |
| 230 __ mov(CSP, SP); | 230 __ mov(CSP, SP); |
| 231 | 231 |
| 232 // Call native function (setsup scope if not leaf function). | |
| 233 Label leaf_call; | |
| 234 Label done; | |
| 235 __ TestImmediate(R1, NativeArguments::AutoSetupScopeMask(), kNoPP); | |
| 236 __ b(&leaf_call, EQ); | |
| 237 | |
| 238 __ mov(R1, R5); // Pass the function entrypoint to call. | 232 __ mov(R1, R5); // Pass the function entrypoint to call. |
| 239 // Call native function invocation wrapper or redirection via simulator. | 233 // Call native function invocation wrapper or redirection via simulator. |
| 240 #if defined(USING_SIMULATOR) | 234 #if defined(USING_SIMULATOR) |
| 241 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); | 235 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); |
| 242 entry = Simulator::RedirectExternalReference( | 236 entry = Simulator::RedirectExternalReference( |
| 243 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); | 237 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); |
| 244 __ LoadImmediate(R2, entry, kNoPP); | 238 __ LoadImmediate(R2, entry, kNoPP); |
| 245 __ blr(R2); | 239 __ blr(R2); |
| 246 #else | 240 #else |
| 247 __ BranchLink(&NativeEntry::NativeCallWrapperLabel(), kNoPP); | 241 __ BranchLink(&NativeEntry::NativeCallWrapperLabel(), kNoPP); |
| 248 #endif | 242 #endif |
| 249 __ b(&done); | |
| 250 | 243 |
| 251 __ Bind(&leaf_call); | |
| 252 // Call native function or redirection via simulator. | |
| 253 __ blr(R5); | |
| 254 | |
| 255 __ Bind(&done); | |
| 256 // Restore SP and CSP. | 244 // Restore SP and CSP. |
| 257 __ mov(SP, CSP); | 245 __ mov(SP, CSP); |
| 258 __ mov(CSP, R26); | 246 __ mov(CSP, R26); |
| 259 | 247 |
| 260 // Mark that the isolate is executing Dart code. | 248 // Mark that the isolate is executing Dart code. |
| 261 __ LoadImmediate(R2, VMTag::kScriptTagId, kNoPP); | 249 __ LoadImmediate(R2, VMTag::kScriptTagId, kNoPP); |
| 262 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); | 250 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); |
| 263 | 251 |
| 264 // Reset exit frame information in Isolate structure. | 252 // Reset exit frame information in Isolate structure. |
| 265 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); | 253 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); |
| (...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 const Register right = R0; | 1925 const Register right = R0; |
| 1938 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 1926 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
| 1939 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 1927 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
| 1940 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1928 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1941 __ ret(); | 1929 __ ret(); |
| 1942 } | 1930 } |
| 1943 | 1931 |
| 1944 } // namespace dart | 1932 } // namespace dart |
| 1945 | 1933 |
| 1946 #endif // defined TARGET_ARCH_ARM64 | 1934 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |