| 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 DCHECK(is_done()); | 476 DCHECK(is_done()); |
| 477 if (info()->ShouldEnsureSpaceForLazyDeopt()) { | 477 if (info()->ShouldEnsureSpaceForLazyDeopt()) { |
| 478 // For lazy deoptimization we need space to patch a call after every call. | 478 // For lazy deoptimization we need space to patch a call after every call. |
| 479 // Ensure there is always space for such patching, even if the code ends | 479 // Ensure there is always space for such patching, even if the code ends |
| 480 // in a call. | 480 // in a call. |
| 481 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); | 481 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); |
| 482 while (masm()->pc_offset() < target_offset) { | 482 while (masm()->pc_offset() < target_offset) { |
| 483 masm()->nop(); | 483 masm()->nop(); |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 safepoints_.Emit(masm(), GetStackSlotCount()); | 486 safepoints_.Emit(masm(), GetTotalFrameSlotCount()); |
| 487 return !is_aborted(); | 487 return !is_aborted(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 | 490 |
| 491 Register LCodeGen::ToRegister(int code) const { | 491 Register LCodeGen::ToRegister(int code) const { |
| 492 return Register::from_code(code); | 492 return Register::from_code(code); |
| 493 } | 493 } |
| 494 | 494 |
| 495 | 495 |
| 496 XMMRegister LCodeGen::ToDoubleRegister(int code) const { | 496 XMMRegister LCodeGen::ToDoubleRegister(int code) const { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 DCHECK(index < 0); | 564 DCHECK(index < 0); |
| 565 return -(index + 1) * kPointerSize + kPCOnStackSize; | 565 return -(index + 1) * kPointerSize + kPCOnStackSize; |
| 566 } | 566 } |
| 567 | 567 |
| 568 | 568 |
| 569 Operand LCodeGen::ToOperand(LOperand* op) const { | 569 Operand LCodeGen::ToOperand(LOperand* op) const { |
| 570 if (op->IsRegister()) return Operand(ToRegister(op)); | 570 if (op->IsRegister()) return Operand(ToRegister(op)); |
| 571 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); | 571 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); |
| 572 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 572 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 573 if (NeedsEagerFrame()) { | 573 if (NeedsEagerFrame()) { |
| 574 return Operand(ebp, StackSlotOffset(op->index())); | 574 return Operand(ebp, FrameSlotToFPOffset(op->index())); |
| 575 } else { | 575 } else { |
| 576 // Retrieve parameter without eager stack-frame relative to the | 576 // Retrieve parameter without eager stack-frame relative to the |
| 577 // stack-pointer. | 577 // stack-pointer. |
| 578 return Operand(esp, ArgumentsOffsetWithoutFrame(op->index())); | 578 return Operand(esp, ArgumentsOffsetWithoutFrame(op->index())); |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 | 581 |
| 582 | 582 |
| 583 Operand LCodeGen::HighOperand(LOperand* op) { | 583 Operand LCodeGen::HighOperand(LOperand* op) { |
| 584 DCHECK(op->IsDoubleStackSlot()); | 584 DCHECK(op->IsDoubleStackSlot()); |
| 585 if (NeedsEagerFrame()) { | 585 if (NeedsEagerFrame()) { |
| 586 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); | 586 return Operand(ebp, FrameSlotToFPOffset(op->index()) + kPointerSize); |
| 587 } else { | 587 } else { |
| 588 // Retrieve parameter without eager stack-frame relative to the | 588 // Retrieve parameter without eager stack-frame relative to the |
| 589 // stack-pointer. | 589 // stack-pointer. |
| 590 return Operand( | 590 return Operand( |
| 591 esp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); | 591 esp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 | 595 |
| 596 void LCodeGen::WriteTranslation(LEnvironment* environment, | 596 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 environment->HasTaggedValueAt(env_offset + i), | 645 environment->HasTaggedValueAt(env_offset + i), |
| 646 environment->HasUint32ValueAt(env_offset + i), | 646 environment->HasUint32ValueAt(env_offset + i), |
| 647 object_index_pointer, | 647 object_index_pointer, |
| 648 dematerialized_index_pointer); | 648 dematerialized_index_pointer); |
| 649 } | 649 } |
| 650 return; | 650 return; |
| 651 } | 651 } |
| 652 | 652 |
| 653 if (op->IsStackSlot()) { | 653 if (op->IsStackSlot()) { |
| 654 int index = op->index(); | 654 int index = op->index(); |
| 655 if (index >= 0) { | |
| 656 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 657 } | |
| 658 if (is_tagged) { | 655 if (is_tagged) { |
| 659 translation->StoreStackSlot(index); | 656 translation->StoreStackSlot(index); |
| 660 } else if (is_uint32) { | 657 } else if (is_uint32) { |
| 661 translation->StoreUint32StackSlot(index); | 658 translation->StoreUint32StackSlot(index); |
| 662 } else { | 659 } else { |
| 663 translation->StoreInt32StackSlot(index); | 660 translation->StoreInt32StackSlot(index); |
| 664 } | 661 } |
| 665 } else if (op->IsDoubleStackSlot()) { | 662 } else if (op->IsDoubleStackSlot()) { |
| 666 int index = op->index(); | 663 int index = op->index(); |
| 667 if (index >= 0) { | |
| 668 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 669 } | |
| 670 translation->StoreDoubleStackSlot(index); | 664 translation->StoreDoubleStackSlot(index); |
| 671 } else if (op->IsRegister()) { | 665 } else if (op->IsRegister()) { |
| 672 Register reg = ToRegister(op); | 666 Register reg = ToRegister(op); |
| 673 if (is_tagged) { | 667 if (is_tagged) { |
| 674 translation->StoreRegister(reg); | 668 translation->StoreRegister(reg); |
| 675 } else if (is_uint32) { | 669 } else if (is_uint32) { |
| 676 translation->StoreUint32Register(reg); | 670 translation->StoreUint32Register(reg); |
| 677 } else { | 671 } else { |
| 678 translation->StoreInt32Register(reg); | 672 translation->StoreInt32Register(reg); |
| 679 } | 673 } |
| (...skipping 4744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5424 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5418 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5425 } | 5419 } |
| 5426 | 5420 |
| 5427 | 5421 |
| 5428 #undef __ | 5422 #undef __ |
| 5429 | 5423 |
| 5430 } // namespace internal | 5424 } // namespace internal |
| 5431 } // namespace v8 | 5425 } // namespace v8 |
| 5432 | 5426 |
| 5433 #endif // V8_TARGET_ARCH_IA32 | 5427 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |