Commit 951fd10c authored by hlopko's avatar hlopko Committed by Commit bot

Trace active script wrappables on entering final pause

V8 now tells EmbedderHeapTracer when it enters the final pause, and that is
exactly the place where we need to trace active script wrappables. Previous
implementation is not correct.

LOG=no
BUG=468240

Review-Url: https://codereview.chromium.org/2076133002
Cr-Commit-Position: refs/heads/master@{#400634}
parent d302f872
...@@ -27,11 +27,23 @@ void ScriptWrappableVisitor::TracePrologue() ...@@ -27,11 +27,23 @@ void ScriptWrappableVisitor::TracePrologue()
m_tracingInProgress = true; m_tracingInProgress = true;
} }
void ScriptWrappableVisitor::TraceEpilogue() void ScriptWrappableVisitor::EnterFinalPause()
{ {
ActiveScriptWrappable::traceActiveScriptWrappables(m_isolate, this); ActiveScriptWrappable::traceActiveScriptWrappables(m_isolate, this);
AdvanceTracing(0, AdvanceTracingActions(ForceCompletionAction::FORCE_COMPLETION)); }
void ScriptWrappableVisitor::TraceEpilogue()
{
performCleanup();
}
void ScriptWrappableVisitor::AbortTracing()
{
performCleanup();
}
void ScriptWrappableVisitor::performCleanup()
{
for (auto header : m_headersToUnmark) { for (auto header : m_headersToUnmark) {
header->unmarkWrapperHeader(); header->unmarkWrapperHeader();
} }
......
...@@ -57,6 +57,8 @@ public: ...@@ -57,6 +57,8 @@ public:
void RegisterV8Reference(const std::pair<void*, void*>& internalFields); void RegisterV8Reference(const std::pair<void*, void*>& internalFields);
bool AdvanceTracing(double deadlineInMs, v8::EmbedderHeapTracer::AdvanceTracingActions) override; bool AdvanceTracing(double deadlineInMs, v8::EmbedderHeapTracer::AdvanceTracingActions) override;
void TraceEpilogue() override; void TraceEpilogue() override;
void AbortTracing() override;
void EnterFinalPause() override;
template <typename T> template <typename T>
void markWrapper(const v8::Persistent<T>* handle) const void markWrapper(const v8::Persistent<T>* handle) const
...@@ -82,6 +84,7 @@ private: ...@@ -82,6 +84,7 @@ private:
bool markWrapperHeader(const ScriptWrappable*) const override; bool markWrapperHeader(const ScriptWrappable*) const override;
bool markWrapperHeader(const void* garbageCollected) const override; bool markWrapperHeader(const void* garbageCollected) const override;
bool m_tracingInProgress = false; bool m_tracingInProgress = false;
void performCleanup();
/** /**
* Collection of ScriptWrappables we need to trace from. We assume it is * Collection of ScriptWrappables we need to trace from. We assume it is
* safe to hold on to the raw pointers because: * safe to hold on to the raw pointers because:
......
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