Ignore:
Timestamp:
Apr 22, 2010, 1:31:04 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=37978
Unify JSC::IdentifierTable and WebCore::AtomicStringTable implementations.

Reviewed by Geoff Garen.

These two classes both implement a HashSet of uniqued StringImpls, with
translator classes to avoid unnecessary object creation. The only difference
between the classes is which flag (isIdentifier or inTable) is set.
Combine the two classes using a template predicated on which flag to use.

New class AtomicStringTable created, containing all the goodness from
IdentifierTable & AtomicStringTable, expect for Identifier's literalTable,
which has been moved onto JSGlobalData. Removed duplicate string translator
classes. Renamed StringImpl's inTable flag to more explicit 'isAtomic',
and set this on the empty string (which matches Identifier behaviour, and
removes a redundant check for zero-length).

(JSC::createLiteralTable):
(JSC::deleteLiteralTable):
(JSC::Identifier::add):
(JSC::Identifier::addSlowCase):

  • runtime/Identifier.h:
  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):

  • runtime/JSGlobalData.h:
  • wtf/WTFThreadData.cpp:

(WTF::WTFThreadData::WTFThreadData):
(WTF::WTFThreadData::~WTFThreadData):

  • wtf/WTFThreadData.h:

(WTF::WTFThreadData::atomicStringTable):

  • wtf/text/AtomicString.cpp:

(WebCore::table):
(WebCore::operator==):
(WebCore::AtomicString::add):
(WebCore::AtomicString::find):
(WebCore::AtomicString::remove):

  • wtf/text/AtomicStringTable.h: Added.

(WTF::CStringTranslator::hash):
(WTF::CStringTranslator::equal):
(WTF::CStringTranslator::translate):
(WTF::UCharBufferTranslator::hash):
(WTF::UCharBufferTranslator::equal):
(WTF::UCharBufferTranslator::translate):
(WTF::HashAndCharactersTranslator::hash):
(WTF::HashAndCharactersTranslator::equal):
(WTF::HashAndCharactersTranslator::translate):
(WTF::IdentifierOrAtomicStringTable::remove):
(WTF::::~IdentifierOrAtomicStringTable):
(WTF::::add):
(WTF::::find):

  • wtf/text/StringImpl.cpp:

(WebCore::StringImpl::~StringImpl):

  • wtf/text/StringImpl.h:

(WebCore::StringImpl::isAtomic):
(WebCore::StringImpl::setIsAtomic):
(WebCore::equal):

  • wtf/text/StringImplBase.h:

(WTF::StringImplBase::StringImplBase):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r58001 r58114  
    218218                86B99AE3117E578100DF5A90 /* StringBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AE1117E578100DF5A90 /* StringBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    219219                86B99AE4117E578100DF5A90 /* StringImplBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99AE2117E578100DF5A90 /* StringImplBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
     220                86B99DA711800F8500DF5A90 /* AtomicStringTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86B99DA611800F8500DF5A90 /* AtomicStringTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
    220221                86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */; };
    221222                86CA032E1038E8440028A609 /* Executable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CA032D1038E8440028A609 /* Executable.cpp */; };
     
    760761                86B99AE1117E578100DF5A90 /* StringBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringBuffer.h; path = text/StringBuffer.h; sourceTree = "<group>"; };
    761762                86B99AE2117E578100DF5A90 /* StringImplBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringImplBase.h; path = text/StringImplBase.h; sourceTree = "<group>"; };
     763                86B99DA611800F8500DF5A90 /* AtomicStringTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AtomicStringTable.h; path = text/AtomicStringTable.h; sourceTree = "<group>"; };
    762764                86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssembler.h; sourceTree = "<group>"; };
    763765                86CA032D1038E8440028A609 /* Executable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Executable.cpp; sourceTree = "<group>"; };
     
    16771679                                868BFA01117CEFD100B908B1 /* AtomicString.h */,
    16781680                                868BFA02117CEFD100B908B1 /* AtomicStringImpl.h */,
     1681                                86B99DA611800F8500DF5A90 /* AtomicStringTable.h */,
    16791682                                86565740115BE3DA00291F40 /* CString.cpp */,
    16801683                                86565741115BE3DA00291F40 /* CString.h */,
     
    20902093                                86B99AE3117E578100DF5A90 /* StringBuffer.h in Headers */,
    20912094                                86B99AE4117E578100DF5A90 /* StringImplBase.h in Headers */,
     2095                                86B99DA711800F8500DF5A90 /* AtomicStringTable.h in Headers */,
    20922096                        );
    20932097                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.