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