-
barraclough@apple.com authored
Remove unnecessary differences in common code between WebCore::StringImpl & JSC::UStringImpl Reviewed by Oliver Hunt. Much of the code in WebCore::StringImpl and JSC::UStringImpl is now very similar, but has trivial and unnecessary formatting differences, such as the exact wording of comments, missing ASSERTs, functions implemented in the .h vs .cpp etc. JavaScriptCore: * runtime/Identifier.cpp: (JSC::Identifier::add): UStringImpl::empty() now automatically hashes, uas per WebCore strings. (JSC::Identifier::addSlowCase): UStringImpl::empty() now automatically hashes, uas per WebCore strings. * runtime/UStringImpl.cpp: (JSC::UStringImpl::~UStringImpl): Only call bufferOwnership() once, add missing ASSERTs. (JSC::UStringImpl::createUninitialized): Move from .h, not commonly called, no need to inline. (JSC::UStringImpl::create): Move from .h, not commonly called, no need to inline. (JSC::UStringImpl::sharedBuffer): Rewritten to more closely match WebCore implementation, remove need for separate baseSharedBuffer() method. * runtime/UStringImpl.h: (JSC::UStringImpl::UStringImpl): Automatically hash static strings, ASSERT m_data & m_length are non-null/non-zero in non-static strings. (JSC::UStringImpl::setHash): Add missing ASSERT. (JSC::UStringImpl::create): Moved to .cpp / added missing check for empty string creation. (JSC::UStringImpl::adopt): Vector.size() returns size_t, not unsigned. (JSC::UStringImpl::cost): Renamed m_bufferSubstring -> m_substringBuffer (JSC::UStringImpl::hash): Reordered in file. (JSC::UStringImpl::existingHash): Reordered in file. (JSC::UStringImpl::computeHash): Reordered in file, renamed parameter. (JSC::UStringImpl::checkConsistency): rewrote ASSERT. (JSC::UStringImpl::bufferOwnership): Return type should be BufferOwnership. (JSC::UStringImpl::): Moved friends to head of class. WebCore: * platform/text/StringImpl.cpp: (WebCore::StringImpl::empty): Reordered in file, made empty()->characters() return a non-null value to match JSC. (WebCore::StringImpl::createUninitialized): Added overflow check. (WebCore::StringImpl::create): Reordered in file. (WebCore::StringImpl::sharedBuffer): Reordered in file. * platform/text/StringImpl.h: (WebCore::StringImpl::): Remove ThreadGlobalData as friend, move SharableUChar & SharedUChar to WebCore namespace. (WebCore::StringImpl::StringImpl): Made static constructor method (used to create empty string) take arguments, to match JSC & prevent accidental use. (WebCore::StringImpl::setHash): Added missing ASSERT. (WebCore::StringImpl::adopt): Make adpot work with Vectors with a non-zero inline capacity. (WebCore::StringImpl::characters): Mark as const to match JSC. (WebCore::StringImpl::hash): Use !m_hash instead of m_hash == 0. (WebCore::StringImpl::computeHash): Remove redundant 'inline'. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6671f13a