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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // EDX : number of arguments to the call. | 42 // EDX : number of arguments to the call. |
43 // Must preserve callee saved registers EDI and EBX. | 43 // Must preserve callee saved registers EDI and EBX. |
44 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 44 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
45 const intptr_t thread_offset = NativeArguments::thread_offset(); | 45 const intptr_t thread_offset = NativeArguments::thread_offset(); |
46 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 46 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
47 const intptr_t argv_offset = NativeArguments::argv_offset(); | 47 const intptr_t argv_offset = NativeArguments::argv_offset(); |
48 const intptr_t retval_offset = NativeArguments::retval_offset(); | 48 const intptr_t retval_offset = NativeArguments::retval_offset(); |
49 | 49 |
50 __ EnterFrame(0); | 50 __ EnterFrame(0); |
51 | 51 |
52 __ LoadIsolate(EDI); | |
53 | |
54 // 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 |
55 // to transition to Dart VM C++ code. | 53 // to transition to Dart VM C++ code. |
56 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); | 54 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); |
57 | 55 |
58 #if defined(DEBUG) | 56 #if defined(DEBUG) |
59 { Label ok; | 57 { Label ok; |
60 // Check that we are always entering from Dart code. | 58 // Check that we are always entering from Dart code. |
61 __ cmpl(Address(EDI, Isolate::vm_tag_offset()), | 59 __ cmpl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
62 Immediate(VMTag::kDartTagId)); | |
63 __ j(EQUAL, &ok, Assembler::kNearJump); | 60 __ j(EQUAL, &ok, Assembler::kNearJump); |
64 __ Stop("Not coming from Dart code."); | 61 __ Stop("Not coming from Dart code."); |
65 __ Bind(&ok); | 62 __ Bind(&ok); |
66 } | 63 } |
67 #endif | 64 #endif |
68 | 65 |
69 // Mark that the isolate is executing VM code. | 66 // Mark that the thread is executing VM code. |
70 __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX); | 67 __ movl(Assembler::VMTagAddress(), ECX); |
71 | 68 |
72 // Reserve space for arguments and align frame before entering C++ world. | 69 // Reserve space for arguments and align frame before entering C++ world. |
73 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments))); | 70 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments))); |
74 if (OS::ActivationFrameAlignment() > 1) { | 71 if (OS::ActivationFrameAlignment() > 1) { |
75 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 72 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
76 } | 73 } |
77 | 74 |
78 // Pass NativeArguments structure by value and call runtime. | 75 // Pass NativeArguments structure by value and call runtime. |
79 __ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs. | 76 __ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs. |
80 // There are no runtime calls to closures, so we do not need to set the tag | 77 // There are no runtime calls to closures, so we do not need to set the tag |
81 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 78 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
82 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 79 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
83 // Compute argv. | 80 // Compute argv. |
84 __ leal(EAX, Address(EBP, EDX, TIMES_4, kParamEndSlotFromFp * kWordSize)); | 81 __ leal(EAX, Address(EBP, EDX, TIMES_4, kParamEndSlotFromFp * kWordSize)); |
85 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | 82 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
86 __ addl(EAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument. | 83 __ addl(EAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument. |
87 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. | 84 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. |
88 __ call(ECX); | 85 __ call(ECX); |
89 | 86 |
90 // Mark that the isolate is executing Dart code. EDI is callee saved. | 87 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
91 __ movl(Address(EDI, Isolate::vm_tag_offset()), | |
92 Immediate(VMTag::kDartTagId)); | |
93 | 88 |
94 // Reset exit frame information in Isolate structure. | 89 // Reset exit frame information in Isolate structure. |
95 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); | 90 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); |
96 | 91 |
97 __ LeaveFrame(); | 92 __ LeaveFrame(); |
98 __ ret(); | 93 __ ret(); |
99 } | 94 } |
100 | 95 |
101 | 96 |
102 // Print the stop message. | 97 // Print the stop message. |
(...skipping 15 matching lines...) Expand all Loading... |
118 __ ret(); | 113 __ ret(); |
119 } | 114 } |
120 | 115 |
121 | 116 |
122 // Input parameters: | 117 // Input parameters: |
123 // ESP : points to return address. | 118 // ESP : points to return address. |
124 // ESP + 4 : address of return value. | 119 // ESP + 4 : address of return value. |
125 // EAX : address of first argument in argument array. | 120 // EAX : address of first argument in argument array. |
126 // ECX : address of the native function to call. | 121 // ECX : address of the native function to call. |
127 // EDX : argc_tag including number of arguments and function kind. | 122 // EDX : argc_tag including number of arguments and function kind. |
128 // Uses EDI. | |
129 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { | 123 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { |
130 const intptr_t native_args_struct_offset = | 124 const intptr_t native_args_struct_offset = |
131 NativeEntry::kNumCallWrapperArguments * kWordSize; | 125 NativeEntry::kNumCallWrapperArguments * kWordSize; |
132 const intptr_t thread_offset = | 126 const intptr_t thread_offset = |
133 NativeArguments::thread_offset() + native_args_struct_offset; | 127 NativeArguments::thread_offset() + native_args_struct_offset; |
134 const intptr_t argc_tag_offset = | 128 const intptr_t argc_tag_offset = |
135 NativeArguments::argc_tag_offset() + native_args_struct_offset; | 129 NativeArguments::argc_tag_offset() + native_args_struct_offset; |
136 const intptr_t argv_offset = | 130 const intptr_t argv_offset = |
137 NativeArguments::argv_offset() + native_args_struct_offset; | 131 NativeArguments::argv_offset() + native_args_struct_offset; |
138 const intptr_t retval_offset = | 132 const intptr_t retval_offset = |
139 NativeArguments::retval_offset() + native_args_struct_offset; | 133 NativeArguments::retval_offset() + native_args_struct_offset; |
140 | 134 |
141 __ EnterFrame(0); | 135 __ EnterFrame(0); |
142 | 136 |
143 __ LoadIsolate(EDI); | |
144 | 137 |
145 // Save exit frame information to enable stack walking as we are about | 138 // Save exit frame information to enable stack walking as we are about |
146 // to transition to dart VM code. | 139 // to transition to dart VM code. |
147 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); | 140 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); |
148 | 141 |
149 #if defined(DEBUG) | 142 #if defined(DEBUG) |
150 { Label ok; | 143 { Label ok; |
151 // Check that we are always entering from Dart code. | 144 // Check that we are always entering from Dart code. |
152 __ cmpl(Address(EDI, Isolate::vm_tag_offset()), | 145 __ cmpl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
153 Immediate(VMTag::kDartTagId)); | |
154 __ j(EQUAL, &ok, Assembler::kNearJump); | 146 __ j(EQUAL, &ok, Assembler::kNearJump); |
155 __ Stop("Not coming from Dart code."); | 147 __ Stop("Not coming from Dart code."); |
156 __ Bind(&ok); | 148 __ Bind(&ok); |
157 } | 149 } |
158 #endif | 150 #endif |
159 | 151 |
160 // Mark that the isolate is executing Native code. | 152 // Mark that the thread is executing native code. |
161 __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX); | 153 __ movl(Assembler::VMTagAddress(), ECX); |
162 | 154 |
163 // Reserve space for the native arguments structure, the outgoing parameters | 155 // Reserve space for the native arguments structure, the outgoing parameters |
164 // (pointer to the native arguments structure, the C function entry point) | 156 // (pointer to the native arguments structure, the C function entry point) |
165 // and align frame before entering the C++ world. | 157 // and align frame before entering the C++ world. |
166 __ AddImmediate(ESP, | 158 __ AddImmediate(ESP, |
167 Immediate(-INT32_SIZEOF(NativeArguments) - (2 * kWordSize))); | 159 Immediate(-INT32_SIZEOF(NativeArguments) - (2 * kWordSize))); |
168 if (OS::ActivationFrameAlignment() > 1) { | 160 if (OS::ActivationFrameAlignment() > 1) { |
169 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 161 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
170 } | 162 } |
171 | 163 |
172 // Pass NativeArguments structure by value and call native function. | 164 // Pass NativeArguments structure by value and call native function. |
173 __ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs. | 165 __ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs. |
174 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 166 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
175 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | 167 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
176 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. | 168 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
177 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. | 169 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. |
178 __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments. | 170 __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments. |
179 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. | 171 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. |
180 | 172 |
181 __ movl(Address(ESP, kWordSize), ECX); // Function to call. | 173 __ movl(Address(ESP, kWordSize), ECX); // Function to call. |
182 ExternalLabel label(NativeEntry::NativeCallWrapperEntry()); | 174 ExternalLabel label(NativeEntry::NativeCallWrapperEntry()); |
183 __ call(&label); | 175 __ call(&label); |
184 | 176 |
185 // Mark that the isolate is executing Dart code. EDI is callee saved. | 177 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
186 __ movl(Address(EDI, Isolate::vm_tag_offset()), | |
187 Immediate(VMTag::kDartTagId)); | |
188 | 178 |
189 // Reset exit frame information in Isolate structure. | 179 // Reset exit frame information in Isolate structure. |
190 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); | 180 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); |
191 | 181 |
192 __ LeaveFrame(); | 182 __ LeaveFrame(); |
193 __ ret(); | 183 __ ret(); |
194 } | 184 } |
195 | 185 |
196 | 186 |
197 // Input parameters: | 187 // Input parameters: |
198 // ESP : points to return address. | 188 // ESP : points to return address. |
199 // ESP + 4 : address of return value. | 189 // ESP + 4 : address of return value. |
200 // EAX : address of first argument in argument array. | 190 // EAX : address of first argument in argument array. |
201 // ECX : address of the native function to call. | 191 // ECX : address of the native function to call. |
202 // EDX : argc_tag including number of arguments and function kind. | 192 // EDX : argc_tag including number of arguments and function kind. |
203 // Uses EDI. | |
204 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { | 193 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { |
205 const intptr_t native_args_struct_offset = kWordSize; | 194 const intptr_t native_args_struct_offset = kWordSize; |
206 const intptr_t thread_offset = | 195 const intptr_t thread_offset = |
207 NativeArguments::thread_offset() + native_args_struct_offset; | 196 NativeArguments::thread_offset() + native_args_struct_offset; |
208 const intptr_t argc_tag_offset = | 197 const intptr_t argc_tag_offset = |
209 NativeArguments::argc_tag_offset() + native_args_struct_offset; | 198 NativeArguments::argc_tag_offset() + native_args_struct_offset; |
210 const intptr_t argv_offset = | 199 const intptr_t argv_offset = |
211 NativeArguments::argv_offset() + native_args_struct_offset; | 200 NativeArguments::argv_offset() + native_args_struct_offset; |
212 const intptr_t retval_offset = | 201 const intptr_t retval_offset = |
213 NativeArguments::retval_offset() + native_args_struct_offset; | 202 NativeArguments::retval_offset() + native_args_struct_offset; |
214 | 203 |
215 __ EnterFrame(0); | 204 __ EnterFrame(0); |
216 | 205 |
217 __ LoadIsolate(EDI); | |
218 | |
219 // Save exit frame information to enable stack walking as we are about | 206 // Save exit frame information to enable stack walking as we are about |
220 // to transition to dart VM code. | 207 // to transition to dart VM code. |
221 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); | 208 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), EBP); |
222 | 209 |
223 #if defined(DEBUG) | 210 #if defined(DEBUG) |
224 { Label ok; | 211 { Label ok; |
225 // Check that we are always entering from Dart code. | 212 // Check that we are always entering from Dart code. |
226 __ cmpl(Address(EDI, Isolate::vm_tag_offset()), | 213 __ cmpl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
227 Immediate(VMTag::kDartTagId)); | |
228 __ j(EQUAL, &ok, Assembler::kNearJump); | 214 __ j(EQUAL, &ok, Assembler::kNearJump); |
229 __ Stop("Not coming from Dart code."); | 215 __ Stop("Not coming from Dart code."); |
230 __ Bind(&ok); | 216 __ Bind(&ok); |
231 } | 217 } |
232 #endif | 218 #endif |
233 | 219 |
234 // Mark that the isolate is executing Native code. | 220 // Mark that the thread is executing native code. |
235 __ movl(Address(EDI, Isolate::vm_tag_offset()), ECX); | 221 __ movl(Assembler::VMTagAddress(), ECX); |
236 | 222 |
237 // Reserve space for the native arguments structure, the outgoing parameter | 223 // Reserve space for the native arguments structure, the outgoing parameter |
238 // (pointer to the native arguments structure) and align frame before | 224 // (pointer to the native arguments structure) and align frame before |
239 // entering the C++ world. | 225 // entering the C++ world. |
240 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments) - kWordSize)); | 226 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments) - kWordSize)); |
241 if (OS::ActivationFrameAlignment() > 1) { | 227 if (OS::ActivationFrameAlignment() > 1) { |
242 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 228 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
243 } | 229 } |
244 | 230 |
245 // Pass NativeArguments structure by value and call native function. | 231 // Pass NativeArguments structure by value and call native function. |
246 __ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs. | 232 __ movl(Address(ESP, thread_offset), THR); // Set thread in NativeArgs. |
247 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 233 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
248 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | 234 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
249 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. | 235 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
250 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. | 236 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. |
251 __ leal(EAX, Address(ESP, kWordSize)); // Pointer to the NativeArguments. | 237 __ leal(EAX, Address(ESP, kWordSize)); // Pointer to the NativeArguments. |
252 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. | 238 __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments. |
253 __ call(ECX); | 239 __ call(ECX); |
254 | 240 |
255 // Mark that the isolate is executing Dart code. EDI is callee saved. | 241 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
256 __ movl(Address(EDI, Isolate::vm_tag_offset()), | |
257 Immediate(VMTag::kDartTagId)); | |
258 | 242 |
259 // Reset exit frame information in Isolate structure. | 243 // Reset exit frame information in Isolate structure. |
260 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); | 244 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); |
261 | 245 |
262 __ LeaveFrame(); | 246 __ LeaveFrame(); |
263 __ ret(); | 247 __ ret(); |
264 } | 248 } |
265 | 249 |
266 | 250 |
267 // Input parameters: | 251 // Input parameters: |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 __ movl(EAX, Address(EBP, kThreadOffset)); | 698 __ movl(EAX, Address(EBP, kThreadOffset)); |
715 __ pushl(Address(EAX, Thread::invoke_dart_code_stub_offset())); | 699 __ pushl(Address(EAX, Thread::invoke_dart_code_stub_offset())); |
716 | 700 |
717 // Save C++ ABI callee-saved registers. | 701 // Save C++ ABI callee-saved registers. |
718 __ pushl(EBX); | 702 __ pushl(EBX); |
719 __ pushl(ESI); | 703 __ pushl(ESI); |
720 __ pushl(EDI); | 704 __ pushl(EDI); |
721 | 705 |
722 // Set up THR, which caches the current thread in Dart code. | 706 // Set up THR, which caches the current thread in Dart code. |
723 __ movl(THR, EAX); | 707 __ movl(THR, EAX); |
724 __ LoadIsolate(EDI); | |
725 | 708 |
726 // Save the current VMTag on the stack. | 709 // Save the current VMTag on the stack. |
727 __ movl(ECX, Address(EDI, Isolate::vm_tag_offset())); | 710 __ movl(ECX, Assembler::VMTagAddress()); |
728 __ pushl(ECX); | 711 __ pushl(ECX); |
729 | 712 |
730 // Mark that the isolate is executing Dart code. | 713 // Mark that the thread is executing Dart code. |
731 __ movl(Address(EDI, Isolate::vm_tag_offset()), | 714 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
732 Immediate(VMTag::kDartTagId)); | |
733 | 715 |
734 // Save top resource and top exit frame info. Use EDX as a temporary register. | 716 // Save top resource and top exit frame info. Use EDX as a temporary register. |
735 // StackFrameIterator reads the top exit frame info saved in this frame. | 717 // StackFrameIterator reads the top exit frame info saved in this frame. |
736 __ movl(EDX, Address(THR, Thread::top_resource_offset())); | 718 __ movl(EDX, Address(THR, Thread::top_resource_offset())); |
737 __ pushl(EDX); | 719 __ pushl(EDX); |
738 __ movl(Address(THR, Thread::top_resource_offset()), Immediate(0)); | 720 __ movl(Address(THR, Thread::top_resource_offset()), Immediate(0)); |
739 // The constant kExitLinkSlotFromEntryFp must be kept in sync with the | 721 // The constant kExitLinkSlotFromEntryFp must be kept in sync with the |
740 // code below. | 722 // code below. |
741 ASSERT(kExitLinkSlotFromEntryFp == -7); | 723 ASSERT(kExitLinkSlotFromEntryFp == -7); |
742 __ movl(EDX, Address(THR, Thread::top_exit_frame_info_offset())); | 724 __ movl(EDX, Address(THR, Thread::top_exit_frame_info_offset())); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 // Reread the arguments descriptor array to obtain the number of passed | 761 // Reread the arguments descriptor array to obtain the number of passed |
780 // arguments. | 762 // arguments. |
781 __ movl(EDX, Address(EBP, kArgumentsDescOffset)); | 763 __ movl(EDX, Address(EBP, kArgumentsDescOffset)); |
782 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle)); | 764 __ movl(EDX, Address(EDX, VMHandles::kOffsetOfRawPtrInHandle)); |
783 __ movl(EDX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); | 765 __ movl(EDX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); |
784 // Get rid of arguments pushed on the stack. | 766 // Get rid of arguments pushed on the stack. |
785 __ leal(ESP, Address(ESP, EDX, TIMES_2, 0)); // EDX is a Smi. | 767 __ leal(ESP, Address(ESP, EDX, TIMES_2, 0)); // EDX is a Smi. |
786 | 768 |
787 // Restore the saved top exit frame info and top resource back into the | 769 // Restore the saved top exit frame info and top resource back into the |
788 // Isolate structure. | 770 // Isolate structure. |
789 __ LoadIsolate(EDI); | |
790 __ popl(Address(THR, Thread::top_exit_frame_info_offset())); | 771 __ popl(Address(THR, Thread::top_exit_frame_info_offset())); |
791 __ popl(Address(THR, Thread::top_resource_offset())); | 772 __ popl(Address(THR, Thread::top_resource_offset())); |
792 | 773 |
793 // Restore the current VMTag from the stack. | 774 // Restore the current VMTag from the stack. |
794 __ popl(Address(EDI, Isolate::vm_tag_offset())); | 775 __ popl(Assembler::VMTagAddress()); |
795 | 776 |
796 // Restore C++ ABI callee-saved registers. | 777 // Restore C++ ABI callee-saved registers. |
797 __ popl(EDI); | 778 __ popl(EDI); |
798 __ popl(ESI); | 779 __ popl(ESI); |
799 __ popl(EBX); | 780 __ popl(EBX); |
800 | 781 |
801 // Restore the frame pointer. | 782 // Restore the frame pointer. |
802 __ LeaveFrame(); | 783 __ LeaveFrame(); |
803 | 784 |
804 __ ret(); | 785 __ ret(); |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 // No Result. | 1871 // No Result. |
1891 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1872 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
1892 ASSERT(kExceptionObjectReg == EAX); | 1873 ASSERT(kExceptionObjectReg == EAX); |
1893 ASSERT(kStackTraceObjectReg == EDX); | 1874 ASSERT(kStackTraceObjectReg == EDX); |
1894 __ movl(THR, Address(ESP, 6 * kWordSize)); // Load target thread. | 1875 __ movl(THR, Address(ESP, 6 * kWordSize)); // Load target thread. |
1895 __ movl(kStackTraceObjectReg, Address(ESP, 5 * kWordSize)); | 1876 __ movl(kStackTraceObjectReg, Address(ESP, 5 * kWordSize)); |
1896 __ movl(kExceptionObjectReg, Address(ESP, 4 * kWordSize)); | 1877 __ movl(kExceptionObjectReg, Address(ESP, 4 * kWordSize)); |
1897 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. | 1878 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. |
1898 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. | 1879 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. |
1899 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. | 1880 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. |
1900 // TODO(koda): Pass thread instead of isolate. | |
1901 __ LoadIsolate(EDI); | |
1902 // Set tag. | 1881 // Set tag. |
1903 __ movl(Address(EDI, Isolate::vm_tag_offset()), | 1882 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
1904 Immediate(VMTag::kDartTagId)); | |
1905 // Clear top exit frame. | 1883 // Clear top exit frame. |
1906 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); | 1884 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); |
1907 __ jmp(EBX); // Jump to the exception handler code. | 1885 __ jmp(EBX); // Jump to the exception handler code. |
1908 } | 1886 } |
1909 | 1887 |
1910 | 1888 |
1911 // Calls to the runtime to optimize the given function. | 1889 // Calls to the runtime to optimize the given function. |
1912 // EBX: function to be reoptimized. | 1890 // EBX: function to be reoptimized. |
1913 // EDX: argument descriptor (preserved). | 1891 // EDX: argument descriptor (preserved). |
1914 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1892 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 // EBX: entry point. | 2068 // EBX: entry point. |
2091 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { | 2069 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { |
2092 EmitMegamorphicLookup(assembler, ECX, EBX, EBX); | 2070 EmitMegamorphicLookup(assembler, ECX, EBX, EBX); |
2093 __ ret(); | 2071 __ ret(); |
2094 } | 2072 } |
2095 | 2073 |
2096 | 2074 |
2097 } // namespace dart | 2075 } // namespace dart |
2098 | 2076 |
2099 #endif // defined TARGET_ARCH_IA32 | 2077 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |