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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 | 334 |
335 | 335 |
336 void LCodeGen::GenerateOsrPrologue() { | 336 void LCodeGen::GenerateOsrPrologue() { |
337 // Generate the OSR entry prologue at the first unknown OSR value, or if there | 337 // Generate the OSR entry prologue at the first unknown OSR value, or if there |
338 // are none, at the OSR entrypoint instruction. | 338 // are none, at the OSR entrypoint instruction. |
339 if (osr_pc_offset_ >= 0) return; | 339 if (osr_pc_offset_ >= 0) return; |
340 | 340 |
341 osr_pc_offset_ = masm()->pc_offset(); | 341 osr_pc_offset_ = masm()->pc_offset(); |
342 | 342 |
| 343 // Move state of dynamic frame alignment into edx. |
| 344 __ mov(edx, Immediate(kNoAlignmentPadding)); |
| 345 |
| 346 if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) { |
| 347 Label do_not_pad, align_loop; |
| 348 // Align ebp + 4 to a multiple of 2 * kPointerSize. |
| 349 __ test(ebp, Immediate(kPointerSize)); |
| 350 __ j(zero, &do_not_pad, Label::kNear); |
| 351 __ push(Immediate(0)); |
| 352 __ mov(ebx, esp); |
| 353 __ mov(edx, Immediate(kAlignmentPaddingPushed)); |
| 354 |
| 355 // Move all parts of the frame over one word. The frame consists of: |
| 356 // unoptimized frame slots, alignment state, context, frame pointer, return |
| 357 // address, receiver, and the arguments. |
| 358 __ mov(ecx, Immediate(scope()->num_parameters() + |
| 359 5 + graph()->osr()->UnoptimizedFrameSlots())); |
| 360 |
| 361 __ bind(&align_loop); |
| 362 __ mov(eax, Operand(ebx, 1 * kPointerSize)); |
| 363 __ mov(Operand(ebx, 0), eax); |
| 364 __ add(Operand(ebx), Immediate(kPointerSize)); |
| 365 __ dec(ecx); |
| 366 __ j(not_zero, &align_loop, Label::kNear); |
| 367 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); |
| 368 __ sub(Operand(ebp), Immediate(kPointerSize)); |
| 369 __ bind(&do_not_pad); |
| 370 } |
| 371 |
343 // Save the first local, which is overwritten by the alignment state. | 372 // Save the first local, which is overwritten by the alignment state. |
344 Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize); | 373 Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize); |
345 __ push(alignment_loc); | 374 __ push(alignment_loc); |
346 | 375 |
347 // Set the dynamic frame alignment state to "not aligned". | 376 // Set the dynamic frame alignment state. |
348 __ mov(alignment_loc, Immediate(kNoAlignmentPadding)); | 377 __ mov(alignment_loc, edx); |
349 | 378 |
350 // Adjust the frame size, subsuming the unoptimized frame into the | 379 // Adjust the frame size, subsuming the unoptimized frame into the |
351 // optimized frame. | 380 // optimized frame. |
352 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); | 381 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
353 ASSERT(slots >= 1); | 382 ASSERT(slots >= 1); |
354 __ sub(esp, Immediate((slots - 1) * kPointerSize)); | 383 __ sub(esp, Immediate((slots - 1) * kPointerSize)); |
355 } | 384 } |
356 | 385 |
357 | 386 |
358 bool LCodeGen::GenerateBody() { | 387 bool LCodeGen::GenerateBody() { |
(...skipping 5991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6350 FixedArray::kHeaderSize - kPointerSize)); | 6379 FixedArray::kHeaderSize - kPointerSize)); |
6351 __ bind(&done); | 6380 __ bind(&done); |
6352 } | 6381 } |
6353 | 6382 |
6354 | 6383 |
6355 #undef __ | 6384 #undef __ |
6356 | 6385 |
6357 } } // namespace v8::internal | 6386 } } // namespace v8::internal |
6358 | 6387 |
6359 #endif // V8_TARGET_ARCH_IA32 | 6388 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |