Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 !rcx.is(object_orig_) && | 638 !rcx.is(object_orig_) && |
| 639 !rcx.is(address_orig_)) { | 639 !rcx.is(address_orig_)) { |
| 640 masm->pop(rcx); | 640 masm->pop(rcx); |
| 641 } | 641 } |
| 642 if (!scratch0_.is(scratch0_orig_)) masm->pop(scratch0_); | 642 if (!scratch0_.is(scratch0_orig_)) masm->pop(scratch0_); |
| 643 } | 643 } |
| 644 | 644 |
| 645 // If we have to call into C then we need to save and restore all caller- | 645 // If we have to call into C then we need to save and restore all caller- |
| 646 // saved registers that were not already preserved. | 646 // saved registers that were not already preserved. |
| 647 | 647 |
| 648 // The three scratch registers (incl. rcx) | 648 // The three scratch registers (incl. rcx) will be restored by other means |
| 649 // will be restored by other means so we don't bother pushing them here. | 649 // so we don't bother pushing them here. Rbx, rbp and r12-15 are callee |
| 650 // save and don't need to be preserved. | |
| 650 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 651 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
|
Lasse Reichstein
2011/06/10 13:55:44
Is this the C+-calling convention saved registers,
Erik Corry
2011/06/10 21:57:29
It's a conservative estimate of the intersection o
| |
| 651 masm->int3(); // TODO(gc): Save the caller save registers. | 652 masm->PushCallerSaved(mode, scratch0_, scratch1_, rcx); |
| 652 if (mode == kSaveFPRegs) { | |
| 653 CpuFeatures::Scope scope(SSE2); | |
| 654 masm->subq(rsp, | |
| 655 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | |
| 656 // Save all XMM registers except XMM0. | |
| 657 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | |
| 658 XMMRegister reg = XMMRegister::from_code(i); | |
| 659 masm->movsd(Operand(rsp, (i - 1) * kDoubleSize), reg); | |
| 660 } | |
| 661 } | |
| 662 } | 653 } |
| 663 | 654 |
| 664 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, | 655 inline void RestoreCallerSaveRegisters(MacroAssembler*masm, |
| 665 SaveFPRegsMode mode) { | 656 SaveFPRegsMode mode) { |
| 666 if (mode == kSaveFPRegs) { | 657 masm->PopCallerSaved(mode, scratch0_, scratch1_, rcx); |
| 667 CpuFeatures::Scope scope(SSE2); | |
| 668 // Restore all XMM registers except XMM0. | |
| 669 for (int i = XMMRegister::kNumRegisters - 1; i > 0; i--) { | |
| 670 XMMRegister reg = XMMRegister::from_code(i); | |
| 671 masm->movsd(reg, Operand(rsp, (i - 1) * kDoubleSize)); | |
| 672 } | |
| 673 masm->addq(rsp, | |
| 674 Immediate(kDoubleSize * (XMMRegister::kNumRegisters - 1))); | |
| 675 } | |
| 676 masm->int3(); // TODO(gc): Restore the caller save registers. | |
| 677 } | 658 } |
| 678 | 659 |
| 679 inline Register object() { return object_; } | 660 inline Register object() { return object_; } |
| 680 inline Register address() { return address_; } | 661 inline Register address() { return address_; } |
| 681 inline Register scratch0() { return scratch0_; } | 662 inline Register scratch0() { return scratch0_; } |
| 682 inline Register scratch1() { return scratch1_; } | 663 inline Register scratch1() { return scratch1_; } |
| 683 | 664 |
| 684 private: | 665 private: |
| 685 Register object_orig_; | 666 Register object_orig_; |
| 686 Register address_orig_; | 667 Register address_orig_; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 701 if (candidate.is(r2)) continue; | 682 if (candidate.is(r2)) continue; |
| 702 if (candidate.is(r3)) continue; | 683 if (candidate.is(r3)) continue; |
| 703 return candidate; | 684 return candidate; |
| 704 } | 685 } |
| 705 UNREACHABLE(); | 686 UNREACHABLE(); |
| 706 return no_reg; | 687 return no_reg; |
| 707 } | 688 } |
| 708 friend class RecordWriteStub; | 689 friend class RecordWriteStub; |
| 709 }; | 690 }; |
| 710 | 691 |
| 692 enum OnNoNeedToInformIncrementalMarker { | |
| 693 kReturnOnNoNeedToInformIncrementalMarker, | |
| 694 kRememberedSetOnNoNeedToInformIncrementalMarker | |
|
Lasse Reichstein
2011/06/10 13:55:44
Do what to remembered set on no need to inform inc
Erik Corry
2011/06/10 21:57:29
Update.
| |
| 695 }; | |
| 696 | |
| 711 void Generate(MacroAssembler* masm); | 697 void Generate(MacroAssembler* masm); |
| 712 void GenerateIncremental(MacroAssembler* masm); | 698 void GenerateIncremental(MacroAssembler* masm); |
| 699 void CheckNeedsToInformIncrementalMarker( | |
| 700 MacroAssembler* masm, | |
| 701 OnNoNeedToInformIncrementalMarker on_no_need); | |
| 702 void InformIncrementalMarker(MacroAssembler* masm); | |
| 713 | 703 |
| 714 Major MajorKey() { return RecordWrite; } | 704 Major MajorKey() { return RecordWrite; } |
| 715 | 705 |
| 716 int MinorKey() { | 706 int MinorKey() { |
| 717 return ObjectBits::encode(object_.code()) | | 707 return ObjectBits::encode(object_.code()) | |
| 718 ValueBits::encode(value_.code()) | | 708 ValueBits::encode(value_.code()) | |
| 719 AddressBits::encode(address_.code()) | | 709 AddressBits::encode(address_.code()) | |
| 720 RememberedSetActionBits::encode(remembered_set_action_) | | 710 RememberedSetActionBits::encode(remembered_set_action_) | |
| 721 SaveFPRegsModeBits::encode(save_fp_regs_mode_); | 711 SaveFPRegsModeBits::encode(save_fp_regs_mode_); |
| 722 } | 712 } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 733 RememberedSetAction remembered_set_action_; | 723 RememberedSetAction remembered_set_action_; |
| 734 SaveFPRegsMode save_fp_regs_mode_; | 724 SaveFPRegsMode save_fp_regs_mode_; |
| 735 Label slow_; | 725 Label slow_; |
| 736 RegisterAllocation regs_; | 726 RegisterAllocation regs_; |
| 737 }; | 727 }; |
| 738 | 728 |
| 739 | 729 |
| 740 } } // namespace v8::internal | 730 } } // namespace v8::internal |
| 741 | 731 |
| 742 #endif // V8_X64_CODE_STUBS_X64_H_ | 732 #endif // V8_X64_CODE_STUBS_X64_H_ |
| OLD | NEW |