Commit 1344e3a9 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Report wrappers after processing the marking deque incrementally

BUG=chromium:676700, chromium:468240

Review-Url: https://codereview.chromium.org/2604583002
Cr-Commit-Position: refs/heads/master@{#41946}
parent 8c1397e4
......@@ -41,7 +41,7 @@ bool LocalEmbedderHeapTracer::Trace(
double deadline, EmbedderHeapTracer::AdvanceTracingActions actions) {
if (!InUse()) return false;
RegisterWrappersWithRemoteTracer();
DCHECK_EQ(0, NumberOfCachedWrappersToTrace());
return remote_tracer_->AdvanceTracing(deadline, actions);
}
......
......@@ -892,6 +892,11 @@ intptr_t IncrementalMarking::ProcessMarkingDeque(
VisitObject(map, obj, size);
bytes_processed += size - unscanned_bytes_of_large_object_;
}
// Report all found wrappers to the embedder. This is necessary as the
// embedder could potentially invalidate wrappers as soon as V8 is done
// with its incremental marking processing. Any cached wrappers could
// result in broken pointers at this point.
heap_->local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer();
return bytes_processed;
}
......@@ -1033,6 +1038,8 @@ double IncrementalMarking::AdvanceIncrementalMarking(
TRACE_EVENT0("v8", "V8.GCIncrementalMarking");
TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL);
DCHECK(!IsStopped());
DCHECK_EQ(
0, heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace());
double remaining_time_in_ms = 0.0;
intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize(
......
......@@ -2136,6 +2136,7 @@ void MarkCompactCollector::ProcessEphemeralMarking(
if (!only_process_harmony_weak_collections) {
if (heap_->local_embedder_heap_tracer()->InUse()) {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING);
heap_->local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer();
heap_->local_embedder_heap_tracer()->Trace(
0,
EmbedderHeapTracer::AdvanceTracingActions(
......
......@@ -135,6 +135,7 @@ TEST(LocalEmbedderHeapTracer, TraceFinishes) {
local_tracer.AddWrapperToTrace(CreateWrapperInfo());
EXPECT_EQ(1u, local_tracer.NumberOfCachedWrappersToTrace());
EXPECT_CALL(remote_tracer, RegisterV8References(_));
local_tracer.RegisterWrappersWithRemoteTracer();
EXPECT_CALL(remote_tracer, AdvanceTracing(0, _)).WillOnce(Return(false));
EXPECT_FALSE(local_tracer.Trace(
0, EmbedderHeapTracer::AdvanceTracingActions(
......@@ -149,6 +150,7 @@ TEST(LocalEmbedderHeapTracer, TraceDoesNotFinish) {
local_tracer.AddWrapperToTrace(CreateWrapperInfo());
EXPECT_EQ(1u, local_tracer.NumberOfCachedWrappersToTrace());
EXPECT_CALL(remote_tracer, RegisterV8References(_));
local_tracer.RegisterWrappersWithRemoteTracer();
EXPECT_CALL(remote_tracer, AdvanceTracing(0, _)).WillOnce(Return(true));
EXPECT_TRUE(local_tracer.Trace(
0, EmbedderHeapTracer::AdvanceTracingActions(
......
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