Commit c1955197 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Use AdvanceOnAllocation() in ReportExternalMemoryPressure()

Heap::ReportExternalMemoryPressure() uses a slightly different
behavior for incremental marking steps than AdvanceFromTask() or
AdvanceOnAllocation(). This CL switches this method to use
AdvanceOnAllocation().

Bug: v8:12775
Change-Id: If9bb2c2cf3048196286e4b1443129025fbfdf984
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3825780
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82385}
parent fe55a476
......@@ -1715,17 +1715,10 @@ void Heap::ReportExternalMemoryPressure() {
kGCCallbackFlagsForExternalMemory);
}
} else {
// Incremental marking is turned on an has already been started.
const double kMinStepSize = 5;
const double kMaxStepSize = 10;
const double ms_step = std::min(
kMaxStepSize, std::max(kMinStepSize, static_cast<double>(current) /
limit * kMinStepSize));
const double deadline = MonotonicallyIncreasingTimeInMs() + ms_step;
// Extend the gc callback flags with external memory flags.
// Incremental marking is turned on and has already been started.
current_gc_callback_flags_ = static_cast<GCCallbackFlags>(
current_gc_callback_flags_ | kGCCallbackFlagsForExternalMemory);
incremental_marking()->AdvanceWithDeadline(deadline, StepOrigin::kV8);
incremental_marking()->AdvanceOnAllocation();
}
}
......
......@@ -126,6 +126,10 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
// Performs incremental marking step and finalizes marking if complete.
void AdvanceFromTask();
// Performs incremental marking step and schedules job for finalization if
// marking completes.
void AdvanceOnAllocation();
StepResult Step(double max_step_size_in_ms, StepOrigin step_origin);
// This function is used to color the object black before it undergoes an
......@@ -215,8 +219,6 @@ class V8_EXPORT_PRIVATE IncrementalMarking final {
void MarkRoots();
void AdvanceOnAllocation();
// Returns true if the function succeeds in transitioning the object
// from white to grey.
bool WhiteToGreyAndPush(HeapObject obj);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment