OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |