5 #ifndef V8_HEAP_SCAVENGE_JOB_H_ 6 #define V8_HEAP_SCAVENGE_JOB_H_ 8 #include "src/cancelable-task.h" 9 #include "src/globals.h" 25 void RunInternal(
double deadline_in_seconds)
override;
27 Isolate* isolate() {
return isolate_; }
35 : idle_task_pending_(false),
36 idle_task_rescheduled_(false),
37 bytes_allocated_since_the_last_task_(0) {}
41 void ScheduleIdleTaskIfNeeded(
Heap* heap,
int bytes_allocated);
46 void RescheduleIdleTask(
Heap* heap);
48 bool IdleTaskPending() {
return idle_task_pending_; }
49 void NotifyIdleTask() { idle_task_pending_ =
false; }
50 bool IdleTaskRescheduled() {
return idle_task_rescheduled_; }
52 static bool ReachedIdleAllocationLimit(
double scavenge_speed_in_bytes_per_ms,
53 size_t new_space_size,
54 size_t new_space_capacity);
56 static bool EnoughIdleTimeForScavenge(
double idle_time_ms,
57 double scavenge_speed_in_bytes_per_ms,
58 size_t new_space_size);
62 static const int kInitialScavengeSpeedInBytesPerMs = 256 * KB;
64 static const int kAverageIdleTimeMs = 5;
67 static const size_t kBytesAllocatedBeforeNextIdleTask = 1024 * KB;
69 static const size_t kMinAllocationLimit = 512 * KB;
71 static const double kMaxAllocationLimitAsFractionOfNewSpace;
74 void ScheduleIdleTask(Heap* heap);
75 bool idle_task_pending_;
76 bool idle_task_rescheduled_;
77 int bytes_allocated_since_the_last_task_;
82 #endif // V8_HEAP_SCAVENGE_JOB_H_