OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) { | 285 if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) { |
286 SaveCallerDoubles(); | 286 SaveCallerDoubles(); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 // Possibly allocate a local context. | 290 // Possibly allocate a local context. |
291 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 291 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
292 if (heap_slots > 0) { | 292 if (heap_slots > 0) { |
293 Comment(";;; Allocate local context"); | 293 Comment(";;; Allocate local context"); |
294 // Argument to NewContext is the function, which is still in edi. | 294 // Argument to NewContext is the function, which is still in edi. |
295 __ push(edi); | |
296 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 295 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
297 FastNewContextStub stub(heap_slots); | 296 FastNewContextStub stub(heap_slots); |
298 __ CallStub(&stub); | 297 __ CallStub(&stub); |
299 } else { | 298 } else { |
| 299 __ push(edi); |
300 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 300 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
301 } | 301 } |
302 RecordSafepoint(Safepoint::kNoLazyDeopt); | 302 RecordSafepoint(Safepoint::kNoLazyDeopt); |
303 // Context is returned in both eax and esi. It replaces the context | 303 // Context is returned in eax. It replaces the context passed to us. |
304 // passed to us. It's saved in the stack and kept live in esi. | 304 // It's saved in the stack and kept live in esi. |
305 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | 305 __ mov(esi, eax); |
| 306 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
306 | 307 |
307 // Copy parameters into context if necessary. | 308 // Copy parameters into context if necessary. |
308 int num_parameters = scope()->num_parameters(); | 309 int num_parameters = scope()->num_parameters(); |
309 for (int i = 0; i < num_parameters; i++) { | 310 for (int i = 0; i < num_parameters; i++) { |
310 Variable* var = scope()->parameter(i); | 311 Variable* var = scope()->parameter(i); |
311 if (var->IsContextSlot()) { | 312 if (var->IsContextSlot()) { |
312 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 313 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
313 (num_parameters - 1 - i) * kPointerSize; | 314 (num_parameters - 1 - i) * kPointerSize; |
314 // Load parameter from stack. | 315 // Load parameter from stack. |
315 __ mov(eax, Operand(ebp, parameter_offset)); | 316 __ mov(eax, Operand(ebp, parameter_offset)); |
(...skipping 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6355 FixedArray::kHeaderSize - kPointerSize)); | 6356 FixedArray::kHeaderSize - kPointerSize)); |
6356 __ bind(&done); | 6357 __ bind(&done); |
6357 } | 6358 } |
6358 | 6359 |
6359 | 6360 |
6360 #undef __ | 6361 #undef __ |
6361 | 6362 |
6362 } } // namespace v8::internal | 6363 } } // namespace v8::internal |
6363 | 6364 |
6364 #endif // V8_TARGET_ARCH_IA32 | 6365 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |