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

Side by Side Diff: src/heap/spaces.cc

Issue 2861763002: [heap] Add GC accounting to slow allocation and incremental marking job (Closed)
Patch Set: Add includes Created 3 years, 7 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/heap/spaces.h" 5 #include "src/heap/spaces.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
11 #include "src/base/platform/semaphore.h" 11 #include "src/base/platform/semaphore.h"
12 #include "src/counters.h" 12 #include "src/counters.h"
13 #include "src/full-codegen/full-codegen.h" 13 #include "src/full-codegen/full-codegen.h"
14 #include "src/heap/array-buffer-tracker.h" 14 #include "src/heap/array-buffer-tracker.h"
15 #include "src/heap/incremental-marking.h" 15 #include "src/heap/incremental-marking.h"
16 #include "src/heap/mark-compact.h" 16 #include "src/heap/mark-compact.h"
17 #include "src/heap/slot-set.h" 17 #include "src/heap/slot-set.h"
18 #include "src/macro-assembler.h" 18 #include "src/macro-assembler.h"
19 #include "src/msan.h" 19 #include "src/msan.h"
20 #include "src/objects-inl.h" 20 #include "src/objects-inl.h"
21 #include "src/snapshot/snapshot.h" 21 #include "src/snapshot/snapshot.h"
22 #include "src/v8.h" 22 #include "src/v8.h"
23 #include "src/vm-state-inl.h"
23 24
24 namespace v8 { 25 namespace v8 {
25 namespace internal { 26 namespace internal {
26 27
27 28
28 // ---------------------------------------------------------------------------- 29 // ----------------------------------------------------------------------------
29 // HeapObjectIterator 30 // HeapObjectIterator
30 31
31 HeapObjectIterator::HeapObjectIterator(PagedSpace* space) 32 HeapObjectIterator::HeapObjectIterator(PagedSpace* space)
32 : cur_addr_(nullptr), 33 : cur_addr_(nullptr),
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2889 HeapObject* CompactionSpace::SweepAndRetryAllocation(int size_in_bytes) { 2890 HeapObject* CompactionSpace::SweepAndRetryAllocation(int size_in_bytes) {
2890 MarkCompactCollector* collector = heap()->mark_compact_collector(); 2891 MarkCompactCollector* collector = heap()->mark_compact_collector();
2891 if (collector->sweeping_in_progress()) { 2892 if (collector->sweeping_in_progress()) {
2892 collector->SweepAndRefill(this); 2893 collector->SweepAndRefill(this);
2893 return free_list_.Allocate(size_in_bytes); 2894 return free_list_.Allocate(size_in_bytes);
2894 } 2895 }
2895 return nullptr; 2896 return nullptr;
2896 } 2897 }
2897 2898
2898 HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) { 2899 HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
2900 // Allocation in this space has failed.
2899 DCHECK_GE(size_in_bytes, 0); 2901 DCHECK_GE(size_in_bytes, 0);
2900 const int kMaxPagesToSweep = 1; 2902 const int kMaxPagesToSweep = 1;
2901 2903
2902 // Allocation in this space has failed. 2904 VMState<GC> state(heap()->isolate());
2905 RuntimeCallTimerScope(heap()->isolate(), &RuntimeCallStats::GC);
Camillo Bruni 2017/05/03 16:25:56 same here?
Michael Lippautz 2017/05/03 16:32:00 Used GC_SlowAllocateRaw as this one here can do sw
2903 2906
2904 MarkCompactCollector* collector = heap()->mark_compact_collector(); 2907 MarkCompactCollector* collector = heap()->mark_compact_collector();
2905 // Sweeping is still in progress. 2908 // Sweeping is still in progress.
2906 if (collector->sweeping_in_progress()) { 2909 if (collector->sweeping_in_progress()) {
2907 if (FLAG_concurrent_sweeping && !is_local() && 2910 if (FLAG_concurrent_sweeping && !is_local() &&
2908 !collector->sweeper().AreSweeperTasksRunning()) { 2911 !collector->sweeper().AreSweeperTasksRunning()) {
2909 collector->EnsureSweepingCompleted(); 2912 collector->EnsureSweepingCompleted();
2910 } 2913 }
2911 2914
2912 // First try to refill the free-list, concurrent sweeper threads 2915 // First try to refill the free-list, concurrent sweeper threads
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 PrintF("\n"); 3325 PrintF("\n");
3323 } 3326 }
3324 printf(" --------------------------------------\n"); 3327 printf(" --------------------------------------\n");
3325 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, 3328 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size,
3326 MarkingState::Internal(this).live_bytes()); 3329 MarkingState::Internal(this).live_bytes());
3327 } 3330 }
3328 3331
3329 #endif // DEBUG 3332 #endif // DEBUG
3330 } // namespace internal 3333 } // namespace internal
3331 } // namespace v8 3334 } // namespace v8
OLDNEW
« src/heap/incremental-marking-job.cc ('K') | « src/heap/incremental-marking-job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698