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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 #ifdef DEBUG | 60 #ifdef DEBUG |
61 state_(IDLE), | 61 state_(IDLE), |
62 #endif | 62 #endif |
63 sweep_precisely_(false), | 63 sweep_precisely_(false), |
64 reduce_memory_footprint_(false), | 64 reduce_memory_footprint_(false), |
65 abort_incremental_marking_(false), | 65 abort_incremental_marking_(false), |
66 marking_parity_(ODD_MARKING_PARITY), | 66 marking_parity_(ODD_MARKING_PARITY), |
67 compacting_(false), | 67 compacting_(false), |
68 was_marked_incrementally_(false), | 68 was_marked_incrementally_(false), |
69 sweeping_pending_(false), | 69 sweeping_pending_(false), |
70 sequential_sweeping_(false), | |
70 tracer_(NULL), | 71 tracer_(NULL), |
71 migration_slots_buffer_(NULL), | 72 migration_slots_buffer_(NULL), |
72 heap_(NULL), | 73 heap_(NULL), |
73 code_flusher_(NULL), | 74 code_flusher_(NULL), |
74 encountered_weak_maps_(NULL) { } | 75 encountered_weak_maps_(NULL) { } |
75 | 76 |
76 | 77 |
77 #ifdef VERIFY_HEAP | 78 #ifdef VERIFY_HEAP |
78 class VerifyMarkingVisitor: public ObjectVisitor { | 79 class VerifyMarkingVisitor: public ObjectVisitor { |
79 public: | 80 public: |
(...skipping 3808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3888 FLAG_lazy_sweeping ? LAZY_CONSERVATIVE : CONSERVATIVE; | 3889 FLAG_lazy_sweeping ? LAZY_CONSERVATIVE : CONSERVATIVE; |
3889 if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE; | 3890 if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE; |
3890 if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE; | 3891 if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE; |
3891 if (FLAG_expose_gc) how_to_sweep = CONSERVATIVE; | 3892 if (FLAG_expose_gc) how_to_sweep = CONSERVATIVE; |
3892 if (sweep_precisely_) how_to_sweep = PRECISE; | 3893 if (sweep_precisely_) how_to_sweep = PRECISE; |
3893 // Noncompacting collections simply sweep the spaces to clear the mark | 3894 // Noncompacting collections simply sweep the spaces to clear the mark |
3894 // bits and free the nonlive blocks (for old and map spaces). We sweep | 3895 // bits and free the nonlive blocks (for old and map spaces). We sweep |
3895 // the map space last because freeing non-live maps overwrites them and | 3896 // the map space last because freeing non-live maps overwrites them and |
3896 // the other spaces rely on possibly non-live maps to get the sizes for | 3897 // the other spaces rely on possibly non-live maps to get the sizes for |
3897 // non-live objects. | 3898 // non-live objects. |
3899 { SweepingScope scope(this); | |
Michael Starzinger
2013/03/05 17:20:11
Since the scope extends till the end of this funct
Hannes Payer (out of office)
2013/03/05 17:27:04
Done.
| |
3900 SweepSpace(heap()->old_pointer_space(), how_to_sweep); | |
3901 SweepSpace(heap()->old_data_space(), how_to_sweep); | |
3898 | 3902 |
3899 SweepSpace(heap()->old_pointer_space(), how_to_sweep); | 3903 if (how_to_sweep == PARALLEL_CONSERVATIVE || |
3900 SweepSpace(heap()->old_data_space(), how_to_sweep); | 3904 how_to_sweep == CONCURRENT_CONSERVATIVE) { |
3905 // TODO(hpayer): fix race with concurrent sweeper | |
3906 StartSweeperThreads(); | |
3907 } | |
3901 | 3908 |
3902 if (how_to_sweep == PARALLEL_CONSERVATIVE || | 3909 if (how_to_sweep == PARALLEL_CONSERVATIVE) { |
3903 how_to_sweep == CONCURRENT_CONSERVATIVE) { | 3910 WaitUntilSweepingCompleted(); |
3904 // TODO(hpayer): fix race with concurrent sweeper | 3911 } |
3905 StartSweeperThreads(); | |
3906 } | |
3907 | 3912 |
3908 if (how_to_sweep == PARALLEL_CONSERVATIVE) { | 3913 RemoveDeadInvalidatedCode(); |
3909 WaitUntilSweepingCompleted(); | 3914 SweepSpace(heap()->code_space(), PRECISE); |
3910 } | |
3911 | 3915 |
3912 RemoveDeadInvalidatedCode(); | 3916 SweepSpace(heap()->cell_space(), PRECISE); |
3913 SweepSpace(heap()->code_space(), PRECISE); | |
3914 | 3917 |
3915 SweepSpace(heap()->cell_space(), PRECISE); | 3918 EvacuateNewSpaceAndCandidates(); |
3916 | 3919 |
3917 EvacuateNewSpaceAndCandidates(); | 3920 // ClearNonLiveTransitions depends on precise sweeping of map space to |
3921 // detect whether unmarked map became dead in this collection or in one | |
3922 // of the previous ones. | |
3923 SweepSpace(heap()->map_space(), PRECISE); | |
3918 | 3924 |
3919 // ClearNonLiveTransitions depends on precise sweeping of map space to | 3925 // Deallocate unmarked objects and clear marked bits for marked objects. |
3920 // detect whether unmarked map became dead in this collection or in one | 3926 heap_->lo_space()->FreeUnmarkedObjects(); |
3921 // of the previous ones. | |
3922 SweepSpace(heap()->map_space(), PRECISE); | |
3923 | 3927 |
3924 // Deallocate unmarked objects and clear marked bits for marked objects. | 3928 if (how_to_sweep != CONCURRENT_CONSERVATIVE) { |
3925 heap_->lo_space()->FreeUnmarkedObjects(); | 3929 FinalizeSweeping(); |
3926 | 3930 } |
3927 if (how_to_sweep != CONCURRENT_CONSERVATIVE) { | |
3928 FinalizeSweeping(); | |
3929 } | 3931 } |
3930 } | 3932 } |
3931 | 3933 |
3932 | 3934 |
3933 void MarkCompactCollector::EnableCodeFlushing(bool enable) { | 3935 void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
3934 #ifdef ENABLE_DEBUGGER_SUPPORT | 3936 #ifdef ENABLE_DEBUGGER_SUPPORT |
3935 if (heap()->isolate()->debug()->IsLoaded() || | 3937 if (heap()->isolate()->debug()->IsLoaded() || |
3936 heap()->isolate()->debug()->has_break_points()) { | 3938 heap()->isolate()->debug()->has_break_points()) { |
3937 enable = false; | 3939 enable = false; |
3938 } | 3940 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4120 while (buffer != NULL) { | 4122 while (buffer != NULL) { |
4121 SlotsBuffer* next_buffer = buffer->next(); | 4123 SlotsBuffer* next_buffer = buffer->next(); |
4122 DeallocateBuffer(buffer); | 4124 DeallocateBuffer(buffer); |
4123 buffer = next_buffer; | 4125 buffer = next_buffer; |
4124 } | 4126 } |
4125 *buffer_address = NULL; | 4127 *buffer_address = NULL; |
4126 } | 4128 } |
4127 | 4129 |
4128 | 4130 |
4129 } } // namespace v8::internal | 4131 } } // namespace v8::internal |
OLD | NEW |