Commit 7dc9d5bf authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[wrapper-tracing] Update to recent V8 API

- AdvanceTracing: Removes the parameter for force finishing and just
  relies on the deadline (infinity) to finish tracing.
- EnterFinalPause: Take a parameter indicating the embedder stack state.
  This is useful for followup work to avoid scanning the stack.

Bug: chromium:843903
Change-Id: I5803947834ed38f8062cb7db819a7b98bd77ab30
Reviewed-on: https://chromium-review.googlesource.com/1186467Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585735}
parent 9f8da92d
...@@ -75,10 +75,7 @@ class InterceptingScriptWrappableMarkingVisitor ...@@ -75,10 +75,7 @@ class InterceptingScriptWrappableMarkingVisitor
void end() { void end() {
// Gracefully terminate tracing. // Gracefully terminate tracing.
AdvanceTracing( AdvanceTracing(std::numeric_limits<double>::infinity());
0,
v8::EmbedderHeapTracer::AdvanceTracingActions(
v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
AbortTracing(); AbortTracing();
} }
...@@ -147,9 +144,7 @@ TEST(ScriptWrappableMarkingVisitorTest, ...@@ -147,9 +144,7 @@ TEST(ScriptWrappableMarkingVisitorTest,
visitor->RegisterV8Reference(pair); visitor->RegisterV8Reference(pair);
EXPECT_EQ(visitor->MarkingDeque()->size(), 1ul); EXPECT_EQ(visitor->MarkingDeque()->size(), 1ul);
visitor->AdvanceTracing( visitor->AdvanceTracing(std::numeric_limits<double>::infinity());
0, v8::EmbedderHeapTracer::AdvanceTracingActions(
v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
EXPECT_EQ(visitor->MarkingDeque()->size(), 0ul); EXPECT_EQ(visitor->MarkingDeque()->size(), 0ul);
EXPECT_TRUE(target_header->IsWrapperHeaderMarked()); EXPECT_TRUE(target_header->IsWrapperHeaderMarked());
EXPECT_TRUE(dependency_header->IsWrapperHeaderMarked()); EXPECT_TRUE(dependency_header->IsWrapperHeaderMarked());
...@@ -442,9 +437,7 @@ TEST(ScriptWrappableMarkingVisitorTest, MixinTracing) { ...@@ -442,9 +437,7 @@ TEST(ScriptWrappableMarkingVisitorTest, MixinTracing) {
EXPECT_FALSE(visitor->MarkingDeque()->IsEmpty()); EXPECT_FALSE(visitor->MarkingDeque()->IsEmpty());
EXPECT_TRUE(visitor->MarkingDequeContains(base)); EXPECT_TRUE(visitor->MarkingDequeContains(base));
visitor->AdvanceTracing( visitor->AdvanceTracing(std::numeric_limits<double>::infinity());
0, v8::EmbedderHeapTracer::AdvanceTracingActions(
v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
EXPECT_EQ(visitor->MarkingDeque()->size(), 0ul); EXPECT_EQ(visitor->MarkingDeque()->size(), 0ul);
EXPECT_TRUE(base_header->IsWrapperHeaderMarked()); EXPECT_TRUE(base_header->IsWrapperHeaderMarked());
EXPECT_TRUE( EXPECT_TRUE(
......
...@@ -42,7 +42,7 @@ void ScriptWrappableMarkingVisitor::TracePrologue() { ...@@ -42,7 +42,7 @@ void ScriptWrappableMarkingVisitor::TracePrologue() {
ThreadState::Current()->EnableWrapperTracingBarrier(); ThreadState::Current()->EnableWrapperTracingBarrier();
} }
void ScriptWrappableMarkingVisitor::EnterFinalPause() { void ScriptWrappableMarkingVisitor::EnterFinalPause(EmbedderStackState) {
CHECK(ThreadState::Current()); CHECK(ThreadState::Current());
CHECK(!ThreadState::Current()->IsWrapperTracingForbidden()); CHECK(!ThreadState::Current()->IsWrapperTracingForbidden());
ActiveScriptWrappableBase::TraceActiveScriptWrappables(isolate_, this); ActiveScriptWrappableBase::TraceActiveScriptWrappables(isolate_, this);
...@@ -181,9 +181,7 @@ void ScriptWrappableMarkingVisitor::RegisterV8References( ...@@ -181,9 +181,7 @@ void ScriptWrappableMarkingVisitor::RegisterV8References(
} }
} }
bool ScriptWrappableMarkingVisitor::AdvanceTracing( bool ScriptWrappableMarkingVisitor::AdvanceTracing(double deadline_in_ms) {
double deadline_in_ms,
v8::EmbedderHeapTracer::AdvanceTracingActions actions) {
// Do not drain the marking deque in a state where we can generally not // Do not drain the marking deque in a state where we can generally not
// perform a GC. This makes sure that TraceTraits and friends find // perform a GC. This makes sure that TraceTraits and friends find
// themselves in a well-defined environment, e.g., properly set up vtables. // themselves in a well-defined environment, e.g., properly set up vtables.
...@@ -193,15 +191,13 @@ bool ScriptWrappableMarkingVisitor::AdvanceTracing( ...@@ -193,15 +191,13 @@ bool ScriptWrappableMarkingVisitor::AdvanceTracing(
base::AutoReset<bool>(&advancing_tracing_, true); base::AutoReset<bool>(&advancing_tracing_, true);
TimeTicks deadline = TimeTicks deadline =
TimeTicks() + TimeDelta::FromMillisecondsD(deadline_in_ms); TimeTicks() + TimeDelta::FromMillisecondsD(deadline_in_ms);
while (actions.force_completion == while (WTF::CurrentTimeTicks() < deadline) {
v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION ||
WTF::CurrentTimeTicks() < deadline) {
if (marking_deque_.IsEmpty()) { if (marking_deque_.IsEmpty()) {
return false; return true;
} }
marking_deque_.TakeFirst().Trace(this); marking_deque_.TakeFirst().Trace(this);
} }
return true; return false;
} }
void ScriptWrappableMarkingVisitor::MarkWrapperHeader( void ScriptWrappableMarkingVisitor::MarkWrapperHeader(
......
...@@ -73,11 +73,10 @@ class PLATFORM_EXPORT ScriptWrappableMarkingVisitor ...@@ -73,11 +73,10 @@ class PLATFORM_EXPORT ScriptWrappableMarkingVisitor
void RegisterV8References(const std::vector<std::pair<void*, void*>>& void RegisterV8References(const std::vector<std::pair<void*, void*>>&
internal_fields_of_potential_wrappers) override; internal_fields_of_potential_wrappers) override;
void RegisterV8Reference(const std::pair<void*, void*>& internal_fields); void RegisterV8Reference(const std::pair<void*, void*>& internal_fields);
bool AdvanceTracing(double deadline_in_ms, bool AdvanceTracing(double deadline_in_ms) override;
v8::EmbedderHeapTracer::AdvanceTracingActions) override;
void TraceEpilogue() override; void TraceEpilogue() override;
void AbortTracing() override; void AbortTracing() override;
void EnterFinalPause() override; void EnterFinalPause(EmbedderStackState) override;
size_t NumberOfWrappersToTrace() override; size_t NumberOfWrappersToTrace() override;
// ScriptWrappableVisitor interface. // ScriptWrappableVisitor interface.
......
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