Commit 9b2b8eb2 authored by Haruka Matsumura's avatar Haruka Matsumura Committed by Commit Bot

blink_gc_plugin: ListHashSet should always have an optional finalizer

RecordInfo.cpp was removed the condition of HeapListHashSet
from the list of types that we check the inlineCapacity.
Because HeapLishHaseSet has inline capacity.
Also, we fixed a test, so stubs.h was removed ConditionalDestructor.


Change-Id: I32a950fea200918c8ede8eccfdd3c015e2fa575d
Reviewed-on: https://chromium-review.googlesource.com/1111739Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Haruka Matsumura <harukamt@google.com>
Cr-Commit-Position: refs/heads/master@{#569570}
parent 5e381320
......@@ -85,9 +85,8 @@ bool RecordInfo::HasOptionalFinalizer() {
// delayed until FinalizeGarbageCollectedObject() gets called), unless there
// is an inline buffer. Vector, Deque, and ListHashSet can have an inline
// buffer.
if (name_ != "Vector" && name_ != "Deque" && name_ != "ListHashSet" &&
name_ != "HeapVector" && name_ != "HeapDeque" &&
name_ != "HeapListHashSet")
if (name_ != "Vector" && name_ != "Deque" && name_ != "HeapVector" &&
name_ != "HeapDeque")
return true;
ClassTemplateSpecializationDecl* tmpl =
dyn_cast<ClassTemplateSpecializationDecl>(record_);
......
......@@ -5,4 +5,10 @@ class NeedsFinalizer : public A {
./class_requires_finalization_field.h:39:5: note: [blink-gc] Field 'm_as' requiring finalization declared here:
Vector<Member<A> > m_as;
^
1 warning generated.
./class_requires_finalization_field.h:44:1: warning: [blink-gc] Class 'AlsoNeedsFinalizer' requires finalization.
class AlsoNeedsFinalizer : public A {
^
./class_requires_finalization_field.h:48:5: note: [blink-gc] Field 'm_bs' requiring finalization declared here:
HeapVector<B, 10> m_bs;
^
2 warnings generated.
......@@ -37,19 +37,10 @@ public:
static const bool isGarbageCollected = false;
};
template <bool noDestructor>
class ConditionalDestructor {
public:
~ConditionalDestructor() {}
};
template <>
class ConditionalDestructor<true> {};
template <typename T,
size_t inlineCapacity = 0,
typename Allocator = DefaultAllocator>
class Vector : public ConditionalDestructor<Allocator::isGarbageCollected> {
class Vector {
public:
using iterator = T*;
using const_iterator = const T*;
......@@ -58,63 +49,73 @@ class Vector : public ConditionalDestructor<Allocator::isGarbageCollected> {
size_t size();
T& operator[](size_t);
~Vector() {}
};
template <typename T,
size_t inlineCapacity = 0,
typename Allocator = DefaultAllocator>
class Deque : public ConditionalDestructor<Allocator::isGarbageCollected> {
class Deque {
public:
using iterator = T*;
using const_iterator = const T*;
using reverse_iterator = T*;
using const_reverse_iterator = const T*;
~Deque() {}
};
template <typename ValueArg,
typename HashArg = void,
typename TraitsArg = void,
typename Allocator = DefaultAllocator>
class HashSet : public ConditionalDestructor<Allocator::isGarbageCollected> {
class HashSet {
public:
typedef ValueArg* iterator;
typedef const ValueArg* const_iterator;
typedef ValueArg* reverse_iterator;
typedef const ValueArg* const_reverse_iterator;
~HashSet() {}
};
template <typename ValueArg,
typename HashArg = void,
typename TraitsArg = void,
typename Allocator = DefaultAllocator>
class ListHashSet
: public ConditionalDestructor<Allocator::isGarbageCollected> {
class ListHashSet {
public:
typedef ValueArg* iterator;
typedef const ValueArg* const_iterator;
typedef ValueArg* reverse_iterator;
typedef const ValueArg* const_reverse_iterator;
~ListHashSet() {}
};
template <typename ValueArg,
typename HashArg = void,
typename TraitsArg = void,
typename Allocator = DefaultAllocator>
class LinkedHashSet
: public ConditionalDestructor<Allocator::isGarbageCollected> {
class LinkedHashSet {
public:
typedef ValueArg* iterator;
typedef const ValueArg* const_iterator;
typedef ValueArg* reverse_iterator;
typedef const ValueArg* const_reverse_iterator;
~LinkedHashSet() {}
};
template <typename ValueArg,
typename HashArg = void,
typename TraitsArg = void,
typename Allocator = DefaultAllocator>
class HashCountedSet
: public ConditionalDestructor<Allocator::isGarbageCollected> {};
class HashCountedSet {
public:
~HashCountedSet() {}
};
template <typename KeyArg,
typename MappedArg,
......@@ -122,12 +123,14 @@ template <typename KeyArg,
typename KeyTraitsArg = void,
typename MappedTraitsArg = void,
typename Allocator = DefaultAllocator>
class HashMap : public ConditionalDestructor<Allocator::isGarbageCollected> {
class HashMap {
public:
typedef MappedArg* iterator;
typedef const MappedArg* const_iterator;
typedef MappedArg* reverse_iterator;
typedef const MappedArg* const_reverse_iterator;
~HashMap() {}
};
}
......
......@@ -29,4 +29,10 @@ class HeapObject : public GarbageCollected<HeapObject> {
./persistent_field_in_gc_managed_class.h:27:5: note: [blink-gc] Field 'm_weakPersistent' defining a GC root declared here:
WeakPersistent<HeapObject> m_weakPersistent;
^
4 warnings generated.
./persistent_field_in_gc_managed_class.h:20:1: warning: [blink-gc] Class 'HeapObject' requires finalization.
class HeapObject : public GarbageCollected<HeapObject> {
^
./persistent_field_in_gc_managed_class.h:27:5: note: [blink-gc] Field 'm_weakPersistent' requiring finalization declared here:
WeakPersistent<HeapObject> m_weakPersistent;
^
5 warnings generated.
......@@ -23,7 +23,7 @@ class DerivedHeapObject2 : public HeapObject {
./stack_allocated.h:43:3: warning: [blink-gc] Garbage collected class 'DerivedHeapObject2' is not permitted to override its new operator.
STACK_ALLOCATED();
^
./heap/stubs.h:179:5: note: expanded from macro 'STACK_ALLOCATED'
./heap/stubs.h:182:5: note: expanded from macro 'STACK_ALLOCATED'
__attribute__((annotate("blink_stack_allocated"))) \
^
stack_allocated.cpp:12:1: warning: [blink-gc] Class 'AnonStackObject' contains invalid fields.
......
In file included from trace_collections.cpp:5:
./trace_collections.h:12:1: warning: [blink-gc] Class 'HeapObject' requires finalization.
class HeapObject : public GarbageCollected<HeapObject> {
^
./trace_collections.h:17:5: note: [blink-gc] Field 'm_wtfVector' requiring finalization declared here:
Vector<Member<HeapObject>, 0, HeapAllocator> m_wtfVector;
^
./trace_collections.h:20:5: note: [blink-gc] Field 'm_wtfDeque' requiring finalization declared here:
Deque<Member<HeapObject>, 0, HeapAllocator> m_wtfDeque;
^
trace_collections.cpp:9:1: warning: [blink-gc] Class 'HeapObject' has untraced fields that require tracing.
void HeapObject::Trace(Visitor* visitor)
^
......@@ -49,4 +59,4 @@ void HeapObject::Trace(Visitor* visitor)
./trace_collections.h:38:5: note: [blink-gc] Untraced field 'm_wtfMapVal' declared here:
HashMap<Member<HeapObject>, int, void, void, void, HeapAllocator>
^
1 warning generated.
2 warnings generated.
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