Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1038653003: Change halfway-to-the-max GC trigger to measure committed pages, not allocated objects Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix thinko Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // ------------------------------------------------------------------------- 35 // -------------------------------------------------------------------------
36 // MarkCompactCollector 36 // MarkCompactCollector
37 37
38 MarkCompactCollector::MarkCompactCollector(Heap* heap) 38 MarkCompactCollector::MarkCompactCollector(Heap* heap)
39 : // NOLINT 39 : // NOLINT
40 #ifdef DEBUG 40 #ifdef DEBUG
41 state_(IDLE), 41 state_(IDLE),
42 #endif 42 #endif
43 reduce_memory_footprint_(false), 43 reduce_memory_footprint_(false),
44 abort_incremental_marking_(false), 44 incremental_marking_abort_requested_(false),
45 marking_parity_(ODD_MARKING_PARITY), 45 marking_parity_(ODD_MARKING_PARITY),
46 compacting_(false), 46 compacting_(false),
47 was_marked_incrementally_(false), 47 was_marked_incrementally_(false),
48 sweeping_in_progress_(false), 48 sweeping_in_progress_(false),
49 pending_sweeper_jobs_semaphore_(0), 49 pending_sweeper_jobs_semaphore_(0),
50 evacuation_(false), 50 evacuation_(false),
51 migration_slots_buffer_(NULL), 51 migration_slots_buffer_(NULL),
52 heap_(heap), 52 heap_(heap),
53 marking_deque_memory_(NULL), 53 marking_deque_memory_(NULL),
54 marking_deque_memory_committed_(false), 54 marking_deque_memory_committed_(false),
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 #endif 895 #endif
896 896
897 DCHECK(!FLAG_never_compact || !FLAG_always_compact); 897 DCHECK(!FLAG_never_compact || !FLAG_always_compact);
898 898
899 if (sweeping_in_progress()) { 899 if (sweeping_in_progress()) {
900 // Instead of waiting we could also abort the sweeper threads here. 900 // Instead of waiting we could also abort the sweeper threads here.
901 EnsureSweepingCompleted(); 901 EnsureSweepingCompleted();
902 } 902 }
903 903
904 // Clear marking bits if incremental marking is aborted. 904 // Clear marking bits if incremental marking is aborted.
905 if (was_marked_incrementally_ && abort_incremental_marking_) { 905 if (was_marked_incrementally_ && incremental_marking_abort_requested_) {
906 heap()->incremental_marking()->Abort(); 906 heap()->incremental_marking()->Abort();
907 ClearMarkbits(); 907 ClearMarkbits();
908 AbortWeakCollections(); 908 AbortWeakCollections();
909 AbortWeakCells(); 909 AbortWeakCells();
910 AbortCompaction(); 910 AbortCompaction();
911 was_marked_incrementally_ = false; 911 was_marked_incrementally_ = false;
912 } 912 }
913 913
914 // Don't start compaction if we are in the middle of incremental 914 // Don't start compaction if we are in the middle of incremental
915 // marking cycle. We did not collect any slots. 915 // marking cycle. We did not collect any slots.
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 code->CodeIterateBody(visitor); 2176 code->CodeIterateBody(visitor);
2177 } 2177 }
2178 ProcessMarkingDeque(); 2178 ProcessMarkingDeque();
2179 return; 2179 return;
2180 } 2180 }
2181 } 2181 }
2182 } 2182 }
2183 2183
2184 2184
2185 void MarkCompactCollector::RetainMaps() { 2185 void MarkCompactCollector::RetainMaps() {
2186 if (reduce_memory_footprint_ || abort_incremental_marking_ || 2186 if (reduce_memory_footprint_ || incremental_marking_abort_requested_ ||
2187 FLAG_retain_maps_for_n_gc == 0) { 2187 FLAG_retain_maps_for_n_gc == 0) {
2188 // Do not retain dead maps if flag disables it or there is 2188 // Do not retain dead maps if flag disables it or there is
2189 // - memory pressure (reduce_memory_footprint_), 2189 // - memory pressure (reduce_memory_footprint_),
2190 // - GC is requested by tests or dev-tools (abort_incremental_marking_). 2190 // - GC is requested by tests or dev-tools
2191 // (incremental_marking_abort_requested_).
2191 return; 2192 return;
2192 } 2193 }
2193 2194
2194 ArrayList* retained_maps = heap()->retained_maps(); 2195 ArrayList* retained_maps = heap()->retained_maps();
2195 int length = retained_maps->Length(); 2196 int length = retained_maps->Length();
2196 int new_length = 0; 2197 int new_length = 0;
2197 for (int i = 0; i < length; i += 2) { 2198 for (int i = 0; i < length; i += 2) {
2198 DCHECK(retained_maps->Get(i)->IsWeakCell()); 2199 DCHECK(retained_maps->Get(i)->IsWeakCell());
2199 WeakCell* cell = WeakCell::cast(retained_maps->Get(i)); 2200 WeakCell* cell = WeakCell::cast(retained_maps->Get(i));
2200 if (cell->cleared()) continue; 2201 if (cell->cleared()) continue;
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after
4797 SlotsBuffer* buffer = *buffer_address; 4798 SlotsBuffer* buffer = *buffer_address;
4798 while (buffer != NULL) { 4799 while (buffer != NULL) {
4799 SlotsBuffer* next_buffer = buffer->next(); 4800 SlotsBuffer* next_buffer = buffer->next();
4800 DeallocateBuffer(buffer); 4801 DeallocateBuffer(buffer);
4801 buffer = next_buffer; 4802 buffer = next_buffer;
4802 } 4803 }
4803 *buffer_address = NULL; 4804 *buffer_address = NULL;
4804 } 4805 }
4805 } 4806 }
4806 } // namespace v8::internal 4807 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698