| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 __ movq(Address(RAX, Isolate::top_exit_frame_info_offset()), RSP); | 54 __ movq(Address(RAX, Isolate::top_exit_frame_info_offset()), RSP); |
| 55 | 55 |
| 56 // Save current Context pointer into Isolate structure. | 56 // Save current Context pointer into Isolate structure. |
| 57 __ movq(Address(RAX, Isolate::top_context_offset()), CTX); | 57 __ movq(Address(RAX, Isolate::top_context_offset()), CTX); |
| 58 | 58 |
| 59 // Cache Isolate pointer into CTX while executing runtime code. | 59 // Cache Isolate pointer into CTX while executing runtime code. |
| 60 __ movq(CTX, RAX); | 60 __ movq(CTX, RAX); |
| 61 | 61 |
| 62 // Reserve space for arguments and align frame before entering C++ world. | 62 // Reserve space for arguments and align frame before entering C++ world. |
| 63 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments))); | 63 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments))); |
| 64 if (OS::ActivationFrameAlignment() > 0) { | 64 if (OS::ActivationFrameAlignment() > 1) { |
| 65 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 65 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Pass NativeArguments structure by value and call runtime. | 68 // Pass NativeArguments structure by value and call runtime. |
| 69 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. | 69 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| 70 // There are no runtime calls to closures, so we do not need to set the tag | 70 // There are no runtime calls to closures, so we do not need to set the tag |
| 71 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 71 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 72 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. | 72 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. |
| 73 __ leaq(RAX, Address(RBP, R10, TIMES_8, 1 * kWordSize)); // Compute argv. | 73 __ leaq(RAX, Address(RBP, R10, TIMES_8, 1 * kWordSize)); // Compute argv. |
| 74 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. | 74 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Save current Context pointer into Isolate structure. | 144 // Save current Context pointer into Isolate structure. |
| 145 __ movq(Address(R8, Isolate::top_context_offset()), CTX); | 145 __ movq(Address(R8, Isolate::top_context_offset()), CTX); |
| 146 | 146 |
| 147 // Cache Isolate pointer into CTX while executing native code. | 147 // Cache Isolate pointer into CTX while executing native code. |
| 148 __ movq(CTX, R8); | 148 __ movq(CTX, R8); |
| 149 | 149 |
| 150 // Reserve space for the native arguments structure passed on the stack (the | 150 // Reserve space for the native arguments structure passed on the stack (the |
| 151 // outgoing pointer parameter to the native arguments structure is passed in | 151 // outgoing pointer parameter to the native arguments structure is passed in |
| 152 // RDI) and align frame before entering the C++ world. | 152 // RDI) and align frame before entering the C++ world. |
| 153 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments))); | 153 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments))); |
| 154 if (OS::ActivationFrameAlignment() > 0) { | 154 if (OS::ActivationFrameAlignment() > 1) { |
| 155 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 155 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Pass NativeArguments structure by value and call native function. | 158 // Pass NativeArguments structure by value and call native function. |
| 159 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. | 159 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| 160 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. | 160 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. |
| 161 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. | 161 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. |
| 162 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. | 162 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. |
| 163 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. | 163 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. |
| 164 __ movq(RDI, RSP); // Pass the pointer to the NativeArguments. | 164 __ movq(RDI, RSP); // Pass the pointer to the NativeArguments. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Save current Context pointer into Isolate structure. | 213 // Save current Context pointer into Isolate structure. |
| 214 __ movq(Address(R8, Isolate::top_context_offset()), CTX); | 214 __ movq(Address(R8, Isolate::top_context_offset()), CTX); |
| 215 | 215 |
| 216 // Cache Isolate pointer into CTX while executing native code. | 216 // Cache Isolate pointer into CTX while executing native code. |
| 217 __ movq(CTX, R8); | 217 __ movq(CTX, R8); |
| 218 | 218 |
| 219 // Reserve space for the native arguments structure passed on the stack (the | 219 // Reserve space for the native arguments structure passed on the stack (the |
| 220 // outgoing pointer parameter to the native arguments structure is passed in | 220 // outgoing pointer parameter to the native arguments structure is passed in |
| 221 // RDI) and align frame before entering the C++ world. | 221 // RDI) and align frame before entering the C++ world. |
| 222 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments))); | 222 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments))); |
| 223 if (OS::ActivationFrameAlignment() > 0) { | 223 if (OS::ActivationFrameAlignment() > 1) { |
| 224 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 224 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Pass NativeArguments structure by value and call native function. | 227 // Pass NativeArguments structure by value and call native function. |
| 228 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. | 228 __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| 229 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. | 229 __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments. |
| 230 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. | 230 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments. |
| 231 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. | 231 __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr. |
| 232 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. | 232 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments. |
| 233 __ movq(RDI, RSP); // Pass the pointer to the NativeArguments. | 233 __ movq(RDI, RSP); // Pass the pointer to the NativeArguments. |
| (...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2228 __ movq(right, Address(RSP, 3 * kWordSize)); | 2228 __ movq(right, Address(RSP, 3 * kWordSize)); |
| 2229 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2229 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2230 __ popq(right); | 2230 __ popq(right); |
| 2231 __ popq(left); | 2231 __ popq(left); |
| 2232 __ ret(); | 2232 __ ret(); |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 } // namespace dart | 2235 } // namespace dart |
| 2236 | 2236 |
| 2237 #endif // defined TARGET_ARCH_X64 | 2237 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |