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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. | 159 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
160 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 160 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
161 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | 161 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
162 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. | 162 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
163 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. | 163 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. |
164 __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments. | 164 __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments. |
165 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. | 165 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. |
| 166 |
| 167 // Call native function (setsup scope if not leaf function). |
| 168 Label leaf_call; |
| 169 Label done; |
| 170 __ testl(EDX, Immediate(NativeArguments::AutoSetupScopeMask())); |
| 171 __ j(ZERO, &leaf_call, Assembler::kNearJump); |
166 __ movl(Address(ESP, kWordSize), ECX); // Function to call. | 172 __ movl(Address(ESP, kWordSize), ECX); // Function to call. |
167 __ call(&NativeEntry::NativeCallWrapperLabel()); | 173 __ call(&NativeEntry::NativeCallWrapperLabel()); |
| 174 __ jmp(&done); |
| 175 __ Bind(&leaf_call); |
| 176 __ call(ECX); |
| 177 __ Bind(&done); |
168 | 178 |
169 // Reset exit frame information in Isolate structure. | 179 // Reset exit frame information in Isolate structure. |
170 __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); | 180 __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); |
171 | 181 |
172 // Load Context pointer from Isolate structure into EDI. | 182 // Load Context pointer from Isolate structure into EDI. |
173 __ movl(EDI, Address(CTX, Isolate::top_context_offset())); | 183 __ movl(EDI, Address(CTX, Isolate::top_context_offset())); |
174 | 184 |
175 // Reset Context pointer in Isolate structure. | 185 // Reset Context pointer in Isolate structure. |
176 const Immediate& raw_null = | 186 const Immediate& raw_null = |
177 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 187 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 const Register temp = ECX; | 2210 const Register temp = ECX; |
2201 __ movl(left, Address(ESP, 2 * kWordSize)); | 2211 __ movl(left, Address(ESP, 2 * kWordSize)); |
2202 __ movl(right, Address(ESP, 1 * kWordSize)); | 2212 __ movl(right, Address(ESP, 1 * kWordSize)); |
2203 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2213 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2204 __ ret(); | 2214 __ ret(); |
2205 } | 2215 } |
2206 | 2216 |
2207 } // namespace dart | 2217 } // namespace dart |
2208 | 2218 |
2209 #endif // defined TARGET_ARCH_IA32 | 2219 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |