Chromium Code Reviews| 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 __ mov(ebx, ebp); | |
| 348 __ add(Operand(ebx), Immediate(kPointerSize)); | |
| 349 | |
| 350 Label do_not_pad, align_loop; | |
| 351 // Align ebp + 4 to a multiple of 2 * kPointerSize. | |
| 352 __ test(ebx, Immediate(kPointerSize)); | |
|
Yang
2013/09/18 09:30:06
Couldn't you test ebp directly? Something like
te
| |
| 353 __ j(not_zero, &do_not_pad, Label::kNear); | |
| 354 __ push(Immediate(0)); | |
| 355 __ mov(ebx, esp); | |
| 356 __ mov(edx, Immediate(kAlignmentPaddingPushed)); | |
| 357 | |
| 358 // Move all parts of the frame over one word. The frame consists of: | |
| 359 // unoptimized frame slots, alignment state, context, frame pointer, return | |
| 360 // address, receiver, and the arguments. | |
| 361 __ mov(ecx, Immediate(scope()->num_parameters() + | |
| 362 5 + graph()->osr()->UnoptimizedFrameSlots())); | |
| 363 | |
| 364 __ bind(&align_loop); | |
| 365 __ mov(eax, Operand(ebx, 1 * kPointerSize)); | |
| 366 __ mov(Operand(ebx, 0), eax); | |
| 367 __ add(Operand(ebx), Immediate(kPointerSize)); | |
| 368 __ dec(ecx); | |
| 369 __ j(not_zero, &align_loop, Label::kNear); | |
| 370 __ mov(Operand(ebx, 0), Immediate(kAlignmentZapValue)); | |
| 371 __ sub(Operand(ebp), Immediate(kPointerSize)); | |
| 372 __ bind(&do_not_pad); | |
|
Yang
2013/09/18 09:30:06
You can probably save a instruction per loop if yo
| |
| 373 } | |
| 374 | |
| 343 // Save the first local, which is overwritten by the alignment state. | 375 // Save the first local, which is overwritten by the alignment state. |
| 344 Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize); | 376 Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize); |
| 345 __ push(alignment_loc); | 377 __ push(alignment_loc); |
| 346 | 378 |
| 347 // Set the dynamic frame alignment state to "not aligned". | 379 // Set the dynamic frame alignment state. |
| 348 __ mov(alignment_loc, Immediate(kNoAlignmentPadding)); | 380 __ mov(alignment_loc, edx); |
| 349 | 381 |
| 350 // Adjust the frame size, subsuming the unoptimized frame into the | 382 // Adjust the frame size, subsuming the unoptimized frame into the |
| 351 // optimized frame. | 383 // optimized frame. |
| 352 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); | 384 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
| 353 ASSERT(slots >= 1); | 385 ASSERT(slots >= 1); |
| 354 __ sub(esp, Immediate((slots - 1) * kPointerSize)); | 386 __ sub(esp, Immediate((slots - 1) * kPointerSize)); |
| 355 } | 387 } |
| 356 | 388 |
| 357 | 389 |
| 358 bool LCodeGen::GenerateBody() { | 390 bool LCodeGen::GenerateBody() { |
| (...skipping 5991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6350 FixedArray::kHeaderSize - kPointerSize)); | 6382 FixedArray::kHeaderSize - kPointerSize)); |
| 6351 __ bind(&done); | 6383 __ bind(&done); |
| 6352 } | 6384 } |
| 6353 | 6385 |
| 6354 | 6386 |
| 6355 #undef __ | 6387 #undef __ |
| 6356 | 6388 |
| 6357 } } // namespace v8::internal | 6389 } } // namespace v8::internal |
| 6358 | 6390 |
| 6359 #endif // V8_TARGET_ARCH_IA32 | 6391 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |