Ignore:
Timestamp:
Apr 20, 2010, 1:33:56 PM (15 years ago)
Author:
[email protected]
Message:

JavaScriptCore: Add missing .def file entries.

Reviewed by NOBODY (windows build fix).

WebCore: Speculative tiger build fix.

Reviewed by NOBODY (build fix).

  • WebCore.NPAPI.exp:
  • WebCore.PluginHostProcess.exp:
  • WebCore.base.exp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UStringImpl.h

    r57851 r57912  
    4242typedef CrossThreadRefCounted<SharableUChar> SharedUChar;
    4343
    44 class UStringOrRopeImpl : public Noncopyable {
     44class UStringImplBase : public Noncopyable {
    4545public:
    46     bool isRope() { return (m_refCountAndFlags & s_refCountIsRope) == s_refCountIsRope; }
     46    bool isStringImpl() { return (m_refCountAndFlags & s_refCountInvalidForStringImpl) != s_refCountInvalidForStringImpl; }
    4747    unsigned length() const { return m_length; }
    4848
    4949    void ref() { m_refCountAndFlags += s_refCountIncrement; }
    50     inline void deref();
    5150
    5251protected:
     
    6261
    6362    // For SmallStringStorage, which allocates an array and uses an in-place new.
    64     UStringOrRopeImpl() { }
    65 
    66     UStringOrRopeImpl(unsigned length, BufferOwnership ownership)
     63    UStringImplBase() { }
     64
     65    UStringImplBase(unsigned length, BufferOwnership ownership)
    6766        : m_refCountAndFlags(s_refCountIncrement | s_refCountFlagShouldReportedCost | ownership)
    6867        , m_length(length)
    6968    {
    70         ASSERT(!isRope());
     69        ASSERT(isStringImpl());
    7170    }
    7271
    7372    enum StaticStringConstructType { ConstructStaticString };
    74     UStringOrRopeImpl(unsigned length, StaticStringConstructType)
     73    UStringImplBase(unsigned length, StaticStringConstructType)
    7574        : m_refCountAndFlags(s_refCountFlagStatic | s_refCountFlagIsIdentifier | BufferOwned)
    7675        , m_length(length)
    7776    {
    78         ASSERT(!isRope());
    79     }
    80 
    81     enum RopeConstructType { ConstructRope };
    82     UStringOrRopeImpl(RopeConstructType)
    83         : m_refCountAndFlags(s_refCountIncrement | s_refCountIsRope)
     77        ASSERT(isStringImpl());
     78    }
     79
     80    // This constructor is not used when creating UStringImpl objects,
     81    // and sets the flags into a state marking the object as such.
     82    enum NonStringImplConstructType { ConstructNonStringImpl };
     83    UStringImplBase(NonStringImplConstructType)
     84        : m_refCountAndFlags(s_refCountIncrement | s_refCountInvalidForStringImpl)
    8485        , m_length(0)
    8586    {
    86         ASSERT(isRope());
     87        ASSERT(!isStringImpl());
    8788    }
    8889
     
    9697    static const unsigned s_refCountFlagIsIdentifier = 0x4;
    9798    static const unsigned s_refCountMaskBufferOwnership = 0x3;
    98     // Use an otherwise invalid permutation of flags (static & shouldReportedCost -
    99     // static strings do not set shouldReportedCost in the constructor, and this bit
    100     // is only ever cleared, not set) to identify objects that are ropes.
    101     static const unsigned s_refCountIsRope = s_refCountFlagStatic | s_refCountFlagShouldReportedCost;
     99    // An invalid permutation of flags (static & shouldReportedCost - static strings do not
     100    // set shouldReportedCost in the constructor, and this bit is only ever cleared, not set).
     101    // Used by "ConstructNonStringImpl" constructor, above.
     102    static const unsigned s_refCountInvalidForStringImpl = s_refCountFlagStatic | s_refCountFlagShouldReportedCost;
    102103
    103104    unsigned m_refCountAndFlags;
     
    105106};
    106107
    107 class UStringImpl : public UStringOrRopeImpl {
     108class UStringImpl : public UStringImplBase {
    108109    friend struct CStringTranslator;
    109110    friend struct UCharBufferTranslator;
    110111    friend class JIT;
    111112    friend class SmallStringsStorage;
    112     friend class UStringOrRopeImpl;
    113113    friend void initializeUString();
    114114private:
     
    120120    // static strings will be shared across threads & ref-counted in a non-threadsafe manner.
    121121    UStringImpl(const UChar* characters, unsigned length, StaticStringConstructType)
    122         : UStringOrRopeImpl(length, ConstructStaticString)
     122        : UStringImplBase(length, ConstructStaticString)
    123123        , m_data(characters)
    124124        , m_buffer(0)
     
    130130    // Create a normal string with internal storage (BufferInternal)
    131131    UStringImpl(unsigned length)
    132         : UStringOrRopeImpl(length, BufferInternal)
     132        : UStringImplBase(length, BufferInternal)
    133133        , m_data(reinterpret_cast<UChar*>(this + 1))
    134134        , m_buffer(0)
     
    141141    // Create a UStringImpl adopting ownership of the provided buffer (BufferOwned)
    142142    UStringImpl(const UChar* characters, unsigned length)
    143         : UStringOrRopeImpl(length, BufferOwned)
     143        : UStringImplBase(length, BufferOwned)
    144144        , m_data(characters)
    145145        , m_buffer(0)
     
    152152    // Used to create new strings that are a substring of an existing UStringImpl (BufferSubstring)
    153153    UStringImpl(const UChar* characters, unsigned length, PassRefPtr<UStringImpl> base)
    154         : UStringOrRopeImpl(length, BufferSubstring)
     154        : UStringImplBase(length, BufferSubstring)
    155155        , m_data(characters)
    156156        , m_substringBuffer(base.releaseRef())
     
    164164    // Used to construct new strings sharing an existing SharedUChar (BufferShared)
    165165    UStringImpl(const UChar* characters, unsigned length, PassRefPtr<SharedUChar> sharedBuffer)
    166         : UStringOrRopeImpl(length, BufferShared)
     166        : UStringImplBase(length, BufferShared)
    167167        , m_data(characters)
    168168        , m_sharedBuffer(sharedBuffer.releaseRef())
     
    289289};
    290290
    291 class URopeImpl : public UStringOrRopeImpl {
    292     friend class UStringOrRopeImpl;
    293 public:
    294     // A URopeImpl is composed from a set of smaller strings called Fibers.
    295     // Each Fiber in a rope is either UStringImpl or another URopeImpl.
    296     typedef UStringOrRopeImpl* Fiber;
    297 
    298     // Creates a URopeImpl comprising of 'fiberCount' Fibers.
    299     // The URopeImpl is constructed in an uninitialized state - initialize must be called for each Fiber in the URopeImpl.
    300     static PassRefPtr<URopeImpl> tryCreateUninitialized(unsigned fiberCount)
    301     {
    302         void* allocation;
    303         if (tryFastMalloc(sizeof(URopeImpl) + (fiberCount - 1) * sizeof(Fiber)).getValue(allocation))
    304             return adoptRef(new (allocation) URopeImpl(fiberCount));
    305         return 0;
    306     }
    307 
    308     void initializeFiber(unsigned &index, Fiber fiber)
    309     {
    310         m_fibers[index++] = fiber;
    311         fiber->ref();
    312         m_length += fiber->length();
    313     }
    314 
    315     unsigned fiberCount() { return m_fiberCount; }
    316     Fiber& fibers(unsigned index) { return m_fibers[index]; }
    317 
    318     ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & s_refCountMask)) destructNonRecursive(); }
    319 
    320 private:
    321     URopeImpl(unsigned fiberCount) : UStringOrRopeImpl(ConstructRope), m_fiberCount(fiberCount) {}
    322 
    323     void destructNonRecursive();
    324     void derefFibersNonRecursive(Vector<URopeImpl*, 32>& workQueue);
    325 
    326     bool hasOneRef() { return (m_refCountAndFlags & s_refCountMask) == s_refCountIncrement; }
    327 
    328     unsigned m_fiberCount;
    329     Fiber m_fibers[1];
    330 };
    331 
    332 inline void UStringOrRopeImpl::deref()
    333 {
    334     if (isRope())
    335         static_cast<URopeImpl*>(this)->deref();
    336     else
    337         static_cast<UStringImpl*>(this)->deref();
     291bool equal(const UStringImpl*, const UStringImpl*);
     292
    338293}
    339294
    340 bool equal(const UStringImpl*, const UStringImpl*);
    341 
    342 }
    343 
    344295#endif
Note: See TracChangeset for help on using the changeset viewer.