Changeset 155258 in webkit


Ignore:
Timestamp:
Sep 7, 2013 12:45:41 PM (11 years ago)
Author:
andersca@apple.com
Message:

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

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r155251 r155258  
     12013-09-07  Anders Carlsson  <andersca@apple.com>
     2
     3        VectorMover should use std::move
     4        https://bugs.webkit.org/show_bug.cgi?id=120959
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Work around a bug in GCC by changing the type of the callType bitfield
     9        in CallLinkInfo to be unsigned instead of CallType.
     10
     11        * bytecode/CallLinkInfo.h:
     12
    1132013-09-07  Anders Carlsson  <andersca@apple.com>
    214
  • trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h

    r148696 r155258  
    8383    bool isDFG : 1;
    8484    bool hasSeenClosure : 1;
    85     CallType callType : 5;
     85    unsigned callType : 5; // CallType
    8686    unsigned calleeGPR : 8;
    8787    CodeOrigin codeOrigin;
  • trunk/Source/WTF/ChangeLog

    r155251 r155258  
     12013-09-07  Anders Carlsson  <andersca@apple.com>
     2
     3        VectorMover should use std::move
     4        https://bugs.webkit.org/show_bug.cgi?id=120959
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        This lets the compiler use move constructors when moving data, which can be a performance improvement.
     9        If the vector element type isn't movable it will be copied instead.
     10
     11        * wtf/Vector.h:
     12        (WTF::VectorTypeOperations::move):
     13        (WTF::VectorTypeOperations::moveOverlapping):
     14
    1152013-09-07  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WTF/wtf/Vector.h

    r155251 r155258  
    9191struct VectorMover<false, T>
    9292{
    93     static void move(const T* src, const T* srcEnd, T* dst)
     93    static void move(T* src, T* srcEnd, T* dst)
    9494    {
    9595        while (src != srcEnd) {
    96             new (NotNull, dst) T(*src);
    97 #if COMPILER(SUNCC) && __SUNPRO_CC <= 0x590
    98             const_cast<T*>(src)->~T(); // Work around obscure SunCC 12 compiler bug.
    99 #else
     96            new (NotNull, dst) T(std::move(*src));
    10097            src->~T();
    101 #endif
    10298            ++dst;
    10399            ++src;
    104100        }
    105101    }
    106     static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
     102    static void moveOverlapping(T* src, T* srcEnd, T* dst)
    107103    {
    108104        if (src > dst)
     
    113109                --srcEnd;
    114110                --dstEnd;
    115                 new (NotNull, dstEnd) T(*srcEnd);
     111                new (NotNull, dstEnd) T(std::move(*srcEnd));
    116112                srcEnd->~T();
    117113            }
     
    223219    }
    224220
    225     static void move(const T* src, const T* srcEnd, T* dst)
     221    static void move(T* src, T* srcEnd, T* dst)
    226222    {
    227223        VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst);
    228224    }
    229225
    230     static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
     226    static void moveOverlapping(T* src, T* srcEnd, T* dst)
    231227    {
    232228        VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst);
Note: See TracChangeset for help on using the changeset viewer.