OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 const int kPageSize = 4 * KB; | 156 const int kPageSize = 4 * KB; |
157 for (int offset = slots * kPointerSize - kPageSize; | 157 for (int offset = slots * kPointerSize - kPageSize; |
158 offset > 0; | 158 offset > 0; |
159 offset -= kPageSize) { | 159 offset -= kPageSize) { |
160 __ mov(Operand(esp, offset), eax); | 160 __ mov(Operand(esp, offset), eax); |
161 } | 161 } |
162 #endif | 162 #endif |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 // Possibly allocate a local context. | |
167 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | |
168 if (heap_slots > 0) { | |
169 Comment(";;; Allocate local context"); | |
170 // Argument to NewContext is the function, which is still in edi. | |
171 __ push(edi); | |
172 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | |
173 FastNewContextStub stub(heap_slots); | |
174 __ CallStub(&stub); | |
175 } else { | |
176 __ CallRuntime(Runtime::kNewContext, 1); | |
177 } | |
178 safepoints_.DefineSafepoint(masm(), Safepoint::kSimple, 0, | |
Mads Ager (chromium)
2011/02/22 08:23:42
I still find this too raw. We should hide this awa
rossberg
2011/02/22 15:00:46
Done: factored out into a new variation of the Rec
| |
179 Safepoint::kNoDeoptimizationIndex); | |
180 // Context is returned in both eax and esi. It replaces the context | |
181 // passed to us. It's saved in the stack and kept live in esi. | |
182 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | |
183 | |
184 // Copy parameters into context if necessary. | |
185 int num_parameters = scope()->num_parameters(); | |
186 for (int i = 0; i < num_parameters; i++) { | |
187 Slot* slot = scope()->parameter(i)->AsSlot(); | |
188 if (slot != NULL && slot->type() == Slot::CONTEXT) { | |
189 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | |
190 (num_parameters - 1 - i) * kPointerSize; | |
191 // Load parameter from stack. | |
192 __ mov(eax, Operand(ebp, parameter_offset)); | |
193 // Store it in the context. | |
194 int context_offset = Context::SlotOffset(slot->index()); | |
195 __ mov(Operand(esi, context_offset), eax); | |
196 // Update the write barrier. This clobbers all involved | |
197 // registers, so we have to use a third register to avoid | |
198 // clobbering esi. | |
199 __ mov(ecx, esi); | |
200 __ RecordWrite(ecx, context_offset, eax, ebx); | |
201 } | |
202 } | |
203 Comment(";;; End allocate local context"); | |
204 } | |
205 | |
166 // Trace the call. | 206 // Trace the call. |
167 if (FLAG_trace) { | 207 if (FLAG_trace) { |
168 // We have not executed any compiled code yet, so esi still holds the | 208 // We have not executed any compiled code yet, so esi still holds the |
169 // incoming context. | 209 // incoming context. |
170 __ CallRuntime(Runtime::kTraceEnter, 0); | 210 __ CallRuntime(Runtime::kTraceEnter, 0); |
171 } | 211 } |
172 return !is_aborted(); | 212 return !is_aborted(); |
173 } | 213 } |
174 | 214 |
175 | 215 |
(...skipping 3624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3800 ASSERT(osr_pc_offset_ == -1); | 3840 ASSERT(osr_pc_offset_ == -1); |
3801 osr_pc_offset_ = masm()->pc_offset(); | 3841 osr_pc_offset_ = masm()->pc_offset(); |
3802 } | 3842 } |
3803 | 3843 |
3804 | 3844 |
3805 #undef __ | 3845 #undef __ |
3806 | 3846 |
3807 } } // namespace v8::internal | 3847 } } // namespace v8::internal |
3808 | 3848 |
3809 #endif // V8_TARGET_ARCH_IA32 | 3849 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |