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

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

Issue 2861763002: [heap] Add GC accounting to slow allocation and incremental marking job (Closed)
Patch Set: Fix typo 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
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 VMState<GC> state(heap()->isolate());
2901 RuntimeCallTimerScope(heap()->isolate(),
2902 &RuntimeCallStats::GC_SlowAllocateRaw);
2903 return RawSlowAllocateRaw(size_in_bytes);
2904 }
2905
2906 HeapObject* CompactionSpace::SlowAllocateRaw(int size_in_bytes) {
2907 return RawSlowAllocateRaw(size_in_bytes);
2908 }
2909
2910 HeapObject* PagedSpace::RawSlowAllocateRaw(int size_in_bytes) {
2911 // Allocation in this space has failed.
2899 DCHECK_GE(size_in_bytes, 0); 2912 DCHECK_GE(size_in_bytes, 0);
2900 const int kMaxPagesToSweep = 1; 2913 const int kMaxPagesToSweep = 1;
2901 2914
2902 // Allocation in this space has failed.
2903
2904 MarkCompactCollector* collector = heap()->mark_compact_collector(); 2915 MarkCompactCollector* collector = heap()->mark_compact_collector();
2905 // Sweeping is still in progress. 2916 // Sweeping is still in progress.
2906 if (collector->sweeping_in_progress()) { 2917 if (collector->sweeping_in_progress()) {
2907 if (FLAG_concurrent_sweeping && !is_local() && 2918 if (FLAG_concurrent_sweeping && !is_local() &&
2908 !collector->sweeper().AreSweeperTasksRunning()) { 2919 !collector->sweeper().AreSweeperTasksRunning()) {
2909 collector->EnsureSweepingCompleted(); 2920 collector->EnsureSweepingCompleted();
2910 } 2921 }
2911 2922
2912 // First try to refill the free-list, concurrent sweeper threads 2923 // First try to refill the free-list, concurrent sweeper threads
2913 // may have freed some objects in the meantime. 2924 // may have freed some objects in the meantime.
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 PrintF("\n"); 3333 PrintF("\n");
3323 } 3334 }
3324 printf(" --------------------------------------\n"); 3335 printf(" --------------------------------------\n");
3325 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, 3336 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size,
3326 MarkingState::Internal(this).live_bytes()); 3337 MarkingState::Internal(this).live_bytes());
3327 } 3338 }
3328 3339
3329 #endif // DEBUG 3340 #endif // DEBUG
3330 } // namespace internal 3341 } // namespace internal
3331 } // namespace v8 3342 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698