Commit 0d7212e1 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[unified-heap] Adjust wrapper tracing and integration tests

Bug: 843903
Change-Id: I95a0caae7f528be908caff24515971b29b4f645f
Reviewed-on: https://chromium-review.googlesource.com/c/1292564Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601545}
parent 0bc4f833
...@@ -150,24 +150,6 @@ TEST(ScriptWrappableMarkingVisitorTest, ...@@ -150,24 +150,6 @@ TEST(ScriptWrappableMarkingVisitorTest,
EXPECT_TRUE(dependency_header->IsWrapperHeaderMarked()); EXPECT_TRUE(dependency_header->IsWrapperHeaderMarked());
} }
TEST(ScriptWrappableMarkingVisitorTest,
OilpanClearsMarkingDequeWhenObjectDied) {
V8TestingScope scope;
DeathAwareScriptWrappable* object = DeathAwareScriptWrappable::Create();
InterceptingScriptWrappableMarkingVisitorScope intercepting_scope(
scope.GetIsolate());
ScriptWrappableMarkingVisitor* visitor = intercepting_scope.Visitor();
visitor->TraceWithWrappers(object);
EXPECT_EQ(visitor->MarkingDeque()->front().RawObjectPointer(), object);
PreciselyCollectGarbage();
EXPECT_EQ(visitor->MarkingDeque()->front().RawObjectPointer(), nullptr);
}
TEST(ScriptWrappableMarkingVisitorTest, TEST(ScriptWrappableMarkingVisitorTest,
MarkedObjectDoesNothingOnWriteBarrierHitWhenDependencyIsMarkedToo) { MarkedObjectDoesNothingOnWriteBarrierHitWhenDependencyIsMarkedToo) {
V8TestingScope scope; V8TestingScope scope;
...@@ -448,6 +430,11 @@ TEST(ScriptWrappableMarkingVisitorTest, MixinTracing) { ...@@ -448,6 +430,11 @@ TEST(ScriptWrappableMarkingVisitorTest, MixinTracing) {
} }
TEST(ScriptWrappableMarkingVisitorTest, OilpanClearsHeadersWhenObjectDied) { TEST(ScriptWrappableMarkingVisitorTest, OilpanClearsHeadersWhenObjectDied) {
// This test depends on cleanup callbacks that are only fired when wrapper
// tracing is enabled.
if (RuntimeEnabledFeatures::HeapUnifiedGarbageCollectionEnabled())
return;
V8TestingScope scope; V8TestingScope scope;
DeathAwareScriptWrappable* object = DeathAwareScriptWrappable::Create(); DeathAwareScriptWrappable* object = DeathAwareScriptWrappable::Create();
...@@ -463,4 +450,27 @@ TEST(ScriptWrappableMarkingVisitorTest, OilpanClearsHeadersWhenObjectDied) { ...@@ -463,4 +450,27 @@ TEST(ScriptWrappableMarkingVisitorTest, OilpanClearsHeadersWhenObjectDied) {
EXPECT_FALSE(visitor->headers_to_unmark_.Contains(header)); EXPECT_FALSE(visitor->headers_to_unmark_.Contains(header));
} }
TEST(ScriptWrappableMarkingVisitorTest,
OilpanClearsMarkingDequeWhenObjectDied) {
// This test depends on cleanup callbacks that are only fired when wrapper
// tracing is enabled.
if (RuntimeEnabledFeatures::HeapUnifiedGarbageCollectionEnabled())
return;
V8TestingScope scope;
DeathAwareScriptWrappable* object = DeathAwareScriptWrappable::Create();
InterceptingScriptWrappableMarkingVisitorScope intercepting_scope(
scope.GetIsolate());
ScriptWrappableMarkingVisitor* visitor = intercepting_scope.Visitor();
visitor->TraceWithWrappers(object);
EXPECT_EQ(visitor->MarkingDeque()->front().RawObjectPointer(), object);
PreciselyCollectGarbage();
EXPECT_EQ(visitor->MarkingDeque()->front().RawObjectPointer(), nullptr);
}
} // namespace blink } // namespace blink
...@@ -27,10 +27,10 @@ void RunV8MinorGC(v8::Isolate* isolate) { ...@@ -27,10 +27,10 @@ void RunV8MinorGC(v8::Isolate* isolate) {
v8::Isolate::GarbageCollectionType::kMinorGarbageCollection); v8::Isolate::GarbageCollectionType::kMinorGarbageCollection);
} }
void RunV8FullGC(v8::Isolate* isolate) { void RunV8FullGCWithoutScanningOilpanStack(v8::Isolate* isolate) {
CHECK(isolate); CHECK(isolate);
isolate->RequestGarbageCollectionForTesting( V8GCController::CollectAllGarbageForTesting(
v8::Isolate::GarbageCollectionType::kFullGarbageCollection); isolate, v8::EmbedderHeapTracer::EmbedderStackState::kEmpty);
} }
} // namespace v8_gc_integration_test } // namespace v8_gc_integration_test
...@@ -108,7 +108,7 @@ TEST(ScriptWrappableV8GCIntegrationTest, ...@@ -108,7 +108,7 @@ TEST(ScriptWrappableV8GCIntegrationTest,
} }
v8_gc_integration_test::RunV8MinorGC(isolate); v8_gc_integration_test::RunV8MinorGC(isolate);
v8_gc_integration_test::RunV8FullGC(isolate); v8_gc_integration_test::RunV8FullGCWithoutScanningOilpanStack(isolate);
v8_gc_integration_test::PreciselyCollectGarbage(); v8_gc_integration_test::PreciselyCollectGarbage();
EXPECT_FALSE(observer.WasCollected()); EXPECT_FALSE(observer.WasCollected());
...@@ -131,7 +131,7 @@ TEST(ScriptWrappableV8GCIntegrationTest, ...@@ -131,7 +131,7 @@ TEST(ScriptWrappableV8GCIntegrationTest,
} }
v8_gc_integration_test::RunV8MinorGC(isolate); v8_gc_integration_test::RunV8MinorGC(isolate);
v8_gc_integration_test::RunV8FullGC(isolate); v8_gc_integration_test::RunV8FullGCWithoutScanningOilpanStack(isolate);
v8_gc_integration_test::PreciselyCollectGarbage(); v8_gc_integration_test::PreciselyCollectGarbage();
EXPECT_TRUE(observer.WasCollected()); EXPECT_TRUE(observer.WasCollected());
......
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