v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
minor-gc-job.h
Go to the documentation of this file.
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
3
// found in the LICENSE file.
4
5
#ifndef V8_HEAP_MINOR_GC_JOB_H_
6
#define V8_HEAP_MINOR_GC_JOB_H_
7
8
#include <memory>
9
10
#include "
src/common/globals.h
"
11
#include "
src/heap/allocation-observer.h
"
12
#include "
src/tasks/cancelable-task.h
"
13
14
namespace
v8::internal
{
15
16
class
Heap;
17
18
// The job allows for running young generation garbage collection via platform
19
// foreground tasks.
20
//
21
// The job automatically adds an observer to schedule a task when
22
// `--minor_gc_task_trigger` in percent of the regular limit is reached. The job
23
// itself never checks the schedule.
24
class
MinorGCJob
final {
25
public
:
26
explicit
MinorGCJob
(
Heap
*
heap
)
V8_NOEXCEPT
;
27
28
// Tries to schedule a new minor GC task.
29
void
TryScheduleTask
();
30
31
// Cancels any previously scheduled minor GC tasks that have not yet run.
32
void
CancelTaskIfScheduled
();
33
34
private
:
35
class
Task
;
36
37
bool
IsScheduled
()
const
{
38
return
current_task_id_
!=
CancelableTaskManager::kInvalidTaskId
;
39
}
40
41
Heap
*
const
heap_
;
42
CancelableTaskManager::Id
current_task_id_
=
43
CancelableTaskManager::kInvalidTaskId
;
44
std::unique_ptr<AllocationObserver>
minor_gc_task_observer_
;
45
};
46
47
}
// namespace v8::internal
48
49
#endif
// V8_HEAP_MINOR_GC_JOB_H_
allocation-observer.h
cancelable-task.h
v8::internal::CancelableTaskManager::kInvalidTaskId
static constexpr Id kInvalidTaskId
Definition
cancelable-task.h:34
v8::internal::CancelableTaskManager::Id
uint64_t Id
Definition
cancelable-task.h:33
v8::internal::Heap
Definition
heap.h:195
v8::internal::MinorGCJob::Task
Definition
minor-gc-job.cc:118
v8::internal::MinorGCJob
Definition
minor-gc-job.h:24
v8::internal::MinorGCJob::MinorGCJob
MinorGCJob(Heap *heap) V8_NOEXCEPT
Definition
minor-gc-job.cc:133
v8::internal::MinorGCJob::minor_gc_task_observer_
std::unique_ptr< AllocationObserver > minor_gc_task_observer_
Definition
minor-gc-job.h:44
v8::internal::MinorGCJob::heap_
Heap *const heap_
Definition
minor-gc-job.h:41
v8::internal::MinorGCJob::current_task_id_
CancelableTaskManager::Id current_task_id_
Definition
minor-gc-job.h:42
v8::internal::MinorGCJob::CancelTaskIfScheduled
void CancelTaskIfScheduled()
Definition
minor-gc-job.cc:153
v8::internal::MinorGCJob::TryScheduleTask
void TryScheduleTask()
Definition
minor-gc-job.cc:137
v8::internal::MinorGCJob::IsScheduled
bool IsScheduled() const
Definition
minor-gc-job.h:37
globals.h
heap
Definition
platform.h:72
v8::internal
Definition
api-arguments-inl.h:20
V8_NOEXCEPT
#define V8_NOEXCEPT
Definition
compiler-specific.h:105
src
heap
minor-gc-job.h
Generated on Sun Apr 6 2025 21:08:54 for v8 by
1.12.0