scavenge-job.h 913 Bytes
Newer Older
ulan's avatar
ulan committed
1 2 3 4 5 6 7
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_HEAP_SCAVENGE_JOB_H_
#define V8_HEAP_SCAVENGE_JOB_H_

8
#include "src/tasks/cancelable-task.h"
ulan's avatar
ulan committed
9 10 11 12 13 14 15

namespace v8 {
namespace internal {

class Heap;
class Isolate;

16 17 18
// The scavenge job uses platform tasks to perform a young generation
// Scavenge garbage collection. The job posts a foreground task.
class ScavengeJob {
ulan's avatar
ulan committed
19
 public:
20
  ScavengeJob() V8_NOEXCEPT = default;
ulan's avatar
ulan committed
21

22
  void ScheduleTaskIfNeeded(Heap* heap);
23

24
  static size_t YoungGenerationTaskTriggerSize(Heap* heap);
ulan's avatar
ulan committed
25

26 27
 private:
  class Task;
ulan's avatar
ulan committed
28

29
  static bool YoungGenerationSizeTaskTriggerReached(Heap* heap);
ulan's avatar
ulan committed
30

31
  void set_task_pending(bool value) { task_pending_ = value; }
ulan's avatar
ulan committed
32

33
  bool task_pending_ = false;
ulan's avatar
ulan committed
34
};
35 36
}  // namespace internal
}  // namespace v8
ulan's avatar
ulan committed
37 38

#endif  // V8_HEAP_SCAVENGE_JOB_H_