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_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 154 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
155 } | 155 } |
156 | 156 |
157 // Pass NativeArguments structure by value and call native function. | 157 // Pass NativeArguments structure by value and call native function. |
158 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. | 158 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. |
159 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. | 159 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. |
160 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. | 160 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. |
161 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. | 161 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. |
162 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. | 162 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. |
163 __ movq(RDI, RSP); // Pass the pointer to the NativeArguments. | 163 __ movq(RDI, RSP); // Pass the pointer to the NativeArguments. |
| 164 |
| 165 // Call native function (setsup scope if not leaf function). |
| 166 Label leaf_call; |
| 167 Label done; |
| 168 __ testq(R10, Immediate(NativeArguments::AutoSetupScopeMask())); |
| 169 __ j(ZERO, &leaf_call); |
164 __ movq(RSI, RBX); // Pass pointer to function entrypoint. | 170 __ movq(RSI, RBX); // Pass pointer to function entrypoint. |
165 __ call(&NativeEntry::NativeCallWrapperLabel()); | 171 __ call(&NativeEntry::NativeCallWrapperLabel()); |
| 172 __ jmp(&done); |
| 173 __ Bind(&leaf_call); |
| 174 __ call(RBX); |
| 175 __ Bind(&done); |
166 | 176 |
167 // Reset exit frame information in Isolate structure. | 177 // Reset exit frame information in Isolate structure. |
168 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); | 178 __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
169 | 179 |
170 // Load Context pointer from Isolate structure into R8. | 180 // Load Context pointer from Isolate structure into R8. |
171 __ movq(R8, Address(CTX, Isolate::top_context_offset())); | 181 __ movq(R8, Address(CTX, Isolate::top_context_offset())); |
172 | 182 |
173 // Reset Context pointer in Isolate structure. | 183 // Reset Context pointer in Isolate structure. |
174 __ LoadObject(R12, Object::null_object(), PP); | 184 __ LoadObject(R12, Object::null_object(), PP); |
175 __ movq(Address(CTX, Isolate::top_context_offset()), R12); | 185 __ movq(Address(CTX, Isolate::top_context_offset()), R12); |
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 | 2175 |
2166 __ movq(left, Address(RSP, 2 * kWordSize)); | 2176 __ movq(left, Address(RSP, 2 * kWordSize)); |
2167 __ movq(right, Address(RSP, 1 * kWordSize)); | 2177 __ movq(right, Address(RSP, 1 * kWordSize)); |
2168 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2178 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
2169 __ ret(); | 2179 __ ret(); |
2170 } | 2180 } |
2171 | 2181 |
2172 } // namespace dart | 2182 } // namespace dart |
2173 | 2183 |
2174 #endif // defined TARGET_ARCH_X64 | 2184 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |