Commit 1e1a0e30 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[oilpan] Incremental marking: DCHECK for deleted values

Since df7973c4 there is no way to
trigger individual write barriers on deleted values, because:
a. write barriers are emitted for complete backing stores and their
   processing already takes care of deleted values
b. for moving and copying the reinsertion takes care of omitting
   deleted values

Bug: chromium:757440
Change-Id: I43fb8f43936d471e7ad6d1fb7f0da6c8bd626e52
Reviewed-on: https://chromium-review.googlesource.com/992932Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548399}
parent 9a3bf8d9
......@@ -230,6 +230,7 @@ class PLATFORM_EXPORT HeapAllocator {
DCHECK(!thread_state->Heap().GetStackFrameDepth().IsEnabled());
// No weak handling for write barriers. Modifying weakly reachable objects
// strongifies them for the current cycle.
DCHECK(!Traits::kCanHaveDeletedValue || !Traits::IsDeletedValue(*object));
TraceCollectionIfEnabled<
WTF::kNoWeakHandling, T, Traits>::Trace(thread_state
->CurrentVisitor(),
......@@ -254,6 +255,8 @@ class PLATFORM_EXPORT HeapAllocator {
// No weak handling for write barriers. Modifying weakly reachable objects
// strongifies them for the current cycle.
while (len-- > 0) {
DCHECK(!Traits::kCanHaveDeletedValue ||
!Traits::IsDeletedValue(*array));
TraceCollectionIfEnabled<
WTF::kNoWeakHandling, T, Traits>::Trace(thread_state
->CurrentVisitor(),
......
......@@ -236,8 +236,6 @@ class Object : public GarbageCollected<Object> {
// =============================================================================
TEST(IncrementalMarkingTest, EnableDisableBarrier) {
Object* object = Object::Create();
BasePage* page = PageFromObject(object);
EXPECT_FALSE(ThreadState::Current()->IsIncrementalMarking());
ThreadState::Current()->EnableIncrementalMarkingBarrier();
EXPECT_TRUE(ThreadState::Current()->IsIncrementalMarking());
......
......@@ -81,6 +81,7 @@ class PLATFORM_EXPORT Visitor {
// Member version of the one-argument templated trace method.
template <typename T>
void Trace(const Member<T>& t) {
DCHECK(!t.IsHashTableDeletedValue());
Trace(t.Get());
}
......@@ -155,6 +156,8 @@ class PLATFORM_EXPORT Visitor {
if (!t.Get())
return;
DCHECK(!t.IsHashTableDeletedValue());
VisitWeak(const_cast<void*>(reinterpret_cast<const void*>(t.Get())),
reinterpret_cast<void**>(
const_cast<typename std::remove_const<T>::type**>(t.Cell())),
......
......@@ -85,6 +85,8 @@ struct GenericHashTraitsBase<false, T> {
static const WeakHandlingFlag kWeakHandlingFlag =
IsWeak<T>::value ? kWeakHandling : kNoWeakHandling;
static constexpr bool kCanHaveDeletedValue = true;
};
// Default integer traits disallow both 0 and -1 as keys (max value instead of
......
......@@ -64,6 +64,10 @@ struct VectorTraitsBase {
};
// We don't support weak handling in vectors.
static const WeakHandlingFlag kWeakHandlingFlag = kNoWeakHandling;
// Vectors do not support deleting values.
static constexpr bool kCanHaveDeletedValue = false;
static bool IsDeletedValue(T value) { return false; }
};
template <typename T>
......@@ -142,6 +146,10 @@ struct VectorTraits<std::pair<First, Second>> {
};
// We don't support weak handling in vectors.
static const WeakHandlingFlag kWeakHandlingFlag = kNoWeakHandling;
// Vectors do not support deleting values.
static constexpr bool kCanHaveDeletedValue = false;
static bool IsDeletedValue(std::pair<First, Second> value) { return false; }
};
} // namespace WTF
......
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