Commit 2d655a2f authored by andersca@apple.com's avatar andersca@apple.com

VectorMover should use std::move

https://bugs.webkit.org/show_bug.cgi?id=120959

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Work around a bug in GCC by changing the type of the callType bitfield
in CallLinkInfo to be unsigned instead of CallType.

* bytecode/CallLinkInfo.h:

Source/WTF:

This lets the compiler use move constructors when moving data, which can be a performance improvement.
If the vector element type isn't movable it will be copied instead.

* wtf/Vector.h:
(WTF::VectorTypeOperations::move):
(WTF::VectorTypeOperations::moveOverlapping):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155258 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a1e36412
2013-09-07 Anders Carlsson <andersca@apple.com>
VectorMover should use std::move
https://bugs.webkit.org/show_bug.cgi?id=120959
Reviewed by Geoffrey Garen.
Work around a bug in GCC by changing the type of the callType bitfield
in CallLinkInfo to be unsigned instead of CallType.
* bytecode/CallLinkInfo.h:
2013-09-07 Anders Carlsson <andersca@apple.com>
Get rid of FastAllocBase.h
......
......@@ -82,7 +82,7 @@ struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
bool hasSeenShouldRepatch : 1;
bool isDFG : 1;
bool hasSeenClosure : 1;
CallType callType : 5;
unsigned callType : 5; // CallType
unsigned calleeGPR : 8;
CodeOrigin codeOrigin;
......
2013-09-07 Anders Carlsson <andersca@apple.com>
VectorMover should use std::move
https://bugs.webkit.org/show_bug.cgi?id=120959
Reviewed by Geoffrey Garen.
This lets the compiler use move constructors when moving data, which can be a performance improvement.
If the vector element type isn't movable it will be copied instead.
* wtf/Vector.h:
(WTF::VectorTypeOperations::move):
(WTF::VectorTypeOperations::moveOverlapping):
2013-09-07 Anders Carlsson <andersca@apple.com>
Get rid of FastAllocBase.h
......
......@@ -90,20 +90,16 @@ struct VectorMover;
template<typename T>
struct VectorMover<false, T>
{
static void move(const T* src, const T* srcEnd, T* dst)
static void move(T* src, T* srcEnd, T* dst)
{
while (src != srcEnd) {
new (NotNull, dst) T(*src);
#if COMPILER(SUNCC) && __SUNPRO_CC <= 0x590
const_cast<T*>(src)->~T(); // Work around obscure SunCC 12 compiler bug.
#else
new (NotNull, dst) T(std::move(*src));
src->~T();
#endif
++dst;
++src;
}
}
static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
static void moveOverlapping(T* src, T* srcEnd, T* dst)
{
if (src > dst)
move(src, srcEnd, dst);
......@@ -112,7 +108,7 @@ struct VectorMover<false, T>
while (src != srcEnd) {
--srcEnd;
--dstEnd;
new (NotNull, dstEnd) T(*srcEnd);
new (NotNull, dstEnd) T(std::move(*srcEnd));
srcEnd->~T();
}
}
......@@ -222,12 +218,12 @@ struct VectorTypeOperations
VectorInitializer<VectorTraits<T>::needsInitialization, VectorTraits<T>::canInitializeWithMemset, T>::initialize(begin, end);
}
static void move(const T* src, const T* srcEnd, T* dst)
static void move(T* src, T* srcEnd, T* dst)
{
VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst);
}
static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
static void moveOverlapping(T* src, T* srcEnd, T* dst)
{
VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst);
}
......
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