Commit 56bdba08 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[unified-heap] Use up-to-date V8 api

Bug: 843903
Change-Id: I9271138dfcdf72cd67965ada3b3e8b03b3b89222
Reviewed-on: https://chromium-review.googlesource.com/c/1277803Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599613}
parent 3b26a222
......@@ -76,7 +76,7 @@ class InterceptingScriptWrappableMarkingVisitor
void end() {
// Gracefully terminate tracing.
AdvanceTracing(std::numeric_limits<double>::infinity());
AbortTracing();
AbortTracingForTermination();
}
private:
......
......@@ -66,7 +66,7 @@ void ScriptWrappableMarkingVisitor::TraceEpilogue() {
ScheduleIdleLazyCleanup();
}
void ScriptWrappableMarkingVisitor::AbortTracing() {
void ScriptWrappableMarkingVisitor::AbortTracingForTermination() {
CHECK(ThreadState::Current());
should_cleanup_ = true;
tracing_in_progress_ = false;
......@@ -74,9 +74,8 @@ void ScriptWrappableMarkingVisitor::AbortTracing() {
PerformCleanup();
}
size_t ScriptWrappableMarkingVisitor::NumberOfWrappersToTrace() {
CHECK(ThreadState::Current());
return marking_deque_.size();
bool ScriptWrappableMarkingVisitor::IsTracingDone() {
return marking_deque_.empty();
}
void ScriptWrappableMarkingVisitor::PerformCleanup() {
......
......@@ -72,6 +72,8 @@ class PLATFORM_EXPORT ScriptWrappableMarkingVisitor
bool WrapperTracingInProgress() const { return tracing_in_progress_; }
void AbortTracingForTermination();
// v8::EmbedderHeapTracer interface.
void TracePrologue() override;
void RegisterV8References(const std::vector<std::pair<void*, void*>>&
......@@ -79,9 +81,8 @@ class PLATFORM_EXPORT ScriptWrappableMarkingVisitor
void RegisterV8Reference(const std::pair<void*, void*>& internal_fields);
bool AdvanceTracing(double deadline_in_ms) override;
void TraceEpilogue() override;
void AbortTracing() override;
void EnterFinalPause(EmbedderStackState) override;
size_t NumberOfWrappersToTrace() override;
bool IsTracingDone() override;
// ScriptWrappableVisitor interface.
void Visit(const TraceWrapperV8Reference<v8::Value>&) override;
......
......@@ -171,7 +171,7 @@ void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) {
}
isolate->SetEmbedderHeapTracer(nullptr);
if (data->script_wrappable_visitor_->WrapperTracingInProgress())
data->script_wrappable_visitor_->AbortTracing();
data->script_wrappable_visitor_->AbortTracingForTermination();
data->script_wrappable_visitor_.reset();
}
......
......@@ -37,6 +37,8 @@ void UnifiedHeapController::TracePrologue() {
thread_state_->SetGCState(ThreadState::kNoGCScheduled);
// Start incremental marking with unified tracing.
thread_state_->IncrementalMarkingStart(BlinkGC::GCReason::kUnifiedHeapGC);
is_tracing_done_ = false;
}
void UnifiedHeapController::EnterFinalPause(EmbedderStackState stack_state) {
......@@ -87,6 +89,7 @@ void UnifiedHeapController::RegisterV8References(
if (wrapper_type_info->gin_embedder != gin::GinEmbedder::kEmbedderBlink) {
continue;
}
is_tracing_done_ = false;
wrapper_type_info->Trace(thread_state_->CurrentVisitor(),
internal_fields.second);
}
......@@ -103,18 +106,16 @@ bool UnifiedHeapController::AdvanceTracing(double deadline_in_ms) {
ThreadState::AtomicPauseScope atomic_pause_scope(thread_state_);
TimeTicks deadline =
TimeTicks() + TimeDelta::FromMillisecondsD(deadline_in_ms);
return thread_state_->MarkPhaseAdvanceMarking(deadline);
is_tracing_done_ = thread_state_->MarkPhaseAdvanceMarking(deadline);
return is_tracing_done_;
}
thread_state_->AtomicPauseMarkTransitiveClosure();
is_tracing_done_ = true;
return true;
}
void UnifiedHeapController::AbortTracing() {
VLOG(2) << "UnifiedHeapController::AbortTracing";
// TODO(mlippautz): Only needed when V8 aborts incremental marking which
// should be rare in non-production code.
LOG(FATAL) << "Not yet implemented";
bool UnifiedHeapController::IsTracingDone() {
return is_tracing_done_;
}
} // namespace blink
......@@ -38,15 +38,18 @@ class PLATFORM_EXPORT UnifiedHeapController final
// v8::EmbedderHeapTracer implementation.
void TracePrologue() final;
void TraceEpilogue() final;
void AbortTracing() final;
void EnterFinalPause(EmbedderStackState) final;
void RegisterV8References(const std::vector<std::pair<void*, void*>>&) final;
bool AdvanceTracing(double) final;
bool IsTracingDone() final;
ThreadState* thread_state() const { return thread_state_; }
private:
ThreadState* const thread_state_;
// Returns whether the Blink heap has been fully processed.
bool is_tracing_done_ = false;
};
} // namespace blink
......
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