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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 void LCodeGen::GenerateOsrPrologue() { | 314 void LCodeGen::GenerateOsrPrologue() { |
315 // Generate the OSR entry prologue at the first unknown OSR value, or if there | 315 // Generate the OSR entry prologue at the first unknown OSR value, or if there |
316 // are none, at the OSR entrypoint instruction. | 316 // are none, at the OSR entrypoint instruction. |
317 if (osr_pc_offset_ >= 0) return; | 317 if (osr_pc_offset_ >= 0) return; |
318 | 318 |
319 osr_pc_offset_ = masm()->pc_offset(); | 319 osr_pc_offset_ = masm()->pc_offset(); |
320 | 320 |
321 // Move state of dynamic frame alignment into edx. | 321 // Move state of dynamic frame alignment into edx. |
322 __ Move(edx, Immediate(kNoAlignmentPadding)); | 322 __ Move(edx, Immediate(kNoAlignmentPadding)); |
323 | 323 |
| 324 Label remove_vector_finished; |
| 325 int unoptimized_slots = graph()->osr()->UnoptimizedFrameSlots(); |
324 if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { | 326 if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { |
325 Label do_not_pad, align_loop; | 327 Label do_not_pad, align_loop; |
326 // Align ebp + 4 to a multiple of 2 * kPointerSize. | 328 // Align ebp + 4 to a multiple of 2 * kPointerSize. |
327 __ test(ebp, Immediate(kPointerSize)); | 329 __ test(ebp, Immediate(kPointerSize)); |
328 __ j(zero, &do_not_pad, Label::kNear); | 330 __ j(zero, &do_not_pad, Label::kNear); |
329 __ push(Immediate(0)); | 331 |
330 __ mov(ebx, esp); | 332 __ mov(ebx, esp); |
| 333 __ add(Operand(ebx), Immediate(kPointerSize * unoptimized_slots)); |
331 __ mov(edx, Immediate(kAlignmentPaddingPushed)); | 334 __ mov(edx, Immediate(kAlignmentPaddingPushed)); |
332 | 335 |
333 // Move all parts of the frame over one word. The frame consists of: | 336 // Move the receiver, parameters and fixed part of the frame above the type |
334 // unoptimized frame slots, alignment state, context, frame pointer, return | 337 // feedback vector over one word, stomping on the vector. |
335 // address, receiver, and the arguments. | 338 __ mov(ecx, |
336 __ mov(ecx, Immediate(scope()->num_parameters() + | 339 Immediate(1 + scope()->num_parameters() + |
337 5 + graph()->osr()->UnoptimizedFrameSlots())); | 340 StandardFrameConstants::kFixedFrameSize / kPointerSize)); |
338 | 341 |
339 __ bind(&align_loop); | 342 __ bind(&align_loop); |
340 __ mov(eax, Operand(ebx, 1 * kPointerSize)); | 343 __ mov(eax, Operand(ebx, 1 * kPointerSize)); |
341 __ mov(Operand(ebx, 0), eax); | 344 __ mov(Operand(ebx, 0), eax); |
342 __ add(Operand(ebx), Immediate(kPointerSize)); | 345 __ add(Operand(ebx), Immediate(kPointerSize)); |
343 __ dec(ecx); | 346 __ dec(ecx); |
344 __ j(not_zero, &align_loop, Label::kNear); | 347 __ j(not_zero, &align_loop, Label::kNear); |
345 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); | 348 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); |
346 __ sub(Operand(ebp), Immediate(kPointerSize)); | 349 __ sub(Operand(ebp), Immediate(kPointerSize)); |
| 350 __ jmp(&remove_vector_finished); |
347 __ bind(&do_not_pad); | 351 __ bind(&do_not_pad); |
| 352 // We have to move locals over one. |
| 353 __ OSRDropVectorFromStack(unoptimized_slots, ebx, eax); |
| 354 } else { |
| 355 // Need to copy locals over by one. |
| 356 __ OSRDropVectorFromStack(unoptimized_slots, ebx, eax); |
348 } | 357 } |
349 | 358 |
| 359 __ bind(&remove_vector_finished); |
350 // Save the first local, which is overwritten by the alignment state. | 360 // Save the first local, which is overwritten by the alignment state. |
351 Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize); | 361 Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize); |
352 __ push(alignment_loc); | 362 __ push(alignment_loc); |
353 | 363 |
354 // Set the dynamic frame alignment state. | 364 // Set the dynamic frame alignment state. |
355 __ mov(alignment_loc, edx); | 365 __ mov(alignment_loc, edx); |
356 | 366 |
357 // Adjust the frame size, subsuming the unoptimized frame into the | 367 // Adjust the frame size, subsuming the unoptimized frame into the |
358 // optimized frame. | 368 // optimized frame. |
359 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); | 369 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
(...skipping 5413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5773 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5783 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5774 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5784 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5775 } | 5785 } |
5776 | 5786 |
5777 | 5787 |
5778 #undef __ | 5788 #undef __ |
5779 | 5789 |
5780 } } // namespace v8::internal | 5790 } } // namespace v8::internal |
5781 | 5791 |
5782 #endif // V8_TARGET_ARCH_IA32 | 5792 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |