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 6644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6655 Label skip_to_incremental_compacting; | 6655 Label skip_to_incremental_compacting; |
6656 | 6656 |
6657 // The first two instructions are generated with labels so as to get the | 6657 // The first two instructions are generated with labels so as to get the |
6658 // offset fixed up correctly by the bind(Label*) call. We patch it back and | 6658 // offset fixed up correctly by the bind(Label*) call. We patch it back and |
6659 // forth between a compare instructions (a nop in this position) and the | 6659 // forth between a compare instructions (a nop in this position) and the |
6660 // real branch when we start and stop incremental heap marking. | 6660 // real branch when we start and stop incremental heap marking. |
6661 __ jmp(&skip_to_incremental_noncompacting, Label::kNear); | 6661 __ jmp(&skip_to_incremental_noncompacting, Label::kNear); |
6662 __ jmp(&skip_to_incremental_compacting, Label::kFar); | 6662 __ jmp(&skip_to_incremental_compacting, Label::kFar); |
6663 | 6663 |
6664 if (remembered_set_action_ == EMIT_REMEMBERED_SET) { | 6664 if (remembered_set_action_ == EMIT_REMEMBERED_SET) { |
6665 __ RememberedSetHelper( | 6665 __ RememberedSetHelper(object_, |
6666 address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); | 6666 address_, |
| 6667 value_, |
| 6668 save_fp_regs_mode_, |
| 6669 MacroAssembler::kReturnAtEnd); |
6667 } else { | 6670 } else { |
6668 __ ret(0); | 6671 __ ret(0); |
6669 } | 6672 } |
6670 | 6673 |
6671 __ bind(&skip_to_incremental_noncompacting); | 6674 __ bind(&skip_to_incremental_noncompacting); |
6672 GenerateIncremental(masm, INCREMENTAL); | 6675 GenerateIncremental(masm, INCREMENTAL); |
6673 | 6676 |
6674 __ bind(&skip_to_incremental_compacting); | 6677 __ bind(&skip_to_incremental_compacting); |
6675 GenerateIncremental(masm, INCREMENTAL_COMPACTION); | 6678 GenerateIncremental(masm, INCREMENTAL_COMPACTION); |
6676 | 6679 |
6677 // Initial mode of the stub is expected to be STORE_BUFFER_ONLY. | 6680 // Initial mode of the stub is expected to be STORE_BUFFER_ONLY. |
6678 // Will be checked in IncrementalMarking::ActivateGeneratedStub. | 6681 // Will be checked in IncrementalMarking::ActivateGeneratedStub. |
6679 masm->set_byte_at(0, kTwoByteNopInstruction); | 6682 masm->set_byte_at(0, kTwoByteNopInstruction); |
6680 masm->set_byte_at(2, kFiveByteNopInstruction); | 6683 masm->set_byte_at(2, kFiveByteNopInstruction); |
6681 } | 6684 } |
6682 | 6685 |
6683 | 6686 |
6684 void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) { | 6687 void RecordWriteStub::GenerateIncremental(MacroAssembler* masm, Mode mode) { |
6685 regs_.Save(masm); | 6688 regs_.Save(masm); |
6686 | 6689 |
6687 if (remembered_set_action_ == EMIT_REMEMBERED_SET) { | 6690 if (remembered_set_action_ == EMIT_REMEMBERED_SET) { |
6688 Label dont_need_remembered_set; | 6691 Label dont_need_remembered_set; |
6689 | 6692 |
6690 __ mov(regs_.scratch0(), Operand(regs_.address(), 0)); | 6693 __ mov(regs_.scratch0(), Operand(regs_.address(), 0)); |
6691 __ JumpIfNotInNewSpace(regs_.scratch0(), | 6694 __ JumpIfNotInNewSpace(regs_.scratch0(), // Value. |
6692 regs_.scratch0(), | 6695 regs_.scratch0(), |
6693 &dont_need_remembered_set); | 6696 &dont_need_remembered_set); |
6694 | 6697 |
6695 __ CheckPageFlag(regs_.object(), | 6698 __ CheckPageFlag(regs_.object(), |
6696 regs_.scratch0(), | 6699 regs_.scratch0(), |
6697 1 << MemoryChunk::SCAN_ON_SCAVENGE, | 6700 1 << MemoryChunk::SCAN_ON_SCAVENGE, |
6698 not_zero, | 6701 not_zero, |
6699 &dont_need_remembered_set); | 6702 &dont_need_remembered_set); |
6700 | 6703 |
6701 // First notify the incremental marker if necessary, then update the | 6704 // First notify the incremental marker if necessary, then update the |
6702 // remembered set. | 6705 // remembered set. |
6703 CheckNeedsToInformIncrementalMarker( | 6706 CheckNeedsToInformIncrementalMarker( |
6704 masm, | 6707 masm, |
6705 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, | 6708 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker, |
6706 mode); | 6709 mode); |
6707 InformIncrementalMarker(masm, mode); | 6710 InformIncrementalMarker(masm, mode); |
6708 regs_.Restore(masm); | 6711 regs_.Restore(masm); |
6709 __ RememberedSetHelper( | 6712 __ RememberedSetHelper(object_, |
6710 address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); | 6713 address_, |
| 6714 value_, |
| 6715 save_fp_regs_mode_, |
| 6716 MacroAssembler::kReturnAtEnd); |
6711 | 6717 |
6712 __ bind(&dont_need_remembered_set); | 6718 __ bind(&dont_need_remembered_set); |
6713 } | 6719 } |
6714 | 6720 |
6715 CheckNeedsToInformIncrementalMarker( | 6721 CheckNeedsToInformIncrementalMarker( |
6716 masm, | 6722 masm, |
6717 kReturnOnNoNeedToInformIncrementalMarker, | 6723 kReturnOnNoNeedToInformIncrementalMarker, |
6718 mode); | 6724 mode); |
6719 InformIncrementalMarker(masm, mode); | 6725 InformIncrementalMarker(masm, mode); |
6720 regs_.Restore(masm); | 6726 regs_.Restore(masm); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6763 // Let's look at the color of the object: If it is not black we don't have | 6769 // Let's look at the color of the object: If it is not black we don't have |
6764 // to inform the incremental marker. | 6770 // to inform the incremental marker. |
6765 __ JumpIfBlack(regs_.object(), | 6771 __ JumpIfBlack(regs_.object(), |
6766 regs_.scratch0(), | 6772 regs_.scratch0(), |
6767 regs_.scratch1(), | 6773 regs_.scratch1(), |
6768 &object_is_black, | 6774 &object_is_black, |
6769 Label::kNear); | 6775 Label::kNear); |
6770 | 6776 |
6771 regs_.Restore(masm); | 6777 regs_.Restore(masm); |
6772 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { | 6778 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { |
6773 __ RememberedSetHelper( | 6779 __ RememberedSetHelper(object_, |
6774 address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); | 6780 address_, |
| 6781 value_, |
| 6782 save_fp_regs_mode_, |
| 6783 MacroAssembler::kReturnAtEnd); |
6775 } else { | 6784 } else { |
6776 __ ret(0); | 6785 __ ret(0); |
6777 } | 6786 } |
6778 | 6787 |
6779 __ bind(&object_is_black); | 6788 __ bind(&object_is_black); |
6780 | 6789 |
6781 // Get the value from the slot. | 6790 // Get the value from the slot. |
6782 __ mov(regs_.scratch0(), Operand(regs_.address(), 0)); | 6791 __ mov(regs_.scratch0(), Operand(regs_.address(), 0)); |
6783 | 6792 |
6784 if (mode == INCREMENTAL_COMPACTION) { | 6793 if (mode == INCREMENTAL_COMPACTION) { |
(...skipping 23 matching lines...) Expand all Loading... |
6808 __ push(regs_.object()); | 6817 __ push(regs_.object()); |
6809 __ EnsureNotWhite(regs_.scratch0(), // The value. | 6818 __ EnsureNotWhite(regs_.scratch0(), // The value. |
6810 regs_.scratch1(), // Scratch. | 6819 regs_.scratch1(), // Scratch. |
6811 regs_.object(), // Scratch. | 6820 regs_.object(), // Scratch. |
6812 &need_incremental_pop_object, | 6821 &need_incremental_pop_object, |
6813 Label::kNear); | 6822 Label::kNear); |
6814 __ pop(regs_.object()); | 6823 __ pop(regs_.object()); |
6815 | 6824 |
6816 regs_.Restore(masm); | 6825 regs_.Restore(masm); |
6817 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { | 6826 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { |
6818 __ RememberedSetHelper( | 6827 __ RememberedSetHelper(object_, |
6819 address_, value_, save_fp_regs_mode_, MacroAssembler::kReturnAtEnd); | 6828 address_, |
| 6829 value_, |
| 6830 save_fp_regs_mode_, |
| 6831 MacroAssembler::kReturnAtEnd); |
6820 } else { | 6832 } else { |
6821 __ ret(0); | 6833 __ ret(0); |
6822 } | 6834 } |
6823 | 6835 |
6824 __ bind(&need_incremental_pop_object); | 6836 __ bind(&need_incremental_pop_object); |
6825 __ pop(regs_.object()); | 6837 __ pop(regs_.object()); |
6826 | 6838 |
6827 __ bind(&need_incremental); | 6839 __ bind(&need_incremental); |
6828 | 6840 |
6829 // Fall through when we need to inform the incremental marker. | 6841 // Fall through when we need to inform the incremental marker. |
6830 } | 6842 } |
6831 | 6843 |
6832 | 6844 |
6833 #undef __ | 6845 #undef __ |
6834 | 6846 |
6835 } } // namespace v8::internal | 6847 } } // namespace v8::internal |
6836 | 6848 |
6837 #endif // V8_TARGET_ARCH_IA32 | 6849 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |