cppgc: Fix and re-enable weak container test
The test was not flaky. Instead it seems compiiler optimizations discarded of the test-allocated object such that stack scanning could no longer find it. Bug: v8:11052 Change-Id: Ie8018ccecb03b22e6c4f2dada3e6663b04c551fd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2493160 Commit-Queue: Omer Katz <omerkatz@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Auto-Submit: Omer Katz <omerkatz@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#70722}
This commit is contained in:
parent
70a389ac87
commit
62af317df1
@ -47,6 +47,11 @@ size_t NonTraceableGCed::n_trace_calls = 0u;
|
||||
|
||||
void EmptyWeakCallback(const LivenessBroker&, const void*) {}
|
||||
|
||||
template <typename T>
|
||||
V8_NOINLINE T access(volatile const T& t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace internal
|
||||
@ -78,6 +83,7 @@ TEST_F(WeakContainerTest, TraceableGCedTraced) {
|
||||
nullptr);
|
||||
FinishMarking(Config::StackState::kNoHeapPointers);
|
||||
EXPECT_NE(0u, TraceableGCed::n_trace_calls);
|
||||
access(obj);
|
||||
}
|
||||
|
||||
TEST_F(WeakContainerTest, NonTraceableGCedNotTraced) {
|
||||
@ -89,6 +95,7 @@ TEST_F(WeakContainerTest, NonTraceableGCedNotTraced) {
|
||||
nullptr);
|
||||
FinishMarking(Config::StackState::kNoHeapPointers);
|
||||
EXPECT_EQ(0u, NonTraceableGCed::n_trace_calls);
|
||||
access(obj);
|
||||
}
|
||||
|
||||
TEST_F(WeakContainerTest, NonTraceableGCedNotTracedConservatively) {
|
||||
@ -100,6 +107,7 @@ TEST_F(WeakContainerTest, NonTraceableGCedNotTracedConservatively) {
|
||||
nullptr);
|
||||
FinishMarking(Config::StackState::kMayContainHeapPointers);
|
||||
EXPECT_NE(0u, NonTraceableGCed::n_trace_calls);
|
||||
access(obj);
|
||||
}
|
||||
|
||||
TEST_F(WeakContainerTest, ConservativeGCTracesWeakContainer) {
|
||||
@ -113,6 +121,7 @@ TEST_F(WeakContainerTest, ConservativeGCTracesWeakContainer) {
|
||||
obj, EmptyWeakCallback, nullptr);
|
||||
FinishMarking(Config::StackState::kNoHeapPointers);
|
||||
trace_count_without_conservative = TraceableGCed::n_trace_calls;
|
||||
access(obj);
|
||||
}
|
||||
{
|
||||
TraceableGCed* obj =
|
||||
@ -123,6 +132,7 @@ TEST_F(WeakContainerTest, ConservativeGCTracesWeakContainer) {
|
||||
obj, EmptyWeakCallback, nullptr);
|
||||
FinishMarking(Config::StackState::kMayContainHeapPointers);
|
||||
EXPECT_LT(trace_count_without_conservative, TraceableGCed::n_trace_calls);
|
||||
access(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,6 +149,7 @@ TEST_F(WeakContainerTest, ConservativeGCTracesWeakContainerOnce) {
|
||||
nullptr);
|
||||
FinishMarking(Config::StackState::kMayContainHeapPointers);
|
||||
EXPECT_EQ(1u, NonTraceableGCed::n_trace_calls);
|
||||
access(obj);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
[
|
||||
##############################################################################
|
||||
[ALWAYS, {
|
||||
'WeakContainerTest.ConservativeGCTracesWeakContainer': [SKIP], # test is flaky.
|
||||
}],
|
||||
|
||||
['system == macos and asan', {
|
||||
# BUG(820416).
|
||||
'BitsDeathTest*': [SKIP],
|
||||
|
Loading…
Reference in New Issue
Block a user