Commit fe672395 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[oilpan] HeapDeque support for incremental marking

Bug: chromium:757440
Change-Id: I422c7675097209596b99d5ede7e6980b7a431323
Reviewed-on: https://chromium-review.googlesource.com/833935
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525985}
parent f91b2bba
...@@ -582,6 +582,79 @@ TEST(IncrementalMarkingTest, HeapDoublyLinkedListAppend) { ...@@ -582,6 +582,79 @@ TEST(IncrementalMarkingTest, HeapDoublyLinkedListAppend) {
} }
} }
// =============================================================================
// HeapDeque support. ==========================================================
// =============================================================================
TEST(IncrementalMarkingTest, HeapDequePushBackMember) {
Object* obj = Object::Create();
HeapDeque<Member<Object>> deq;
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {obj});
deq.push_back(obj);
}
}
TEST(IncrementalMarkingTest, HeapDequePushFrontMember) {
Object* obj = Object::Create();
HeapDeque<Member<Object>> deq;
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {obj});
deq.push_front(obj);
}
}
TEST(IncrementalMarkingTest, HeapDequeEmplaceBackMember) {
Object* obj = Object::Create();
HeapDeque<Member<Object>> deq;
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {obj});
deq.emplace_back(obj);
}
}
TEST(IncrementalMarkingTest, HeapDequeEmplaceFrontMember) {
Object* obj = Object::Create();
HeapDeque<Member<Object>> deq;
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {obj});
deq.emplace_front(obj);
}
}
TEST(IncrementalMarkingTest, HeapDequeCopyMember) {
Object* object = Object::Create();
HeapDeque<Member<Object>> deq1;
deq1.push_back(object);
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {object});
HeapDeque<Member<Object>> deq2(deq1);
}
}
TEST(IncrementalMarkingTest, HeapDequeMoveMember) {
Object* object = Object::Create();
HeapDeque<Member<Object>> deq1;
deq1.push_back(object);
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {object});
HeapDeque<Member<Object>> deq2(std::move(deq1));
}
}
TEST(IncrementalMarkingTest, HeapDequeSwapMember) {
Object* obj1 = Object::Create();
Object* obj2 = Object::Create();
HeapDeque<Member<Object>> deq1;
deq1.push_back(obj1);
HeapDeque<Member<Object>> deq2;
deq2.push_back(obj2);
{
ExpectWriteBarrierFires<Object> scope(ThreadState::Current(), {obj1, obj2});
std::swap(deq1, deq2);
}
}
} // namespace incremental_marking_test } // namespace incremental_marking_test
} // namespace blink } // namespace blink
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "platform/wtf/Allocator.h" #include "platform/wtf/Allocator.h"
#include "platform/wtf/ConstructTraits.h"
#include "platform/wtf/Vector.h" #include "platform/wtf/Vector.h"
namespace WTF { namespace WTF {
...@@ -498,7 +499,8 @@ inline void Deque<T, inlineCapacity, Allocator>::push_back(U&& value) { ...@@ -498,7 +499,8 @@ inline void Deque<T, inlineCapacity, Allocator>::push_back(U&& value) {
end_ = 0; end_ = 0;
else else
++end_; ++end_;
new (NotNull, new_element) T(std::forward<U>(value)); ConstructTraits<T, Allocator>::ConstructAndNotifyElement(
new_element, std::forward<U>(value));
} }
template <typename T, size_t inlineCapacity, typename Allocator> template <typename T, size_t inlineCapacity, typename Allocator>
...@@ -509,7 +511,8 @@ inline void Deque<T, inlineCapacity, Allocator>::push_front(U&& value) { ...@@ -509,7 +511,8 @@ inline void Deque<T, inlineCapacity, Allocator>::push_front(U&& value) {
start_ = buffer_.capacity() - 1; start_ = buffer_.capacity() - 1;
else else
--start_; --start_;
new (NotNull, &buffer_.Buffer()[start_]) T(std::forward<U>(value)); ConstructTraits<T, Allocator>::ConstructAndNotifyElement(
&buffer_.Buffer()[start_], std::forward<U>(value));
} }
template <typename T, size_t inlineCapacity, typename Allocator> template <typename T, size_t inlineCapacity, typename Allocator>
...@@ -521,7 +524,8 @@ inline void Deque<T, inlineCapacity, Allocator>::emplace_back(Args&&... args) { ...@@ -521,7 +524,8 @@ inline void Deque<T, inlineCapacity, Allocator>::emplace_back(Args&&... args) {
end_ = 0; end_ = 0;
else else
++end_; ++end_;
new (NotNull, new_element) T(std::forward<Args>(args)...); ConstructTraits<T, Allocator>::ConstructAndNotifyElement(
new_element, std::forward<Args>(args)...);
} }
template <typename T, size_t inlineCapacity, typename Allocator> template <typename T, size_t inlineCapacity, typename Allocator>
...@@ -532,7 +536,8 @@ inline void Deque<T, inlineCapacity, Allocator>::emplace_front(Args&&... args) { ...@@ -532,7 +536,8 @@ inline void Deque<T, inlineCapacity, Allocator>::emplace_front(Args&&... args) {
start_ = buffer_.capacity() - 1; start_ = buffer_.capacity() - 1;
else else
--start_; --start_;
new (NotNull, &buffer_.Buffer()[start_]) T(std::forward<Args>(args)...); ConstructTraits<T, Allocator>::ConstructAndNotifyElement(
&buffer_.Buffer()[start_], std::forward<Args>(args)...);
} }
template <typename T, size_t inlineCapacity, typename Allocator> template <typename T, size_t inlineCapacity, typename Allocator>
......
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