v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
incremental-marking-job.h
Go to the documentation of this file.
1// Copyright 2012 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_INCREMENTAL_MARKING_JOB_H_
6#define V8_HEAP_INCREMENTAL_MARKING_JOB_H_
7
8#include <optional>
9
10#include "include/v8-platform.h"
13
14namespace v8::internal {
15
16class Heap;
17class Isolate;
18
19// The incremental marking job uses platform tasks to perform incremental
20// marking actions (start, step, finalize). The job posts regular foreground
21// tasks or delayed foreground tasks if marking progress allows.
23 public:
25
28
29 // Schedules a task with the given `priority`. Safe to be called from any
30 // thread.
32
33 // Returns a weighted average of time to task. For delayed tasks the time to
34 // task is only recorded after the initial delay. In case a task is currently
35 // running, it is added to the average.
36 std::optional<v8::base::TimeDelta> AverageTimeToTask() const;
37
38 std::optional<v8::base::TimeDelta> CurrentTimeToTask() const;
39
40 private:
41 class Task;
42
43 Heap* const heap_;
44 const std::shared_ptr<v8::TaskRunner> user_blocking_task_runner_;
45 const std::shared_ptr<v8::TaskRunner> user_visible_task_runner_;
48 bool pending_task_ = false;
49};
50
51} // namespace v8::internal
52
53#endif // V8_HEAP_INCREMENTAL_MARKING_JOB_H_
std::optional< v8::base::TimeDelta > AverageTimeToTask() const
const std::shared_ptr< v8::TaskRunner > user_blocking_task_runner_
std::optional< v8::base::TimeDelta > CurrentTimeToTask() const
IncrementalMarkingJob(const IncrementalMarkingJob &)=delete
void ScheduleTask(TaskPriority priority=TaskPriority::kUserBlocking)
IncrementalMarkingJob & operator=(const IncrementalMarkingJob &)=delete
const std::shared_ptr< v8::TaskRunner > user_visible_task_runner_
size_t priority
TaskPriority
Definition v8-platform.h:24