heap: Avoid scanning on-stack reference on incremental marking start

Similar to other stack references they don't need to be scanned on incremental
marking start.

Bug: chromium:1046277
Change-Id: I9fb3ee768df0288b5a61f09e680e321a8cb7b895
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2030915
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66080}
This commit is contained in:
Michael Lippautz 2020-02-03 12:40:22 +01:00 committed by Commit Bot
parent 82bf91514b
commit aa376ae073
4 changed files with 12 additions and 12 deletions

View File

@ -1232,7 +1232,6 @@ void GlobalHandles::IterateYoungStrongAndDependentRoots(RootVisitor* v) {
v->VisitRootPointer(Root::kGlobalHandles, nullptr, node->location());
}
}
on_stack_nodes_->Iterate(v);
}
void GlobalHandles::MarkYoungWeakUnmodifiedObjectsPending(
@ -1517,6 +1516,9 @@ void GlobalHandles::IterateStrongRoots(RootVisitor* v) {
node->location());
}
}
}
void GlobalHandles::IterateStrongStackRoots(RootVisitor* v) {
on_stack_nodes_->Iterate(v);
}

View File

@ -121,6 +121,7 @@ class V8_EXPORT_PRIVATE GlobalHandles final {
GarbageCollector collector, const v8::GCCallbackFlags gc_callback_flags);
void IterateStrongRoots(RootVisitor* v);
void IterateStrongStackRoots(RootVisitor* v);
void IterateWeakRoots(RootVisitor* v);
void IterateAllRoots(RootVisitor* v);
void IterateAllYoungRoots(RootVisitor* v);

View File

@ -4381,6 +4381,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
v->Synchronize(VisitorSynchronization::kBootstrapper);
if (mode != VISIT_ONLY_STRONG_IGNORE_STACK) {
isolate_->Iterate(v);
isolate_->global_handles()->IterateStrongStackRoots(v);
v->Synchronize(VisitorSynchronization::kTop);
}
Relocatable::Iterate(isolate_, v);

View File

@ -18,8 +18,7 @@ namespace internal {
class IncrementalMarkingJob::Task : public CancelableTask {
public:
static StepResult Step(Heap* heap,
EmbedderHeapTracer::EmbedderStackState stack_state);
static StepResult Step(Heap* heap);
Task(Isolate* isolate, IncrementalMarkingJob* job,
EmbedderHeapTracer::EmbedderStackState stack_state, TaskType task_type)
@ -80,20 +79,15 @@ void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) {
}
}
StepResult IncrementalMarkingJob::Task::Step(
Heap* heap, EmbedderHeapTracer::EmbedderStackState stack_state) {
StepResult IncrementalMarkingJob::Task::Step(Heap* heap) {
const int kIncrementalMarkingDelayMs = 1;
double deadline =
heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs;
StepResult result = heap->incremental_marking()->AdvanceWithDeadline(
deadline, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
i::StepOrigin::kTask);
{
EmbedderStackStateScope scope(heap->local_embedder_heap_tracer(),
stack_state);
heap->FinalizeIncrementalMarkingIfComplete(
GarbageCollectionReason::kFinalizeMarkingViaTask);
}
return result;
}
@ -102,6 +96,8 @@ void IncrementalMarkingJob::Task::RunInternal() {
TRACE_EVENT_CALL_STATS_SCOPED(isolate(), "v8", "V8.Task");
Heap* heap = isolate()->heap();
EmbedderStackStateScope scope(heap->local_embedder_heap_tracer(),
stack_state_);
IncrementalMarking* incremental_marking = heap->incremental_marking();
if (incremental_marking->IsStopped()) {
if (heap->IncrementalMarkingLimitReached() !=
@ -117,7 +113,7 @@ void IncrementalMarkingJob::Task::RunInternal() {
job_->SetTaskPending(task_type_, false);
if (!incremental_marking->IsStopped()) {
StepResult step_result = Step(heap, stack_state_);
StepResult step_result = Step(heap);
if (!incremental_marking->IsStopped()) {
job_->ScheduleTask(heap, step_result == StepResult::kNoImmediateWork
? TaskType::kDelayed