Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 678763004: Make CTX allocatable by the register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 // EDX : number of arguments to the call. 40 // EDX : number of arguments to the call.
41 // Must preserve callee saved registers EDI and EBX. 41 // Must preserve callee saved registers EDI and EBX.
42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); 43 const intptr_t isolate_offset = NativeArguments::isolate_offset();
44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
45 const intptr_t argv_offset = NativeArguments::argv_offset(); 45 const intptr_t argv_offset = NativeArguments::argv_offset();
46 const intptr_t retval_offset = NativeArguments::retval_offset(); 46 const intptr_t retval_offset = NativeArguments::retval_offset();
47 47
48 __ EnterFrame(0); 48 __ EnterFrame(0);
49 49
50 __ LoadIsolate(EAX); 50 __ LoadIsolate(EAX);
Vyacheslav Egorov (Google) 2014/10/28 13:44:58 if you were to load isolate into EAX into a callee
Florian Schneider 2014/10/28 19:04:31 Done.
51 51
52 // Save exit frame information to enable stack walking as we are about 52 // Save exit frame information to enable stack walking as we are about
53 // to transition to Dart VM C++ code. 53 // to transition to Dart VM C++ code.
54 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); 54 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP);
55 55
56 #if defined(DEBUG) 56 #if defined(DEBUG)
57 if (FLAG_verify_incoming_contexts) {
58 Label ok;
59 // Check that the isolate's saved ctx is null.
60 const Immediate& raw_null =
61 Immediate(reinterpret_cast<intptr_t>(Object::null()));
62 __ cmpl(Address(EAX, Isolate::top_context_offset()), raw_null);
63 __ j(EQUAL, &ok, Assembler::kNearJump);
64 __ Stop("Found non-null incoming top context: call to runtime stub");
65 __ Bind(&ok);
66 }
67 #endif
68
69 // Save current Context pointer into Isolate structure.
70 __ movl(Address(EAX, Isolate::top_context_offset()), CTX);
71
72 // Cache Isolate pointer into CTX while executing runtime code.
73 __ movl(CTX, EAX);
74
75 #if defined(DEBUG)
76 { Label ok; 57 { Label ok;
77 // Check that we are always entering from Dart code. 58 // Check that we are always entering from Dart code.
78 __ movl(EAX, Address(CTX, Isolate::vm_tag_offset())); 59 __ cmpl(Address(EAX, Isolate::vm_tag_offset()),
79 __ cmpl(EAX, Immediate(VMTag::kDartTagId)); 60 Immediate(VMTag::kDartTagId));
80 __ j(EQUAL, &ok, Assembler::kNearJump); 61 __ j(EQUAL, &ok, Assembler::kNearJump);
81 __ Stop("Not coming from Dart code."); 62 __ Stop("Not coming from Dart code.");
82 __ Bind(&ok); 63 __ Bind(&ok);
83 } 64 }
84 #endif 65 #endif
85 66
86 // Mark that the isolate is executing VM code. 67 // Mark that the isolate is executing VM code.
87 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); 68 __ movl(Address(EAX, Isolate::vm_tag_offset()), ECX);
88 69
89 // Reserve space for arguments and align frame before entering C++ world. 70 // Reserve space for arguments and align frame before entering C++ world.
90 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments))); 71 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments)));
91 if (OS::ActivationFrameAlignment() > 1) { 72 if (OS::ActivationFrameAlignment() > 1) {
92 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); 73 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
93 } 74 }
94 75
95 // Pass NativeArguments structure by value and call runtime. 76 // Pass NativeArguments structure by value and call runtime.
96 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. 77 __ movl(Address(ESP, isolate_offset), EAX); // Set isolate in NativeArgs.
97 // There are no runtime calls to closures, so we do not need to set the tag 78 // There are no runtime calls to closures, so we do not need to set the tag
98 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. 79 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
99 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. 80 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments.
100 __ leal(EAX, Address(EBP, EDX, TIMES_4, 1 * kWordSize)); // Compute argv. 81 __ leal(EAX, Address(EBP, EDX, TIMES_4, 1 * kWordSize)); // Compute argv.
101 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. 82 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments.
102 __ addl(EAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument. 83 __ addl(EAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument.
103 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. 84 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments.
104 __ call(ECX); 85 __ call(ECX);
105 86
106 // Mark that the isolate is executing Dart code. 87 // Mark that the isolate is executing Dart code.
107 __ movl(Address(CTX, Isolate::vm_tag_offset()), 88 __ LoadIsolate(EAX);
89 __ movl(Address(EAX, Isolate::vm_tag_offset()),
108 Immediate(VMTag::kDartTagId)); 90 Immediate(VMTag::kDartTagId));
109 91
110 // Reset exit frame information in Isolate structure. 92 // Reset exit frame information in Isolate structure.
111 __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); 93 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), Immediate(0));
112
113 // Load Context pointer from Isolate structure into ECX.
114 __ movl(ECX, Address(CTX, Isolate::top_context_offset()));
115
116 // Reset Context pointer in Isolate structure.
117 const Immediate& raw_null =
118 Immediate(reinterpret_cast<intptr_t>(Object::null()));
119 __ movl(Address(CTX, Isolate::top_context_offset()), raw_null);
120
121 // Cache Context pointer into CTX while executing Dart code.
122 __ movl(CTX, ECX);
123 94
124 __ LeaveFrame(); 95 __ LeaveFrame();
125 __ ret(); 96 __ ret();
126 } 97 }
127 98
128 99
129 // Print the stop message. 100 // Print the stop message.
130 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { 101 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
131 OS::Print("Stop message: %s\n", message); 102 OS::Print("Stop message: %s\n", message);
132 } 103 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 138
168 __ EnterFrame(0); 139 __ EnterFrame(0);
169 140
170 __ LoadIsolate(EDI); 141 __ LoadIsolate(EDI);
171 142
172 // Save exit frame information to enable stack walking as we are about 143 // Save exit frame information to enable stack walking as we are about
173 // to transition to dart VM code. 144 // to transition to dart VM code.
174 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); 145 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP);
175 146
176 #if defined(DEBUG) 147 #if defined(DEBUG)
177 if (FLAG_verify_incoming_contexts) {
178 Label ok;
179 // Check that the isolate's saved ctx is null.
180 const Immediate& raw_null =
181 Immediate(reinterpret_cast<intptr_t>(Object::null()));
182 __ cmpl(Address(EDI, Isolate::top_context_offset()), raw_null);
183 __ j(EQUAL, &ok, Assembler::kNearJump);
184 __ Stop("Found non-null incoming top context: "
185 "call to native c function stub");
186 __ Bind(&ok);
187 }
188 #endif
189
190 // Save current Context pointer into Isolate structure.
191 __ movl(Address(EDI, Isolate::top_context_offset()), CTX);
192
193 // Cache Isolate pointer into CTX while executing native code.
194 __ movl(CTX, EDI);
195
196 #if defined(DEBUG)
197 { Label ok; 148 { Label ok;
198 // Check that we are always entering from Dart code. 149 // Check that we are always entering from Dart code.
199 __ movl(EDI, Address(CTX, Isolate::vm_tag_offset())); 150 __ cmpl(Address(EDI, Isolate::vm_tag_offset()),
200 __ cmpl(EDI, Immediate(VMTag::kDartTagId)); 151 Immediate(VMTag::kDartTagId));
201 __ j(EQUAL, &ok, Assembler::kNearJump); 152 __ j(EQUAL, &ok, Assembler::kNearJump);
202 __ Stop("Not coming from Dart code."); 153 __ Stop("Not coming from Dart code.");
203 __ Bind(&ok); 154 __ Bind(&ok);
204 } 155 }
205 #endif 156 #endif
206 157
207 // Mark that the isolate is executing Native code. 158 // Mark that the isolate is executing Native code.
208 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); 159 __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX);
209 160
210 // Reserve space for the native arguments structure, the outgoing parameters 161 // Reserve space for the native arguments structure, the outgoing parameters
211 // (pointer to the native arguments structure, the C function entry point) 162 // (pointer to the native arguments structure, the C function entry point)
212 // and align frame before entering the C++ world. 163 // and align frame before entering the C++ world.
213 __ AddImmediate(ESP, 164 __ AddImmediate(ESP,
214 Immediate(-INT32_SIZEOF(NativeArguments) - (2 * kWordSize))); 165 Immediate(-INT32_SIZEOF(NativeArguments) - (2 * kWordSize)));
215 if (OS::ActivationFrameAlignment() > 1) { 166 if (OS::ActivationFrameAlignment() > 1) {
216 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); 167 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
217 } 168 }
218 169
219 // Pass NativeArguments structure by value and call native function. 170 // Pass NativeArguments structure by value and call native function.
220 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. 171 __ movl(Address(ESP, isolate_offset), EDI); // Set isolate in NativeArgs.
221 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. 172 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments.
222 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. 173 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments.
223 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. 174 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr.
224 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. 175 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments.
225 __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments. 176 __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments.
226 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. 177 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments.
227 178
228 __ movl(Address(ESP, kWordSize), ECX); // Function to call. 179 __ movl(Address(ESP, kWordSize), ECX); // Function to call.
229 __ call(&NativeEntry::NativeCallWrapperLabel()); 180 __ call(&NativeEntry::NativeCallWrapperLabel());
230 181
231 // Mark that the isolate is executing Dart code. 182 // Mark that the isolate is executing Dart code.
232 __ movl(Address(CTX, Isolate::vm_tag_offset()), 183 __ LoadIsolate(EDI);
184 __ movl(Address(EDI, Isolate::vm_tag_offset()),
233 Immediate(VMTag::kDartTagId)); 185 Immediate(VMTag::kDartTagId));
234 186
235 // Reset exit frame information in Isolate structure. 187 // Reset exit frame information in Isolate structure.
236 __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); 188 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0));
237
238 // Load Context pointer from Isolate structure into EDI.
239 __ movl(EDI, Address(CTX, Isolate::top_context_offset()));
240
241 // Reset Context pointer in Isolate structure.
242 const Immediate& raw_null =
243 Immediate(reinterpret_cast<intptr_t>(Object::null()));
244 __ movl(Address(CTX, Isolate::top_context_offset()), raw_null);
245
246 // Cache Context pointer into CTX while executing Dart code.
247 __ movl(CTX, EDI);
248 189
249 __ LeaveFrame(); 190 __ LeaveFrame();
250 __ ret(); 191 __ ret();
251 } 192 }
252 193
253 194
254 // Input parameters: 195 // Input parameters:
255 // ESP : points to return address. 196 // ESP : points to return address.
256 // ESP + 4 : address of return value. 197 // ESP + 4 : address of return value.
257 // EAX : address of first argument in argument array. 198 // EAX : address of first argument in argument array.
(...skipping 13 matching lines...) Expand all
271 212
272 __ EnterFrame(0); 213 __ EnterFrame(0);
273 214
274 __ LoadIsolate(EDI); 215 __ LoadIsolate(EDI);
275 216
276 // Save exit frame information to enable stack walking as we are about 217 // Save exit frame information to enable stack walking as we are about
277 // to transition to dart VM code. 218 // to transition to dart VM code.
278 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); 219 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP);
279 220
280 #if defined(DEBUG) 221 #if defined(DEBUG)
281 if (FLAG_verify_incoming_contexts) {
282 Label ok;
283 // Check that the isolate's saved ctx is null.
284 const Immediate& raw_null =
285 Immediate(reinterpret_cast<intptr_t>(Object::null()));
286 __ cmpl(Address(EDI, Isolate::top_context_offset()), raw_null);
287 __ j(EQUAL, &ok, Assembler::kNearJump);
288 __ Stop("Found non-null incoming top context: "
289 "call to bootstrap c function stub");
290 __ Bind(&ok);
291 }
292 #endif
293
294 // Save current Context pointer into Isolate structure.
295 __ movl(Address(EDI, Isolate::top_context_offset()), CTX);
296
297 // Cache Isolate pointer into CTX while executing native code.
298 __ movl(CTX, EDI);
299
300 #if defined(DEBUG)
301 { Label ok; 222 { Label ok;
302 // Check that we are always entering from Dart code. 223 // Check that we are always entering from Dart code.
303 __ movl(EDI, Address(CTX, Isolate::vm_tag_offset())); 224 __ cmpl(Address(EDI, Isolate::vm_tag_offset()),
304 __ cmpl(EDI, Immediate(VMTag::kDartTagId)); 225 Immediate(VMTag::kDartTagId));
305 __ j(EQUAL, &ok, Assembler::kNearJump); 226 __ j(EQUAL, &ok, Assembler::kNearJump);
306 __ Stop("Not coming from Dart code."); 227 __ Stop("Not coming from Dart code.");
307 __ Bind(&ok); 228 __ Bind(&ok);
308 } 229 }
309 #endif 230 #endif
310 231
311 // Mark that the isolate is executing Native code. 232 // Mark that the isolate is executing Native code.
312 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); 233 __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX);
313 234
314 // Reserve space for the native arguments structure, the outgoing parameter 235 // Reserve space for the native arguments structure, the outgoing parameter
315 // (pointer to the native arguments structure) and align frame before 236 // (pointer to the native arguments structure) and align frame before
316 // entering the C++ world. 237 // entering the C++ world.
317 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments) - kWordSize)); 238 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments) - kWordSize));
318 if (OS::ActivationFrameAlignment() > 1) { 239 if (OS::ActivationFrameAlignment() > 1) {
319 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); 240 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
320 } 241 }
321 242
322 // Pass NativeArguments structure by value and call native function. 243 // Pass NativeArguments structure by value and call native function.
323 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. 244 __ movl(Address(ESP, isolate_offset), EDI); // Set isolate in NativeArgs.
324 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. 245 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments.
325 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. 246 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments.
326 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. 247 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr.
327 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. 248 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments.
328 __ leal(EAX, Address(ESP, kWordSize)); // Pointer to the NativeArguments. 249 __ leal(EAX, Address(ESP, kWordSize)); // Pointer to the NativeArguments.
329 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. 250 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments.
330 __ call(ECX); 251 __ call(ECX);
331 252
332 // Mark that the isolate is executing Dart code. 253 // Mark that the isolate is executing Dart code.
333 __ movl(Address(CTX, Isolate::vm_tag_offset()), 254 __ LoadIsolate(EDI);
Vyacheslav Egorov (Google) 2014/10/28 13:44:58 no need to reload, EDI and ESI are both callee sav
Florian Schneider 2014/10/28 19:04:31 Done.
255 __ movl(Address(EDI, Isolate::vm_tag_offset()),
334 Immediate(VMTag::kDartTagId)); 256 Immediate(VMTag::kDartTagId));
335 257
336 // Reset exit frame information in Isolate structure. 258 // Reset exit frame information in Isolate structure.
337 __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0)); 259 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0));
338
339 // Load Context pointer from Isolate structure into EDI.
340 __ movl(EDI, Address(CTX, Isolate::top_context_offset()));
341
342 // Reset Context pointer in Isolate structure.
343 const Immediate& raw_null =
344 Immediate(reinterpret_cast<intptr_t>(Object::null()));
345 __ movl(Address(CTX, Isolate::top_context_offset()), raw_null);
346
347 // Cache Context pointer into CTX while executing Dart code.
348 __ movl(CTX, EDI);
349 260
350 __ LeaveFrame(); 261 __ LeaveFrame();
351 __ ret(); 262 __ ret();
352 } 263 }
353 264
354 265
355 // Input parameters: 266 // Input parameters:
356 // EDX: arguments descriptor array. 267 // EDX: arguments descriptor array.
357 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { 268 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) {
358 const Immediate& raw_null = 269 const Immediate& raw_null =
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 const intptr_t kNewContextOffset = 5 * kWordSize; 699 const intptr_t kNewContextOffset = 5 * kWordSize;
789 700
790 // Save frame pointer coming in. 701 // Save frame pointer coming in.
791 __ EnterFrame(0); 702 __ EnterFrame(0);
792 703
793 // Save C++ ABI callee-saved registers. 704 // Save C++ ABI callee-saved registers.
794 __ pushl(EBX); 705 __ pushl(EBX);
795 __ pushl(ESI); 706 __ pushl(ESI);
796 __ pushl(EDI); 707 __ pushl(EDI);
797 708
798 // The new Context structure contains a pointer to the current Isolate 709 // Pass the new Context pointer in CTX while executing dart code.
799 // structure. Cache the Context pointer in the CTX register so that it is
800 // available in generated code and calls to Isolate::Current() need not be
801 // done. The assumption is that this register will never be clobbered by
802 // compiled or runtime stub code.
803
804 // Cache the new Context pointer into CTX while executing dart code.
805 __ movl(CTX, Address(EBP, kNewContextOffset)); 710 __ movl(CTX, Address(EBP, kNewContextOffset));
806 __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); 711 __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
807 712
808 __ LoadIsolate(EDI); 713 __ LoadIsolate(EDI);
809 714
810 // Save the current VMTag on the stack. 715 // Save the current VMTag on the stack.
811 ASSERT(kSavedVMTagSlotFromEntryFp == -4); 716 ASSERT(kSavedVMTagSlotFromEntryFp == -4);
812 __ movl(ECX, Address(EDI, Isolate::vm_tag_offset())); 717 __ movl(ECX, Address(EDI, Isolate::vm_tag_offset()));
813 __ pushl(ECX); 718 __ pushl(ECX);
814 719
815 // Mark that the isolate is executing Dart code. 720 // Mark that the isolate is executing Dart code.
816 __ movl(Address(EDI, Isolate::vm_tag_offset()), 721 __ movl(Address(EDI, Isolate::vm_tag_offset()),
817 Immediate(VMTag::kDartTagId)); 722 Immediate(VMTag::kDartTagId));
818 723
819 // Save the top exit frame info. Use EDX as a temporary register. 724 // Save the top exit frame info. Use EDX as a temporary register.
820 // StackFrameIterator reads the top exit frame info saved in this frame. 725 // StackFrameIterator reads the top exit frame info saved in this frame.
821 // The constant kExitLinkSlotFromEntryFp must be kept in sync with the 726 // The constant kExitLinkSlotFromEntryFp must be kept in sync with the
822 // code below. 727 // code below.
823 ASSERT(kExitLinkSlotFromEntryFp == -5); 728 ASSERT(kExitLinkSlotFromEntryFp == -5);
824 __ movl(EDX, Address(EDI, Isolate::top_exit_frame_info_offset())); 729 __ movl(EDX, Address(EDI, Isolate::top_exit_frame_info_offset()));
825 __ pushl(EDX); 730 __ pushl(EDX);
826 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0)); 731 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), Immediate(0));
827 732
828 // Save the old Context pointer. Use ECX as a temporary register.
829 // Note that VisitObjectPointers will find this saved Context pointer during
830 // GC marking, since it traverses any information between SP and
831 // FP - kExitLinkSlotFromEntryFp.
832 // EntryFrame::SavedContext reads the context saved in this frame.
833 // The constant kSavedContextSlotFromEntryFp must be kept in sync with
834 // the code below.
835 ASSERT(kSavedContextSlotFromEntryFp == -6);
836 __ movl(ECX, Address(EDI, Isolate::top_context_offset()));
837 __ pushl(ECX);
838
839 // TODO(turnidge): This code should probably be emitted all the time
840 // on all architectures but I am leaving it under DEBUG/flag for
841 // now.
842 #if defined(DEBUG)
843 if (FLAG_verify_incoming_contexts) {
844 // Clear Context pointer in Isolate structure.
845 const Immediate& raw_null =
846 Immediate(reinterpret_cast<intptr_t>(Object::null()));
847 __ movl(Address(EDI, Isolate::top_context_offset()), raw_null);
848 }
849 #endif
850
851 // Load arguments descriptor array into EDX. 733 // Load arguments descriptor array into EDX.
852 __ movl(EDX, Address(EBP, kArgumentsDescOffset)); 734 __ movl(EDX, Address(EBP, kArgumentsDescOffset));
853 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle)); 735 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle));
854 736
855 // Load number of arguments into EBX. 737 // Load number of arguments into EBX.
856 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 738 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
857 __ SmiUntag(EBX); 739 __ SmiUntag(EBX);
858 740
859 // Set up arguments for the dart call. 741 // Set up arguments for the dart call.
860 Label push_arguments; 742 Label push_arguments;
(...skipping 23 matching lines...) Expand all
884 __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); 766 __ movl(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
885 767
886 // Reread the arguments descriptor array to obtain the number of passed 768 // Reread the arguments descriptor array to obtain the number of passed
887 // arguments. 769 // arguments.
888 __ movl(EDX, Address(EBP, kArgumentsDescOffset)); 770 __ movl(EDX, Address(EBP, kArgumentsDescOffset));
889 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle)); 771 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle));
890 __ movl(EDX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 772 __ movl(EDX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
891 // Get rid of arguments pushed on the stack. 773 // Get rid of arguments pushed on the stack.
892 __ leal(ESP, Address(ESP, EDX, TIMES_2, 0)); // EDX is a Smi. 774 __ leal(ESP, Address(ESP, EDX, TIMES_2, 0)); // EDX is a Smi.
893 775
894 // Load Isolate pointer into CTX. Drop Context.
895 __ LoadIsolate(CTX);
896
897 // Restore the saved Context pointer into the Isolate structure.
898 __ popl(Address(CTX, Isolate::top_context_offset()));
899
900 // Restore the saved top exit frame info back into the Isolate structure. 776 // Restore the saved top exit frame info back into the Isolate structure.
901 __ popl(Address(CTX, Isolate::top_exit_frame_info_offset())); 777 __ LoadIsolate(EDI);
778 __ popl(Address(EDI, Isolate::top_exit_frame_info_offset()));
902 779
903 // Restore the current VMTag from the stack. 780 // Restore the current VMTag from the stack.
904 __ popl(Address(CTX, Isolate::vm_tag_offset())); 781 __ popl(Address(EDI, Isolate::vm_tag_offset()));
905 782
906 // Restore C++ ABI callee-saved registers. 783 // Restore C++ ABI callee-saved registers.
907 __ popl(EDI); 784 __ popl(EDI);
908 __ popl(ESI); 785 __ popl(ESI);
909 __ popl(EBX); 786 __ popl(EBX);
910 787
911 // Restore the frame pointer. 788 // Restore the frame pointer.
912 __ LeaveFrame(); 789 __ LeaveFrame();
913 790
914 __ ret(); 791 __ ret();
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset())); 1279 __ movl(EBX, FieldAddress(ECX, ICData::state_bits_offset()));
1403 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. 1280 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed.
1404 __ andl(EBX, Immediate(ICData::NumArgsTestedMask())); 1281 __ andl(EBX, Immediate(ICData::NumArgsTestedMask()));
1405 __ cmpl(EBX, Immediate(num_args)); 1282 __ cmpl(EBX, Immediate(num_args));
1406 __ j(EQUAL, &ok, Assembler::kNearJump); 1283 __ j(EQUAL, &ok, Assembler::kNearJump);
1407 __ Stop("Incorrect stub for IC data"); 1284 __ Stop("Incorrect stub for IC data");
1408 __ Bind(&ok); 1285 __ Bind(&ok);
1409 } 1286 }
1410 #endif // DEBUG 1287 #endif // DEBUG
1411 1288
1412 // Check single stepping.
1413 Label stepping, done_stepping; 1289 Label stepping, done_stepping;
1414 uword single_step_address = reinterpret_cast<uword>(Isolate::Current()) + 1290 uword single_step_address = reinterpret_cast<uword>(Isolate::Current()) +
1415 Isolate::single_step_offset(); 1291 Isolate::single_step_offset();
1416 __ cmpb(Address::Absolute(single_step_address), Immediate(0)); 1292 __ cmpb(Address::Absolute(single_step_address), Immediate(0));
1417 __ j(NOT_EQUAL, &stepping); 1293 __ j(NOT_EQUAL, &stepping);
1418 __ Bind(&done_stepping); 1294 __ Bind(&done_stepping);
1419 1295
1420 if (kind != Token::kILLEGAL) { 1296 if (kind != Token::kILLEGAL) {
1421 Label not_smi_or_overflow; 1297 Label not_smi_or_overflow;
1422 EmitFastSmiOp(assembler, kind, num_args, &not_smi_or_overflow); 1298 EmitFastSmiOp(assembler, kind, num_args, &not_smi_or_overflow);
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 const Register temp = ECX; 1956 const Register temp = ECX;
2081 __ movl(left, Address(ESP, 2 * kWordSize)); 1957 __ movl(left, Address(ESP, 2 * kWordSize));
2082 __ movl(right, Address(ESP, 1 * kWordSize)); 1958 __ movl(right, Address(ESP, 1 * kWordSize));
2083 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1959 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2084 __ ret(); 1960 __ ret();
2085 } 1961 }
2086 1962
2087 } // namespace dart 1963 } // namespace dart
2088 1964
2089 #endif // defined TARGET_ARCH_IA32 1965 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698