Changeset 83637 in webkit


Ignore:
Timestamp:
Apr 12, 2011 2:12:33 PM (13 years ago)
Author:
ggaren@apple.com
Message:

2011-04-12 Geoffrey Garen <ggaren@apple.com>

Reviewed by Sam Weinig.

Cleaned up some Vector traits, and added missing Vector traits for handles
https://bugs.webkit.org/show_bug.cgi?id=58372

  • heap/Local.h: Inherit from SimpleClassVectorTraits to avoid duplication.
  • heap/Strong.h: Ditto.
  • heap/Weak.h: Ditto.
  • parser/JSParser.cpp: Fixed a traits error. No test case because this particular trait is not currently exercised by the parser.
  • runtime/UString.h: No need to override canInitializeWithMemset, since our base class sets it to true.
  • wtf/VectorTraits.h: Inherit from VectorTraitsBase to avoid duplication.
  • wtf/text/WTFString.h: No need to override canInitializeWithMemset, since our base class sets it to true.

2011-04-12 Geoffrey Garen <ggaren@apple.com>

Reviewed by Sam Weinig.

Cleaned up some Vector traits, and added missing Vector traits for handles
https://bugs.webkit.org/show_bug.cgi?id=58372

  • platform/graphics/BitmapImage.h: Added a FIXME because the current Vector traits for FrameData are logically incorrect, but I couldn't find a place where this currently results in bad behavior, and it's not immediately obvious what the right solution is.
Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r83626 r83637  
     12011-04-12  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Cleaned up some Vector traits, and added missing Vector traits for handles
     6        https://bugs.webkit.org/show_bug.cgi?id=58372
     7
     8        * heap/Local.h: Inherit from SimpleClassVectorTraits to avoid duplication.
     9
     10        * heap/Strong.h: Ditto.
     11
     12        * heap/Weak.h: Ditto.
     13
     14        * parser/JSParser.cpp: Fixed a traits error. No test case because this
     15        particular trait is not currently exercised by the parser.
     16
     17        * runtime/UString.h: No need to override canInitializeWithMemset, since
     18        our base class sets it to true.
     19
     20        * wtf/VectorTraits.h: Inherit from VectorTraitsBase to avoid duplication.
     21
     22        * wtf/text/WTFString.h: No need to override canInitializeWithMemset, since
     23        our base class sets it to true.
     24
    1252011-04-12  Thouraya ANDOLSI  <thouraya.andolsi@st.com>
    226
  • trunk/Source/JavaScriptCore/heap/Local.h

    r83385 r83637  
    142142namespace WTF {
    143143
    144 template<typename T> struct VectorTraits<JSC::Local<T> > {
     144template<typename T> struct VectorTraits<JSC::Local<T> > : SimpleClassVectorTraits {
    145145    static const bool needsDestruction = false;
    146     static const bool needsInitialization = true;
    147146    static const bool canInitializeWithMemset = false;
    148     static const bool canMoveWithMemcpy = true;
    149     static const bool canCopyWithMemcpy = false;
    150     static const bool canFillWithMemset = false;
    151     static const bool canCompareWithMemcmp = true;
     147    static const bool canCompareWithMemcmp = false;
    152148};
    153149
  • trunk/Source/JavaScriptCore/heap/Strong.h

    r83385 r83637  
    138138};
    139139
    140 }
     140} // namespace JSC
    141141
    142142namespace WTF {
     143
     144template<typename T> struct VectorTraits<JSC::Strong<T> > : SimpleClassVectorTraits {
     145    static const bool canCompareWithMemcmp = false;
     146};
    143147
    144148template<typename P> struct HashTraits<JSC::Strong<P> > : GenericHashTraits<JSC::Strong<P> > {
  • trunk/Source/JavaScriptCore/heap/Weak.h

    r83385 r83637  
    109109} // namespace JSC
    110110
     111namespace WTF {
     112
     113template<typename T> struct VectorTraits<JSC::Weak<T> > : SimpleClassVectorTraits {
     114    static const bool canCompareWithMemcmp = false;
     115};
     116
     117}
     118
    111119#endif // Weak_h
  • trunk/Source/JavaScriptCore/parser/JSParser.cpp

    r79749 r83637  
    21692169namespace WTF
    21702170{
    2171     template <> struct VectorTraits<JSC::JSParser::Scope> : SimpleClassVectorTraits { };
    2172 }
     2171    template <> struct VectorTraits<JSC::JSParser::Scope> : SimpleClassVectorTraits {
     2172        static const bool canInitializeWithMemset = false; // Not all Scope data members initialize to 0.
     2173    };
     2174}
  • trunk/Source/JavaScriptCore/runtime/UString.h

    r72289 r83637  
    253253};
    254254
    255 template <> struct VectorTraits<JSC::UString> : SimpleClassVectorTraits
    256 {
    257     static const bool canInitializeWithMemset = true;
    258 };
     255template <> struct VectorTraits<JSC::UString> : SimpleClassVectorTraits { };
    259256
    260257} // namespace WTF
  • trunk/Source/JavaScriptCore/wtf/VectorTraits.h

    r55120 r83637  
    6262    struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { };
    6363
    64     struct SimpleClassVectorTraits
     64    struct SimpleClassVectorTraits : VectorTraitsBase<false, void>
    6565    {
    66         static const bool needsDestruction = true;
    67         static const bool needsInitialization = true;
    6866        static const bool canInitializeWithMemset = true;
    6967        static const bool canMoveWithMemcpy = true;
    70         static const bool canCopyWithMemcpy = false;
    71         static const bool canFillWithMemset = false;
    7268        static const bool canCompareWithMemcmp = true;
    7369    };
  • trunk/Source/JavaScriptCore/wtf/text/WTFString.h

    r80012 r83637  
    500500};
    501501
    502 template <> struct VectorTraits<String> : SimpleClassVectorTraits
    503 {
    504     static const bool canInitializeWithMemset = true;
    505 };
     502template <> struct VectorTraits<String> : SimpleClassVectorTraits { };
    506503
    507504}
  • trunk/Source/WebCore/ChangeLog

    r83636 r83637  
     12011-04-12  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Cleaned up some Vector traits, and added missing Vector traits for handles
     6        https://bugs.webkit.org/show_bug.cgi?id=58372
     7
     8        * platform/graphics/BitmapImage.h: Added a FIXME because the current
     9        Vector traits for FrameData are logically incorrect, but I couldn't find
     10        a place where this currently results in bad behavior, and it's not
     11        immediately obvious what the right solution is.
     12
    1132011-04-12  Dimitri Glazkov  <dglazkov@chromium.org>
    214
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r83091 r83637  
    5454}
    5555
    56 // This complicated-looking declaration tells the FrameData Vector that it should copy without
    57 // invoking our constructor or destructor. This allows us to have a vector even for a struct
    58 // that's not copyable.
    5956namespace WTF {
    60     template<> struct VectorTraits<WebCore::FrameData> : public SimpleClassVectorTraits {};
     57    // FIXME: This declaration gives FrameData a default constructor that zeroes
     58    // all its data members, even though FrameData's default constructor defined
     59    // below does not zero all its data members. One of these must be wrong!
     60    template<> struct VectorTraits<WebCore::FrameData> : public SimpleClassVectorTraits { };
    6161}
    6262
Note: See TracChangeset for help on using the changeset viewer.