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

Side by Side Diff: src/heap/scavenge-job.cc

Issue 2310143002: [heap] Introduce enum of garbage collection reasons. (Closed)
Patch Set: rebase Created 4 years, 3 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/memory-reducer.cc ('k') | src/heap/spaces.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/scavenge-job.h" 5 #include "src/heap/scavenge-job.h"
6 6
7 #include "src/base/platform/time.h" 7 #include "src/base/platform/time.h"
8 #include "src/heap/heap-inl.h" 8 #include "src/heap/heap-inl.h"
9 #include "src/heap/heap.h" 9 #include "src/heap/heap.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 16 matching lines...) Expand all
27 heap->tracer()->ScavengeSpeedInBytesPerMillisecond(); 27 heap->tracer()->ScavengeSpeedInBytesPerMillisecond();
28 size_t new_space_size = heap->new_space()->Size(); 28 size_t new_space_size = heap->new_space()->Size();
29 size_t new_space_capacity = heap->new_space()->Capacity(); 29 size_t new_space_capacity = heap->new_space()->Capacity();
30 30
31 job_->NotifyIdleTask(); 31 job_->NotifyIdleTask();
32 32
33 if (ReachedIdleAllocationLimit(scavenge_speed_in_bytes_per_ms, new_space_size, 33 if (ReachedIdleAllocationLimit(scavenge_speed_in_bytes_per_ms, new_space_size,
34 new_space_capacity)) { 34 new_space_capacity)) {
35 if (EnoughIdleTimeForScavenge( 35 if (EnoughIdleTimeForScavenge(
36 idle_time_in_ms, scavenge_speed_in_bytes_per_ms, new_space_size)) { 36 idle_time_in_ms, scavenge_speed_in_bytes_per_ms, new_space_size)) {
37 heap->CollectGarbage(NEW_SPACE, "idle task: scavenge"); 37 heap->CollectGarbage(NEW_SPACE, GarbageCollectionReason::kIdleTask);
38 } else { 38 } else {
39 // Immediately request another idle task that can get larger idle time. 39 // Immediately request another idle task that can get larger idle time.
40 job_->RescheduleIdleTask(heap); 40 job_->RescheduleIdleTask(heap);
41 } 41 }
42 } 42 }
43 } 43 }
44 44
45 bool ScavengeJob::ReachedIdleAllocationLimit( 45 bool ScavengeJob::ReachedIdleAllocationLimit(
46 double scavenge_speed_in_bytes_per_ms, size_t new_space_size, 46 double scavenge_speed_in_bytes_per_ms, size_t new_space_size,
47 size_t new_space_capacity) { 47 size_t new_space_capacity) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate()); 103 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate());
104 if (V8::GetCurrentPlatform()->IdleTasksEnabled(isolate)) { 104 if (V8::GetCurrentPlatform()->IdleTasksEnabled(isolate)) {
105 idle_task_pending_ = true; 105 idle_task_pending_ = true;
106 auto task = new IdleTask(heap->isolate(), this); 106 auto task = new IdleTask(heap->isolate(), this);
107 V8::GetCurrentPlatform()->CallIdleOnForegroundThread(isolate, task); 107 V8::GetCurrentPlatform()->CallIdleOnForegroundThread(isolate, task);
108 } 108 }
109 } 109 }
110 } 110 }
111 } // namespace internal 111 } // namespace internal
112 } // namespace v8 112 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/memory-reducer.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698