Title: [155258] trunk/Source
Revision
155258
Author
[email protected]
Date
2013-09-07 12:45:41 -0700 (Sat, 07 Sep 2013)

Log Message

VectorMover should use std::move
https://bugs.webkit.org/show_bug.cgi?id=120959

Reviewed by Geoffrey Garen.

Source/_javascript_Core:

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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (155257 => 155258)


--- trunk/Source/_javascript_Core/ChangeLog	2013-09-07 19:11:59 UTC (rev 155257)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-09-07 19:45:41 UTC (rev 155258)
@@ -1,5 +1,17 @@
 2013-09-07  Anders Carlsson  <[email protected]>
 
+        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  <[email protected]>
+
         Get rid of FastAllocBase.h
         https://bugs.webkit.org/show_bug.cgi?id=120952
 

Modified: trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h (155257 => 155258)


--- trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h	2013-09-07 19:11:59 UTC (rev 155257)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h	2013-09-07 19:45:41 UTC (rev 155258)
@@ -82,7 +82,7 @@
     bool hasSeenShouldRepatch : 1;
     bool isDFG : 1;
     bool hasSeenClosure : 1;
-    CallType callType : 5;
+    unsigned callType : 5; // CallType
     unsigned calleeGPR : 8;
     CodeOrigin codeOrigin;
 

Modified: trunk/Source/WTF/ChangeLog (155257 => 155258)


--- trunk/Source/WTF/ChangeLog	2013-09-07 19:11:59 UTC (rev 155257)
+++ trunk/Source/WTF/ChangeLog	2013-09-07 19:45:41 UTC (rev 155258)
@@ -1,5 +1,19 @@
 2013-09-07  Anders Carlsson  <[email protected]>
 
+        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  <[email protected]>
+
         Get rid of FastAllocBase.h
         https://bugs.webkit.org/show_bug.cgi?id=120952
 

Modified: trunk/Source/WTF/wtf/Vector.h (155257 => 155258)


--- trunk/Source/WTF/wtf/Vector.h	2013-09-07 19:11:59 UTC (rev 155257)
+++ trunk/Source/WTF/wtf/Vector.h	2013-09-07 19:45:41 UTC (rev 155258)
@@ -90,20 +90,16 @@
 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 @@
             while (src != srcEnd) {
                 --srcEnd;
                 --dstEnd;
-                new (NotNull, dstEnd) T(*srcEnd);
+                new (NotNull, dstEnd) T(std::move(*srcEnd));
                 srcEnd->~T();
             }
         }
@@ -222,12 +218,12 @@
         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);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to