| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 static void move(const T* src, const T* srcEnd, T* dst) | 153 static void move(const T* src, const T* srcEnd, T* dst) |
| 154 { | 154 { |
| 155 memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret
_cast<const char*>(src)); | 155 memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret
_cast<const char*>(src)); |
| 156 } | 156 } |
| 157 static void moveOverlapping(const T* src, const T* srcEnd, T* dst) | 157 static void moveOverlapping(const T* src, const T* srcEnd, T* dst) |
| 158 { | 158 { |
| 159 memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpre
t_cast<const char*>(src)); | 159 memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpre
t_cast<const char*>(src)); |
| 160 } | 160 } |
| 161 static void swap(T* src, T* srcEnd, T* dst) | 161 static void swap(T* src, T* srcEnd, T* dst) |
| 162 { | 162 { |
| 163 char* srcC = reinterpret_cast<char*>(src); | 163 std::swap_ranges(reinterpret_cast<char*>(src), reinterpret_cast<char
*>(srcEnd), reinterpret_cast<char*>(dst)); |
| 164 char* srcEndC = reinterpret_cast<char*>(srcEnd); | |
| 165 char* dstC = reinterpret_cast<char*>(dst); | |
| 166 | |
| 167 // FIXME: Below performs per-byte swap. This can be optimized by doi
ng coarce-grained swap before-hand. | |
| 168 size_t size = srcEndC - srcC; | |
| 169 for (size_t i = 0; i < size; ++i) | |
| 170 std::swap(srcC[i], dstC[i]); | |
| 171 } | 164 } |
| 172 }; | 165 }; |
| 173 | 166 |
| 174 template <bool canCopyWithMemcpy, typename T> | 167 template <bool canCopyWithMemcpy, typename T> |
| 175 struct VectorCopier; | 168 struct VectorCopier; |
| 176 | 169 |
| 177 template<typename T> | 170 template<typename T> |
| 178 struct VectorCopier<false, T> | 171 struct VectorCopier<false, T> |
| 179 { | 172 { |
| 180 template<typename U> | 173 template<typename U> |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 } | 1195 } |
| 1203 if (this->hasOutOfLineBuffer()) | 1196 if (this->hasOutOfLineBuffer()) |
| 1204 Allocator::markNoTracing(visitor, buffer()); | 1197 Allocator::markNoTracing(visitor, buffer()); |
| 1205 } | 1198 } |
| 1206 | 1199 |
| 1207 } // namespace WTF | 1200 } // namespace WTF |
| 1208 | 1201 |
| 1209 using WTF::Vector; | 1202 using WTF::Vector; |
| 1210 | 1203 |
| 1211 #endif // WTF_Vector_h | 1204 #endif // WTF_Vector_h |
| OLD | NEW |