OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 Comment(";;; Allocate local context"); | 171 Comment(";;; Allocate local context"); |
172 bool need_write_barrier = true; | 172 bool need_write_barrier = true; |
173 // Argument to NewContext is the function, which is still in edi. | 173 // Argument to NewContext is the function, which is still in edi. |
174 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 174 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
175 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 175 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
176 if (info()->scope()->is_script_scope()) { | 176 if (info()->scope()->is_script_scope()) { |
177 __ push(edi); | 177 __ push(edi); |
178 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); | 178 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
179 __ CallRuntime(Runtime::kNewScriptContext); | 179 __ CallRuntime(Runtime::kNewScriptContext); |
180 deopt_mode = Safepoint::kLazyDeopt; | 180 deopt_mode = Safepoint::kLazyDeopt; |
181 } else if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 181 } else { |
182 FastNewFunctionContextStub stub(isolate(), slots); | 182 FastNewFunctionContextStub stub(isolate()); |
| 183 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
| 184 Immediate(slots)); |
183 __ CallStub(&stub); | 185 __ CallStub(&stub); |
184 // Result of FastNewFunctionContextStub is always in new space. | 186 // Result of FastNewFunctionContextStub is always in new space. |
185 need_write_barrier = false; | 187 need_write_barrier = false; |
186 } else { | |
187 __ push(edi); | |
188 __ CallRuntime(Runtime::kNewFunctionContext); | |
189 } | 188 } |
190 RecordSafepoint(deopt_mode); | 189 RecordSafepoint(deopt_mode); |
191 | 190 |
192 // Context is returned in eax. It replaces the context passed to us. | 191 // Context is returned in eax. It replaces the context passed to us. |
193 // It's saved in the stack and kept live in esi. | 192 // It's saved in the stack and kept live in esi. |
194 __ mov(esi, eax); | 193 __ mov(esi, eax); |
195 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); | 194 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
196 | 195 |
197 // Copy parameters into context if necessary. | 196 // Copy parameters into context if necessary. |
198 int num_parameters = scope()->num_parameters(); | 197 int num_parameters = scope()->num_parameters(); |
(...skipping 5085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5284 __ bind(deferred->exit()); | 5283 __ bind(deferred->exit()); |
5285 __ bind(&done); | 5284 __ bind(&done); |
5286 } | 5285 } |
5287 | 5286 |
5288 #undef __ | 5287 #undef __ |
5289 | 5288 |
5290 } // namespace internal | 5289 } // namespace internal |
5291 } // namespace v8 | 5290 } // namespace v8 |
5292 | 5291 |
5293 #endif // V8_TARGET_ARCH_IA32 | 5292 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |