Changeset 55943 in webkit for trunk/JavaScriptCore/API


Ignore:
Timestamp:
Mar 12, 2010, 3:49:05 PM (15 years ago)
Author:
[email protected]
Message:

Bug 36075 - Clean up screwyness re static string impls & Identifiers.

Reviewed by Oliver Hunt.

JavaScriptCore:

  • API/JSClassRef.cpp:

(OpaqueJSClass::~OpaqueJSClass): Classname may be null/empty, and these are an identifer. This is okay, since the null/empty strings are shared across all threads.

(JSC::Identifier::add): No need to explicitly hash null reps, this is done in the ststic UStringImpl constructor.
(JSC::Identifier::addSlowCase): UStringImpl::empty() handled & checkCurrentIdentifierTable now called in the header.
(JSC::Identifier::checkCurrentIdentifierTable): Replaces checkSameIdentifierTable (this no longer checked the rep since the identifierTable pointer was removed from UString::Rep long ago).

  • runtime/Identifier.h:

(JSC::Identifier::add): Replace call to checkSameIdentifierTable with call to checkCurrentIdentifierTable at head of function.

  • runtime/UStringImpl.cpp:

(JSC::UStringImpl::~UStringImpl): Remove call to checkConsistency - this function no longer checks anything interesting.

  • runtime/UStringImpl.h:

(JSC::UStringOrRopeImpl::UStringOrRopeImpl): Set s_refCountFlagIsIdentifier in static constructor.
(JSC::UStringImpl::UStringImpl): remove calls to checkConsistency (see above), add new ASSERT to substring constructor.
(JSC::UStringImpl::setHash): ASSERT not static (static strings set the hash in their constructor, should not reach this code path).
(JSC::UStringImpl::create): Add missing ASSERT.
(JSC::UStringImpl::setIsIdentifier): ASSERT !isStatic() (static strings hash set in constructor).

WebCore:

  • platform/text/StringImpl.cpp:

(WebCore::StringImpl::~StringImpl): Add ASSERT
(WebCore::StringImpl::sharedBuffer): Add ASSERT

  • platform/text/StringImpl.h:

(WebCore::StringImpl::setHash): Add ASSERT
(WebCore::StringImpl::isStatic): added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSClassRef.cpp

    r55833 r55943  
    112112OpaqueJSClass::~OpaqueJSClass()
    113113{
    114     ASSERT(!m_className.rep()->isIdentifier());
     114    // The empty string is shared across threads & is an identifier, in all other cases we should have done a deep copy in className(), below.
     115    ASSERT(!m_className.size() || !m_className.rep()->isIdentifier());
    115116
    116117    if (m_staticValues) {
Note: See TracChangeset for help on using the changeset viewer.