Title: [221552] trunk/Source
- Revision
- 221552
- Author
- [email protected]
- Date
- 2017-09-03 11:49:25 -0700 (Sun, 03 Sep 2017)
Log Message
[WTF] Add C++03 allocator interface for GCC < 6
https://bugs.webkit.org/show_bug.cgi?id=176301
Reviewed by Darin Adler.
Source/_javascript_Core:
* dfg/DFGObjectAllocationSinkingPhase.cpp:
Source/WTF:
Unfortunately, std::list in GCC < 6 does not support C++11 allocator interface.
This patch adds C++03 allocator interface to FastAllocator to make it usable
for std::list. It also allows us to use FastAllocator for data structures that
only support C++03 interface.
* wtf/FastMalloc.h:
(WTF::FastAllocator::allocate):
(WTF::FastAllocator::construct):
(WTF::FastAllocator::destroy):
(WTF::FastAllocator::max_size const):
(WTF::FastAllocator::select_on_container_copy_construction const):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (221551 => 221552)
--- trunk/Source/_javascript_Core/ChangeLog 2017-09-03 17:51:45 UTC (rev 221551)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-09-03 18:49:25 UTC (rev 221552)
@@ -1,5 +1,14 @@
2017-09-03 Yusuke Suzuki <[email protected]>
+ [WTF] Add C++03 allocator interface for GCC < 6
+ https://bugs.webkit.org/show_bug.cgi?id=176301
+
+ Reviewed by Darin Adler.
+
+ * dfg/DFGObjectAllocationSinkingPhase.cpp:
+
+2017-09-03 Yusuke Suzuki <[email protected]>
+
[JSC] Clean up BytecodeLivenessAnalysis
https://bugs.webkit.org/show_bug.cgi?id=176295
Modified: trunk/Source/_javascript_Core/dfg/DFGObjectAllocationSinkingPhase.cpp (221551 => 221552)
--- trunk/Source/_javascript_Core/dfg/DFGObjectAllocationSinkingPhase.cpp 2017-09-03 17:51:45 UTC (rev 221551)
+++ trunk/Source/_javascript_Core/dfg/DFGObjectAllocationSinkingPhase.cpp 2017-09-03 18:49:25 UTC (rev 221552)
@@ -1361,7 +1361,7 @@
// Nodes without remaining unmaterialized fields will be
// materialized first - amongst the remaining unmaterialized
// nodes
- std::list<Allocation> toMaterialize;
+ std::list<Allocation, FastAllocator<Allocation>> toMaterialize;
auto firstPos = toMaterialize.begin();
auto materializeFirst = [&] (Allocation&& allocation) {
materialize(allocation.identifier());
Modified: trunk/Source/WTF/ChangeLog (221551 => 221552)
--- trunk/Source/WTF/ChangeLog 2017-09-03 17:51:45 UTC (rev 221551)
+++ trunk/Source/WTF/ChangeLog 2017-09-03 18:49:25 UTC (rev 221552)
@@ -1,3 +1,22 @@
+2017-09-03 Yusuke Suzuki <[email protected]>
+
+ [WTF] Add C++03 allocator interface for GCC < 6
+ https://bugs.webkit.org/show_bug.cgi?id=176301
+
+ Reviewed by Darin Adler.
+
+ Unfortunately, std::list in GCC < 6 does not support C++11 allocator interface.
+ This patch adds C++03 allocator interface to FastAllocator to make it usable
+ for std::list. It also allows us to use FastAllocator for data structures that
+ only support C++03 interface.
+
+ * wtf/FastMalloc.h:
+ (WTF::FastAllocator::allocate):
+ (WTF::FastAllocator::construct):
+ (WTF::FastAllocator::destroy):
+ (WTF::FastAllocator::max_size const):
+ (WTF::FastAllocator::select_on_container_copy_construction const):
+
2017-09-03 Sam Weinig <[email protected]>
Remove CanvasProxy
Modified: trunk/Source/WTF/wtf/FastMalloc.h (221551 => 221552)
--- trunk/Source/WTF/wtf/FastMalloc.h 2017-09-03 17:51:45 UTC (rev 221551)
+++ trunk/Source/WTF/wtf/FastMalloc.h 2017-09-03 18:49:25 UTC (rev 221552)
@@ -124,6 +124,59 @@
{
fastFree(pointer);
}
+
+#if COMPILER(GCC) && !GCC_VERSION_AT_LEAST(6, 0, 0)
+ // This allocator also supports pre-C++11 STL allocator interface. This is a workaround for GCC < 6, which std::list
+ // does not support C++11 allocator.
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55409
+
+ using pointer = value_type*;
+ using const_pointer = typename std::pointer_traits<pointer>::template rebind<value_type const>;
+ using void_pointer = typename std::pointer_traits<pointer>::template rebind<void>;
+ using const_void_pointer = typename std::pointer_traits<pointer>::template rebind<const void>;
+
+ using reference = T&;
+ using const_reference = const T&;
+
+ using difference_type = typename std::pointer_traits<pointer>::difference_type;
+ using size_type = std::make_unsigned_t<difference_type>;
+
+ template <class U> struct rebind {
+ using other = FastAllocator<U>;
+ };
+
+ value_type* allocate(std::size_t count, const_void_pointer)
+ {
+ return allocate(count);
+ }
+
+ template <class U, class ...Args>
+ void construct(U* p, Args&& ...args)
+ {
+ new (const_cast<void*>(static_cast<const void*>(p))) U(std::forward<Args>(args)...);
+ }
+
+ template <class U>
+ void destroy(U* p)
+ {
+ p->~U();
+ }
+
+ std::size_t max_size() const
+ {
+ return std::numeric_limits<size_type>::max();
+ }
+
+ FastAllocator<T> select_on_container_copy_construction() const
+ {
+ return *this;
+ }
+
+ using propagate_on_container_copy_assignment = std::false_type;
+ using propagate_on_container_move_assignment = std::false_type;
+ using propagate_on_container_swap = std::false_type;
+ using is_always_equal = std::is_empty<FastAllocator>;
+#endif // COMPILER(GCC) && !GCC_VERSION_AT_LEAST(6, 0, 0)
};
template<typename T, typename U> inline bool operator==(const FastAllocator<T>&, const FastAllocator<U>&) { return true; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes