70 lines
2.6 KiB
Diff
70 lines
2.6 KiB
Diff
From 8d115ddda495d0d2e1e1447392db6e9e6a8a1b32 Mon Sep 17 00:00:00 2001
|
|
From: Stephan Hartmann <stha09@googlemail.com>
|
|
Date: Tue, 07 Apr 2020 00:23:57 +0000
|
|
Subject: [PATCH] GCC: fix template specialization in WTF::VectorMover
|
|
|
|
GCC complains that explicit specialization in non-namespace scope
|
|
is happening for MoveOverlappingImpl. However, secialization is
|
|
not really necessary here with templates and can be moved
|
|
into MoveOverlappingImpl method without changing generated code.
|
|
|
|
Bug: 819294
|
|
Change-Id: I90b893b9701748302f7b900fbcc2c341685fe0d3
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2126290
|
|
Reviewed-by: Kent Tamura <tkent@chromium.org>
|
|
Commit-Queue: Kent Tamura <tkent@chromium.org>
|
|
Cr-Commit-Position: refs/heads/master@{#756880}
|
|
---
|
|
|
|
diff --git a/third_party/blink/renderer/platform/wtf/vector.h b/third_party/blink/renderer/platform/wtf/vector.h
|
|
index 632d308..82aaf96 100644
|
|
--- a/third_party/blink/renderer/platform/wtf/vector.h
|
|
+++ b/third_party/blink/renderer/platform/wtf/vector.h
|
|
@@ -205,30 +205,23 @@
|
|
}
|
|
}
|
|
|
|
- template <bool = Allocator::kIsGarbageCollected>
|
|
- static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst);
|
|
- template <>
|
|
- static void MoveOverlappingImpl<false>(const T* src,
|
|
- const T* src_end,
|
|
- T* dst) {
|
|
- memmove(dst, src,
|
|
- reinterpret_cast<const char*>(src_end) -
|
|
- reinterpret_cast<const char*>(src));
|
|
- }
|
|
- template <>
|
|
- static void MoveOverlappingImpl<true>(const T* src,
|
|
- const T* src_end,
|
|
- T* dst) {
|
|
- if (src == dst)
|
|
- return;
|
|
- if (dst < src) {
|
|
- for (; src < src_end; ++src, ++dst)
|
|
- AtomicWriteMemcpy<sizeof(T)>(dst, src);
|
|
+ static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst) {
|
|
+ if (Allocator::kIsGarbageCollected) {
|
|
+ if (src == dst)
|
|
+ return;
|
|
+ if (dst < src) {
|
|
+ for (; src < src_end; ++src, ++dst)
|
|
+ AtomicWriteMemcpy<sizeof(T)>(dst, src);
|
|
+ } else {
|
|
+ --src_end;
|
|
+ T* dst_end = dst + (src_end - src);
|
|
+ for (; src_end >= src; --src_end, --dst_end)
|
|
+ AtomicWriteMemcpy<sizeof(T)>(dst_end, src_end);
|
|
+ }
|
|
} else {
|
|
- --src_end;
|
|
- T* dst_end = dst + (src_end - src);
|
|
- for (; src_end >= src; --src_end, --dst_end)
|
|
- AtomicWriteMemcpy<sizeof(T)>(dst_end, src_end);
|
|
+ memmove(dst, src,
|
|
+ reinterpret_cast<const char*>(src_end) -
|
|
+ reinterpret_cast<const char*>(src));
|
|
}
|
|
}
|
|
|