1. 27 May, 2010 1 commit
    • eric@webkit.org's avatar
      2010-05-27 Luiz Agostini <luiz.agostini@openbossa.org> · 4ad71207
      eric@webkit.org authored
              Reviewed by Darin Adler.
      
              UTF-16 code points compare() for String objects
              https://bugs.webkit.org/show_bug.cgi?id=39701
      
              Moving compare() implementation from UString to StringImpl for it to be shared
              with String. Adding overloaded free functions codePointCompare() in StringImpl
              and WTFString. Renaming function compare in UString to codePointCompare to be
              consistent.
      
              * runtime/JSArray.cpp:
              (JSC::compareByStringPairForQSort):
              * runtime/UString.cpp:
              * runtime/UString.h:
              (JSC::codePointCompare):
              * wtf/text/StringImpl.cpp:
              (WebCore::codePointCompare):
              * wtf/text/StringImpl.h:
              * wtf/text/WTFString.cpp:
              (WebCore::codePointCompare):
              * wtf/text/WTFString.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60332 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4ad71207
  2. 13 May, 2010 1 commit
  3. 12 May, 2010 1 commit
  4. 05 May, 2010 1 commit
    • barraclough@apple.com's avatar
      Bug 38604 - workers-gc2 crashing on Qt · b8718f29
      barraclough@apple.com authored
      Reviewed by Darin Adler.
      
      This appears to be due to a couple of issues.
      (1) When the atomic string table is deleted it does not clear the 'inTable' bit
      on AtomicStrings - it implicitly assumes that all AtomicStrings have already
      been deleted at this point (otherwise they will crash in their destructor when
      they try to remove themselves from the atomic string table).
      (2) We don't fix the ordering in which WTF::WTFThreadData and
      WebCore::ThreadGlobalData are destructed.
      
      We should make sure that ThreadGlobalData is cleaned up before worker threads
      terminate and WTF::WTFThreadData is destroyed, and we should clear the inTable
      bit of members on atomic string table destruction.
      
      JavaScriptCore: 
      
      WTF changes (fix issue 1, above) - ensure inTable property is cleared when the
      atomic string table is destroyed (also, rename InTable to IsAtomic, to make it
      clear which table we are refering to!)
      
      * wtf/text/AtomicString.cpp:
      (WebCore::AtomicStringTable::destroy):
      (WebCore::CStringTranslator::translate):
      (WebCore::UCharBufferTranslator::translate):
      (WebCore::HashAndCharactersTranslator::translate):
      (WebCore::AtomicString::add):
      * wtf/text/StringImpl.cpp:
      (WebCore::StringImpl::~StringImpl):
      * wtf/text/StringImpl.h:
      (WebCore::StringImpl::isAtomic):
      (WebCore::StringImpl::setIsAtomic):
      * wtf/text/StringImplBase.h:
      
      WebCore: 
      
      WTF changes (fix issue 2, above) - clean up the thread data on worker termination.
      
      * platform/ThreadGlobalData.cpp:
      (WebCore::ThreadGlobalData::~ThreadGlobalData):
      (WebCore::ThreadGlobalData::destroy):
      * platform/ThreadGlobalData.h:
      * workers/WorkerThread.cpp:
      (WebCore::WorkerThread::workerThread):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b8718f29
  5. 03 May, 2010 1 commit
    • barraclough@apple.com's avatar
      Rolling out r58114 - this introduced memory leaks of · 560d3d51
      barraclough@apple.com authored
      AtomicStrings then workers terminated.
      
      Reviewed by NOBODY (reverting previous commit).
      
      * GNUmakefile.am:
      * JavaScriptCore.gypi:
      * JavaScriptCore.vcproj/WTF/WTF.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * jit/ThunkGenerators.cpp:
      (JSC::ThunkHelpers::stringImplDataOffset):
      * runtime/Identifier.cpp:
      (JSC::IdentifierTable::~IdentifierTable):
      (JSC::IdentifierTable::add):
      (JSC::IdentifierCStringTranslator::hash):
      (JSC::IdentifierCStringTranslator::equal):
      (JSC::IdentifierCStringTranslator::translate):
      (JSC::Identifier::add):
      (JSC::IdentifierUCharBufferTranslator::hash):
      (JSC::IdentifierUCharBufferTranslator::equal):
      (JSC::IdentifierUCharBufferTranslator::translate):
      (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:
      (JSC::IdentifierTable::remove):
      (JSC::IdentifierTable::literalTable):
      (WTF::WTFThreadData::atomicStringTable):
      * wtf/text/AtomicString.cpp:
      (WebCore::AtomicStringTable::create):
      (WebCore::AtomicStringTable::table):
      (WebCore::AtomicStringTable::destroy):
      (WebCore::stringTable):
      (WebCore::CStringTranslator::hash):
      (WebCore::CStringTranslator::equal):
      (WebCore::CStringTranslator::translate):
      (WebCore::operator==):
      (WebCore::AtomicString::add):
      (WebCore::equal):
      (WebCore::UCharBufferTranslator::hash):
      (WebCore::UCharBufferTranslator::equal):
      (WebCore::UCharBufferTranslator::translate):
      (WebCore::HashAndCharactersTranslator::hash):
      (WebCore::HashAndCharactersTranslator::equal):
      (WebCore::HashAndCharactersTranslator::translate):
      (WebCore::AtomicString::find):
      (WebCore::AtomicString::remove):
      * wtf/text/AtomicStringTable.h: Removed.
      * wtf/text/StringImpl.cpp:
      (WebCore::StringImpl::~StringImpl):
      * wtf/text/StringImpl.h:
      (WebCore::StringImpl::inTable):
      (WebCore::StringImpl::setInTable):
      (WebCore::equal):
      * wtf/text/StringImplBase.h:
      (WTF::StringImplBase::StringImplBase):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      560d3d51
  6. 28 Apr, 2010 1 commit
    • hausmann@webkit.org's avatar
      Fix compilation with gcc 3.4. · f2933708
      hausmann@webkit.org authored
      Patch by Thiago Macieira <thiago.macieira@nokia.com> on 2010-04-28
      Reviewed by Simon Hausmann.
      
      AtomicStringImpl.h:29: error: base `WebCore::StringImpl' with only
      non-default constructor in class without a constructor
      
      * wtf/text/AtomicStringImpl.h:
      (WebCore::AtomicStringImpl::AtomicStringImpl): Provide a default constructor.
      * wtf/text/StringImpl.h: Allow AtomicStringImpl to call a StringImpl constructor through a friend declaration.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f2933708
  7. 26 Apr, 2010 1 commit
    • oliver@apple.com's avatar
      2010-04-26 Oliver Hunt <oliver@apple.com> · 8e293b78
      oliver@apple.com authored
              Reviewed by Gavin Barraclough.
      
              Need to support more efficient dispatch of lightweight builtins
              https://bugs.webkit.org/show_bug.cgi?id=38155
      
              The problem with calling lightweight builtins is that marshalling
              the call from the nitro calling convention to the system calling
              convention is very expensive relative to the cost of the actually
              evaluating the function.  To work around this problem this patch
              adds the ability to define a custom thunk for a builtin.
      
              This allows us to use high performance custom implementations of
              the common and sensible versions of simple builtins.  This patch
              includes a simple (use of which is currently hardcoded) thunk for
              charCodeAt.
      
              This adds a JSInterfaceJIT subclass called SpecializedThunkJIT
              that has helper functions to remove (or at least reduce) the need
              to have separate thunk implementations for each JSValue encoding.
      
              * GNUmakefile.am:
              * JavaScriptCore.pro:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              * JavaScriptCore.xcodeproj/project.pbxproj:
                Many project file updates
      
              * create_hash_table:
                Add thunk generation callbacks to the hash tables, currently
                we hardcode the script to only support charCodeAt
      
              * jit/JITStubCall.h:
              * jit/JITStubs.cpp:
              (JSC::JITThunks::~JITThunks):
              (JSC::JITThunks::specializedThunk):
              * jit/JITStubs.h:
              * jit/SpecializedThunkJIT.h: Added.
              (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
              (JSC::SpecializedThunkJIT::loadCellArgument):
              (JSC::SpecializedThunkJIT::loadJSStringArgument):
              (JSC::SpecializedThunkJIT::loadInt32Argument):
              (JSC::SpecializedThunkJIT::appendFailure):
              (JSC::SpecializedThunkJIT::returnInt32):
              (JSC::SpecializedThunkJIT::finalize):
              (JSC::SpecializedThunkJIT::argumentToVirtualRegister):
              (JSC::SpecializedThunkJIT::tagReturnAsInt32):
              * jit/ThunkGenerators.cpp: Added.
              (JSC::ThunkHelpers::stringImplDataOffset):
              (JSC::ThunkHelpers::jsStringLengthOffset):
              (JSC::ThunkHelpers::jsStringValueOffset):
              (JSC::charCodeAtThunkGenerator):
              * jit/ThunkGenerators.h: Added.
              * runtime/Executable.h:
              (JSC::NativeExecutable::NativeExecutable):
              * runtime/JSFunction.cpp:
              (JSC::JSFunction::JSFunction):
              * runtime/JSFunction.h:
              * runtime/JSGlobalData.h:
              (JSC::JSGlobalData::getThunk):
              * runtime/JSString.h:
              (JSC::):
              * runtime/JSValue.h:
                Protect some of the JSVALUE32 and JSVALUE32_64 only constants
                and function behind appropriate USE() guards to make it harder
                to use the wrong flags for the target build.
              * runtime/Lookup.cpp:
              (JSC::HashTable::createTable):
              (JSC::setUpStaticFunctionSlot):
              * runtime/Lookup.h:
              (JSC::HashEntry::initialize):
              (JSC::HashEntry::generator):
              (JSC::HashEntry::):
                Make the lookup tables use a specialized thunkGenerator
                if present
              * wtf/text/StringImpl.h:
      2010-04-26  Oliver Hunt  <oliver@apple.com>
      
              Reviewed by Gavin Barraclough.
      
              Need to support more efficient dispatch of lightweight builtins
              https://bugs.webkit.org/show_bug.cgi?id=38155
      
              Update bindings generation to include new thunk generator field
              in the property map hash tables.
      
              * bindings/scripts/CodeGeneratorJS.pm:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8e293b78
  8. 22 Apr, 2010 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=37978 · b474682b
      barraclough@apple.com authored
      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).
      
      * GNUmakefile.am:
      * JavaScriptCore.gypi:
      * JavaScriptCore.vcproj/WTF/WTF.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/Identifier.cpp:
      (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):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b474682b
  9. 21 Apr, 2010 2 commits
    • barraclough@apple.com's avatar
      Rubber Stamped by Oliver Hunt. · 624e0ffd
      barraclough@apple.com authored
      Make SmallStrings store an array of RefPtr<StringImpl>,
      instead of a direct array of StringImpls.  This allows
      us to remove a friend (and a layering violation) from
      WTF::StringImpl, and makes it so that all StringImpls
      are individually heap allocated.
      
      * runtime/SmallStrings.cpp:
      (JSC::SmallStringsStorage::rep):
      (JSC::SmallStringsStorage::SmallStringsStorage):
      * wtf/text/StringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58026 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      624e0ffd
    • barraclough@apple.com's avatar
      JavaScriptCore: Bug 37906 - Remove JSC::UStringImpl; unify with StringImpl. · 185ce916
      barraclough@apple.com authored
      Reviewed by Oliver Hunt, Darin Adler.
      
      JSC::UStringImpl and WebCore::StringImpl (soon to be renamed to
      WTF::StringImpl) are almost identical.  Remove duplication of code by unifying
      the two, move missing features from UStringImpl into StringImpl & delete the
      class UStringImpl.
      
      * API/JSClassRef.cpp:
      * API/JSContextRef.cpp:
      * GNUmakefile.am:
      * JavaScriptCore.exp:
      * JavaScriptCore.pro:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * bytecode/EvalCodeCache.h:
      * bytecode/JumpTable.cpp:
      * profiler/ProfileNode.cpp:
      * runtime/Identifier.cpp:
      (JSC::Identifier::add):
      * runtime/Identifier.h:
      (JSC::Identifier::equal):
      * runtime/UString.cpp:
      * runtime/UString.h:
      (WTF::):
      * runtime/UStringImpl.cpp: Removed.
      * runtime/UStringImpl.h:
      * wtf/text/StringHash.h:
      (WebCore::StringHash::equal):
      (WebCore::CaseFoldingHash::equal):
      * wtf/text/StringImpl.cpp:
      (WebCore::StringImpl::~StringImpl):
      (WebCore::StringImpl::empty):
      (WebCore::StringImpl::sharedBuffer):
      (WebCore::equal):
      * wtf/text/StringImpl.h:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::create):
      (WebCore::StringImpl::tryCreateUninitialized):
      (WebCore::StringImpl::cost):
      (WebCore::StringImpl::isIdentifier):
      (WebCore::StringImpl::setIsIdentifier):
      (WebCore::StringImpl::computeHash):
      (WebCore::StringImpl::copyChars):
      (WebCore::StringImpl::):
      
      JavaScriptGlue: Bug 37906 - Remove JSC::UStringImpl; unify with StringImpl.
      Add forwarding header.
      
      Reviewed by Oliver Hunt, Darin Adler.
      
      * ForwardingHeaders/wtf/ASCIICType.h: Added.
      * ForwardingHeaders/wtf/text/StringImpl.h: Added.
      
      WebCore: Bug 37906 - Remove JSC::UStringImpl; unify with StringImpl.
      Add include for StringHash.h.
      
      Reviewed by Oliver Hunt, Darin Adler.
      
      * WebCore.xcodeproj/project.pbxproj:
      * bridge/c/c_class.cpp:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      185ce916
  10. 20 Apr, 2010 2 commits
    • barraclough@apple.com's avatar
      JavaScriptCore: Bug 37895 - Share common code from UStringImplBase with StringImpl · dc8422be
      barraclough@apple.com authored
      Reviewed by Oliver Hunt.
      
      The implementation of StringImpl & UStringImpl is very similar.  Restructure
      StringImpl to match UStringImpl, moving the flags and length into a base class,
      so that this can be shared between both string types to increase code reuse.
      
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/RopeImpl.h:
      (JSC::RopeImpl::RopeImpl):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::UStringImpl):
      * wtf/text/StringImpl.h:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::characters):
      * wtf/text/StringImplBase.h: Copied from JavaScriptCore/runtime/UStringImpl.h.
      (WTF::StringImplBase::length):
      (WTF::StringImplBase::operator new):
      (WTF::StringImplBase::StringImplBase):
      
      JavaScriptGlue: Bug 37895 - Share common code from UStringImplBase with StringImpl
      Add forwarding header.
      
      Reviewed by Oliver Hunt.
      
      * ForwardingHeaders/wtf/text/StringImplBase.h: Added.
      
      WebCore: Bug 37895 - Share common code from UStringImplBase with StringImpl
      Add forwarding header.
      
      Reviewed by Oliver Hunt.
      
      * ForwardingHeaders/wtf/text/StringImplBase.h: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      dc8422be
    • barraclough@apple.com's avatar
      Bug 37828 - Move WebCore's String classes to WTF · 87f3b744
      barraclough@apple.com authored
      Reviewed by Geoff Garen.
      
      Move these classes up to WTF so they are available to all clients of WTF (in
      particular JSC).
      
      As a first patch, making the most minimal change possible, since this patch
      could easily grow rather large since we'll have to change every class forward
      declaration ( e.g. every "namespace WebCore { class String; }" much change to
      "namespace WTF { class String; }").
      
      JavaScriptCore: 
      
      Moving the files, but leaving the classes logically in the WebCore namespace -
      which is technically a layering violation - I'll come back and fix this up in a
      subsequent patch.
      
      * Android.mk:
      * Android.v8.wtf.mk:
      * GNUmakefile.am:
      * JavaScriptCore.exp:
      * JavaScriptCore.gypi:
      * JavaScriptCore.pro:
      * JavaScriptCore.vcproj/WTF/WTF.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * config.h:
      * wtf/StaticConstructors.h: Copied from WebCore/platform/StaticConstructors.h.
      * wtf/text/AtomicString.cpp: Copied from WebCore/platform/text/AtomicString.cpp.
      * wtf/text/AtomicString.h: Copied from WebCore/platform/text/AtomicString.h.
      * wtf/text/AtomicStringImpl.h: Copied from WebCore/platform/text/AtomicStringImpl.h.
      * wtf/text/StringBuffer.h: Copied from WebCore/platform/text/StringBuffer.h.
      * wtf/text/StringHash.h: Copied from WebCore/platform/text/StringHash.h.
      * wtf/text/StringImpl.cpp: Copied from WebCore/platform/text/StringImpl.cpp.
      * wtf/text/StringImpl.h: Copied from WebCore/platform/text/StringImpl.h.
      * wtf/text/WTFString.cpp: Copied from WebCore/platform/text/String.cpp.
      (WebCore::charactersToFloat):
      * wtf/text/WTFString.h: Copied from WebCore/platform/text/PlatformString.h.
      
      WebCore: 
      
      Moving the files, but leaving the classes logically in the WebCore namespace –
      which is technically a layering violation – I'll come back and fix this up in a
      subsequent patch.
      
      * Android.mk:
      * ForwardingHeaders/wtf/StaticConstructors.h: Added.
      * ForwardingHeaders/wtf/text/AtomicString.h: Added.
      * ForwardingHeaders/wtf/text/AtomicStringImpl.h: Added.
      * ForwardingHeaders/wtf/text/StringBuffer.h: Added.
      * ForwardingHeaders/wtf/text/StringHash.h: Added.
      * ForwardingHeaders/wtf/text/StringImpl.h: Added.
      * ForwardingHeaders/wtf/text/WTFString.h: Added.
      * GNUmakefile.am:
      * WebCore.gypi:
      * WebCore.pro:
      * WebCore.vcproj/WebCore.vcproj:
      * WebCore.xcodeproj/project.pbxproj:
      * css/MediaFeatureNames.cpp:
      * dom/QualifiedName.cpp:
      * dom/make_names.pl:
      * platform/StaticConstructors.h: Removed.
      * platform/text/AtomicString.cpp: Removed.
      * platform/text/AtomicString.h:
      * platform/text/AtomicStringImpl.h:
      * platform/text/PlatformString.h:
      * platform/text/String.cpp:
      * platform/text/StringHash.h:
      * platform/text/StringImpl.cpp: Removed.
      * platform/text/StringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      87f3b744
  11. 16 Apr, 2010 1 commit
    • barraclough@apple.com's avatar
      Bug 37730 - Remove JSC::UString dependencies from WebCore::StringImpl · 492f1f85
      barraclough@apple.com authored
      (Following on from bug #37675).
      
      Reviewed by Oliver Hunt.
      
      JavaScriptCore: 
      
      Make the argument ordering for UStringImpl's constructor & create
      methods match, when passed a shared buffer.
      
      * JavaScriptCore.exp:
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::create):
      * runtime/UStringImpl.h:
      
      WebCore: 
      
      Remove ustring() method, and constructor passed a UString.
      
      * WebCore.base.exp:
      * bindings/js/JSDOMBinding.cpp:
      (WebCore::stringimplToUString):
      (WebCore::jsStringSlowCase):
      (WebCore::ustringToString):
      (WebCore::stringToUString):
      (WebCore::identifierToString):
      * bindings/js/JSDOMBinding.h:
      (WebCore::jsString):
      * platform/text/AtomicString.cpp:
      (WebCore::AtomicString::operator UString):
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::create):
      * platform/text/StringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      492f1f85
  12. 31 Mar, 2010 1 commit
    • barraclough@apple.com's avatar
      Remove dependency on TextBreakIterator from StringImpl.cpp, · c72059ea
      barraclough@apple.com authored
      and from member methods of String.
      
      Reviewed by Oliver Hunt.
      
      Make 'numGraphemeClusters' & 'numCharactersInGraphemeClusters'
      global function defined in PlatformString.h, rather than
      member methods on String (these can be implemented purely
      using the characters() and length() public interface),
      and make 'makeCapitalized' a static function in RenderText.cpp.
      
      * dom/InputElement.cpp:
      (WebCore::InputElement::sanitizeUserInputValue):
      (WebCore::InputElement::handleBeforeTextInsertedEvent):
      * html/HTMLInputElement.cpp:
      (WebCore::HTMLInputElement::tooLong):
      * html/HTMLTextAreaElement.cpp:
      (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent):
      (WebCore::HTMLTextAreaElement::sanitizeUserInputValue):
      (WebCore::HTMLTextAreaElement::tooLong):
      * platform/text/PlatformString.h:
      (WebCore::String::makeSecure):
      * platform/text/String.cpp:
      (WebCore::numGraphemeClusters):
      (WebCore::numCharactersInGraphemeClusters):
      * platform/text/StringImpl.cpp:
      * platform/text/StringImpl.h:
      * rendering/RenderText.cpp:
      (WebCore::makeCapitalized):
      (WebCore::RenderText::setTextInternal):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c72059ea
  13. 12 Mar, 2010 1 commit
    • barraclough@apple.com's avatar
      Bug 36075 - Clean up screwyness re static string impls & Identifiers. · c24293a1
      barraclough@apple.com authored
      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.
      * JavaScriptCore.exp:
      * runtime/Identifier.cpp:
      (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.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c24293a1
  14. 11 Mar, 2010 2 commits
    • barraclough@apple.com's avatar
      Rubber stamped by Oliver Hunt. · ce9f1049
      barraclough@apple.com authored
      Remove nonsense comments used in development & commited in error.
      
      JavaScriptCore: 
      
      * runtime/UStringImpl.h:
      
      WebCore: 
      
      * platform/text/StringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ce9f1049
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=36041 · 6671f13a
      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
  15. 10 Mar, 2010 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=35991 · 77b7fcaf
      barraclough@apple.com authored
      Would be faster to not use a thread specific to implement StringImpl::empty()
      
      Reviewed by Darin Adler, Geoffrey Garen, Maciej Stachowiak.
      
      JavaScriptCore: 
      
      Change JSC::UStringImpl's implementation of empty() match to match StringImpl's new implementation
      (use a static defined within the empty() method), and change the interface to match too (return
      a pointer not a reference). 
      
      ~0% performance impact (possible minor progression from moving empty() from .h to .cpp).
      
      * JavaScriptCore.exp:
      * runtime/Identifier.cpp:
      (JSC::Identifier::add):
      (JSC::Identifier::addSlowCase):
      * runtime/PropertyNameArray.cpp:
      (JSC::PropertyNameArray::add):
      * runtime/UString.cpp:
      (JSC::initializeUString):
      (JSC::UString::UString):
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::empty):
      (JSC::UStringImpl::create):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::adopt):
      (JSC::UStringImpl::createUninitialized):
      (JSC::UStringImpl::tryCreateUninitialized):
      
      WebCore: 
      
      Copy JavaScriptCore in making 'static' strings threadsafe, make the empty string a static,
      shared by all threads.
      
      ~2% progression on Dromaeo DOM core & JS lib tests.
      
      * platform/ThreadGlobalData.cpp:
      (WebCore::ThreadGlobalData::ThreadGlobalData):
      (WebCore::ThreadGlobalData::~ThreadGlobalData):
      * platform/ThreadGlobalData.h:
      (WebCore::ThreadGlobalData::eventNames):
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::empty):
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::deref):
      (WebCore::StringImpl::hasOneRef):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55825 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      77b7fcaf
  16. 21 Feb, 2010 1 commit
    • barraclough@apple.com's avatar
      JavaScriptCore: Make UString::m_data be const, and make the UChar... · c5fed09f
      barraclough@apple.com authored
      JavaScriptCore: Make UString::m_data be const, and make the UChar owned/ref-counted by CrossThreadRefCounted be const too.
      
      Reviewed by Oliver Hunt.
      
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::baseSharedBuffer):
      (JSC::UStringImpl::~UStringImpl):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::create):
      (JSC::UStringImpl::data):
      (JSC::UStringImpl::UStringImpl):
      * wtf/OwnFastMallocPtr.h:
      (WTF::OwnFastMallocPtr::~OwnFastMallocPtr):
      
      WebCore: Make the UChar owned/ref-counted by StringImpl::CrossThreadRefCounted be const.
      
      Reviewed by Oliver Hunt.
      
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::sharedBuffer):
      * platform/text/StringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c5fed09f
  17. 12 Feb, 2010 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=33731 · 5fd99b7a
      barraclough@apple.com authored
      Remove uses of PtrAndFlags from WebCore::StringImpl.
      
      Reviewed by Sam Weinig.
      
      These break the OS X Leaks tool.  Use a bits stolen from the refCount to hold the
      'InTable' and 'HasTerminatingNullCharacter' flags, along with the string type
      (fixes a leak where the string data is allocated at the address (this + 1), and is
      misinterpreted as being an internal buffer).
      
      * WebCore.base.exp:
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::~StringImpl):
      (WebCore::StringImpl::create):
      (WebCore::StringImpl::createWithTerminatingNullCharacter):
      (WebCore::StringImpl::crossThreadString):
      (WebCore::StringImpl::sharedBuffer):
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::):
      (WebCore::StringImpl::hasTerminatingNullCharacter):
      (WebCore::StringImpl::inTable):
      (WebCore::StringImpl::setInTable):
      (WebCore::StringImpl::ref):
      (WebCore::StringImpl::deref):
      (WebCore::StringImpl::hasOneRef):
      (WebCore::StringImpl::operator new):
      (WebCore::StringImpl::bufferOwnership):
      * storage/OriginUsageRecord.cpp:
      (WebCore::OriginUsageRecord::addDatabase):
      (WebCore::OriginUsageRecord::markDatabase):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54736 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5fd99b7a
  18. 05 Feb, 2010 1 commit
    • ggaren@apple.com's avatar
      Added an ASSERT to catch an implausible but theoretically possible leak. · dbb1d9f0
      ggaren@apple.com authored
              
      Reviewed by Dan Bernstein.
      
      In theory, if malloc allocated a UChar buffer directly after a StringImpl,
      the StringImpl might incorrecly assume that the UChar buffer was inline,
      and fail to delete it.
              
      This ASSERT is somewhat academic, since we don't use the same allocator
      in debug builds, but oh well.
      
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::createUninitialized):
      * platform/text/StringImpl.h: Separated the inline buffer StringImpl
      constructor from the out-of-line buffer StringImpl constructor. Made
      the former ASSERT that its buffer was indeed inline, and the latter ASSERT
      that its buffer was indeed not inline.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      dbb1d9f0
  19. 20 Jan, 2010 1 commit
    • barraclough@apple.com's avatar
      <rdar://problem/7557695> REGRESSION(r53445-r53449): Many new memory leaks (33867) · ad095b4d
      barraclough@apple.com authored
      Reviewed by NOBODY.
      
      Revert r53447, since this caused leaks.
      
      * WebCore.base.exp:
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::operator new):
      (WebCore::StringImpl::operator delete):
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::~StringImpl):
      (WebCore::StringImpl::create):
      (WebCore::StringImpl::createWithTerminatingNullCharacter):
      (WebCore::StringImpl::crossThreadString):
      (WebCore::StringImpl::sharedBuffer):
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::hasTerminatingNullCharacter):
      (WebCore::StringImpl::inTable):
      (WebCore::StringImpl::setInTable):
      (WebCore::StringImpl::):
      * storage/OriginUsageRecord.cpp:
      (WebCore::OriginUsageRecord::addDatabase):
      (WebCore::OriginUsageRecord::markDatabase):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ad095b4d
  20. 18 Jan, 2010 3 commits
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=33731 · 0c9e8da7
      barraclough@apple.com authored
      Remove uses of PtrAndFlags from WebCore::StringImpl.
      
      Reviewed by Darin Adler & Oliver Hunt.
      
      These break the OS X Leaks tool.  Move the management of null-terminated copies
      out from StringImpl to String, and use a bit stolen from the refCount to hold the
      'InTable' flag.
      
      * platform/sql/SQLiteFileSystem.cpp:
      (WebCore::SQLiteFileSystem::openDatabase):
      * platform/sql/SQLiteStatement.cpp:
      (WebCore::SQLiteStatement::prepare):
      * platform/sql/SQLiteStatement.h:
      * platform/text/PlatformString.h:
      * platform/text/String.cpp:
      (WebCore::String::copyWithNullTermination):
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::~StringImpl):
      (WebCore::StringImpl::create):
      (WebCore::StringImpl::crossThreadString):
      (WebCore::StringImpl::sharedBuffer):
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::inTable):
      (WebCore::StringImpl::setInTable):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53447 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0c9e8da7
    • barraclough@apple.com's avatar
      Eeeep! reverting r53416 & r53417, more to be done to fix windows. · 162c8651
      barraclough@apple.com authored
      Reviewed by NOBODY (build fix).
      
      * WebCore.base.exp:
      * platform/sql/SQLiteFileSystem.cpp:
      (WebCore::SQLiteFileSystem::openDatabase):
      * platform/sql/SQLiteStatement.cpp:
      (WebCore::SQLiteStatement::prepare):
      * platform/sql/SQLiteStatement.h:
      * platform/sql/chromium/SQLiteFileSystemChromium.cpp:
      (WebCore::SQLiteFileSystem::openDatabase):
      * platform/text/PlatformString.h:
      * platform/text/String.cpp:
      (WebCore::String::charactersWithNullTermination):
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::operator new):
      (WebCore::StringImpl::operator delete):
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::~StringImpl):
      (WebCore::StringImpl::create):
      (WebCore::StringImpl::createWithTerminatingNullCharacter):
      (WebCore::StringImpl::crossThreadString):
      (WebCore::StringImpl::sharedBuffer):
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::hasTerminatingNullCharacter):
      (WebCore::StringImpl::inTable):
      (WebCore::StringImpl::setInTable):
      (WebCore::StringImpl::):
      * platform/win/ClipboardUtilitiesWin.cpp:
      (WebCore::createGlobalData):
      * storage/OriginUsageRecord.cpp:
      (WebCore::OriginUsageRecord::addDatabase):
      (WebCore::OriginUsageRecord::markDatabase):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      162c8651
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=33731 · 735ee66c
      barraclough@apple.com authored
      Remove uses of PtrAndFlags from WebCore::StringImpl.
      
      Reviewed by Darin Adler.
      
      These break the OS X Leaks tool.  Move the management of null-terminated copies
      out from StringImpl to String, and use a bit stolen from the refCount to hold the
      'InTable' flag.
      
      * platform/sql/SQLiteFileSystem.cpp:
      (WebCore::SQLiteFileSystem::openDatabase):
      * platform/sql/SQLiteStatement.cpp:
      (WebCore::SQLiteStatement::prepare):
      * platform/sql/SQLiteStatement.h:
      * platform/text/PlatformString.h:
      * platform/text/String.cpp:
      (WebCore::String::copyWithNullTermination):
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::StringImpl):
      (WebCore::StringImpl::~StringImpl):
      (WebCore::StringImpl::create):
      (WebCore::StringImpl::crossThreadString):
      (WebCore::StringImpl::sharedBuffer):
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::inTable):
      (WebCore::StringImpl::setInTable):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      735ee66c
  21. 04 Jan, 2010 3 commits
  22. 18 Dec, 2009 2 commits
    • aroben@apple.com's avatar
      GTK (and others?) build fix · b5390434
      aroben@apple.com authored
      * platform/text/StringImpl.h: Added #include.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b5390434
    • aroben@apple.com's avatar
      Reduce #includes in a few high-use headers · a7c639a8
      aroben@apple.com authored
      Removed unnecessary #includes in these headers:
        - Frame.h
        - FrameWin.h
        - Node.h
        - Page.h
        - StringImpl.h
      
      The rest of the patch is all adding #includes to source files that now
      require them.
      
      Fixes <http://webkit.org/b/32718>.
      
      Rubber-stamped by Anders Carlsson.
      
      WebCore:
      
      * dom/Node.h:
      * page/Frame.h:
      * page/Page.h:
      * page/win/FrameWin.h:
      * platform/text/StringImpl.h:
      Removed unnecessary #includes.
      
      * accessibility/win/AXObjectCacheWin.cpp:
      * bindings/js/JSDOMWindowBase.cpp:
      * bindings/js/JSDOMWindowCustom.cpp:
      * dom/Document.cpp:
      * dom/InputElement.cpp:
      * dom/Node.cpp:
      * dom/SelectElement.cpp:
      * editing/EditorCommand.cpp:
      * html/HTMLFormControlElement.cpp:
      * html/HTMLFormElement.cpp:
      * html/HTMLMediaElement.cpp:
      * html/HTMLParser.cpp:
      * html/HTMLTextAreaElement.cpp:
      * html/HTMLVideoElement.cpp:
      * inspector/InspectorController.cpp:
      * loader/FrameLoader.cpp:
      * loader/HistoryController.cpp:
      * loader/appcache/ApplicationCacheGroup.cpp:
      * page/Console.cpp:
      * page/EventHandler.cpp:
      * page/Frame.cpp:
      * page/FrameView.cpp:
      * page/Navigator.cpp:
      * page/PageGroup.cpp:
      * page/Settings.cpp:
      * page/mac/EventHandlerMac.mm:
      * platform/KURL.h:
      * platform/ScrollbarThemeComposite.cpp:
      * platform/cf/BinaryPropertyList.cpp:
      * platform/graphics/mac/GraphicsLayerCA.h:
      * platform/graphics/win/WKCACFLayerRenderer.cpp:
      * platform/mac/PopupMenuMac.mm:
      * platform/mac/WidgetMac.mm:
      * platform/network/cf/DNSCFNet.cpp:
      * platform/text/StringImpl.cpp:
      * platform/win/FileSystemWin.cpp:
      * platform/win/PlatformScreenWin.cpp:
      * platform/win/PopupMenuWin.cpp:
      * platform/win/WidgetWin.cpp:
      * plugins/PluginView.cpp:
      * plugins/win/PluginViewWin.cpp:
      * rendering/InlineTextBox.cpp:
      * rendering/RenderBox.cpp:
      * rendering/RenderFileUploadControl.cpp:
      * rendering/RenderInline.cpp:
      * rendering/RenderLayerCompositor.cpp:
      * rendering/RenderObject.cpp:
      * rendering/RootInlineBox.cpp:
      * storage/DatabaseTracker.cpp:
      * storage/DatabaseTracker.h:
      * storage/SQLTransactionClient.cpp:
      * svg/graphics/SVGImage.cpp:
      Added now-needed #includes.
      
      WebKit/mac:
      
      Add #includes needed after WebCore clean-up
      
      * WebView/WebFrame.mm:
      * WebView/WebFrameView.mm:
      * WebView/WebView.mm:
      
      WebKit/win:
      
      Add #includes needed after WebCore clean-up
      
      * WebCoreSupport/WebContextMenuClient.cpp:
      * WebDataSource.cpp:
      * WebHTMLRepresentation.cpp:
      * WebView.cpp:
      * WebView.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a7c639a8
  23. 02 Nov, 2009 1 commit
    • eric@webkit.org's avatar
      2009-11-02 Laszlo Gombos <laszlo.1.gombos@nokia.com> · 70ef0c0a
      eric@webkit.org authored
              Reviewed by Darin Adler.
      
              PLATFORM(CF) should be set when building for Qt on Darwin
              https://bugs.webkit.org/show_bug.cgi?id=23671
      
              * wtf/Platform.h: Turn on CF support if both QT and DARWIN
              platforms are defined.
      2009-11-02  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
      
              Reviewed by Darin Adler.
      
              PLATFORM(CF) should be set when building for Qt on Darwin
              https://bugs.webkit.org/show_bug.cgi?id=23671
      
              * WebCore.pro: Add SharedBufferCF.cpp and SmartReplaceCF.cpp
              to the Darwin build.
              * loader/archive/ArchiveFactory.cpp: Change the support for
              legacy WebArchive from all CF platforms to Mac and Chromium
              CF platforms.
              (WebCore::archiveMIMETypes):
              * platform/text/AtomicString.h: Remove PLATFORM(QT) &&
              PLATFORM(DARWIN) test as it is redundant now.
              * platform/text/PlatformString.h: Ditto.
              * platform/text/StringImpl.h: Ditto.
              * platform/text/cf/StringCF.cpp: Ditto.
              * platform/text/cf/StringImplCF.cpp: Ditto.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      70ef0c0a
  24. 19 Oct, 2009 1 commit
    • eric@webkit.org's avatar
      2009-10-19 Jens Alfke <jens@mooseyard.com> · 1a630865
      eric@webkit.org authored
              Reviewed by Darin Adler.
      
              Optimize string upper/lowercasing
              https://bugs.webkit.org/show_bug.cgi?id=30261
      
              - Added AtomicString::upper() and lower()
              - Further optimized StringImpl::lower()
              - Removed StringImpl::isLower()
              - Added QualifiedName::localNameUpper(), which is cached, thereby saving
                thousands of upper() calls and string allocations.
      
               * dom/Element.cpp:
               (WebCore::Element::setAttribute): Call AtomicString::lower()
               * dom/QualifiedName.cpp:
               (WebCore::QualifiedName::localNameUpper): New method
               * dom/QualifiedName.h: Added localNameUpper() method
               * dom/StyledElement.cpp:
               (WebCore::StyledElement::parseMappedAttribute):  Call AtomicString::lower()
               * html/HTMLDocument.cpp:
               (WebCore::HTMLDocument::createElement): Call AtomicString::lower()
               * html/HTMLElement.cpp:
               (WebCore::HTMLElement::nodeName): Call localNameUpper()
               * platform/text/AtomicString.cpp:
               (WebCore::AtomicString::lower): New method
               (WebCore::AtomicString::upper): New method
               * platform/text/AtomicString.h: Added lower() and upper()
               * platform/text/StringImpl.cpp: Removed isLower()
               (WebCore::StringImpl::lower): Further optimization of initial loop
               * platform/text/StringImpl.h: Removed isLower()
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49798 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1a630865
  25. 08 Oct, 2009 1 commit
    • levin@chromium.org's avatar
      Make AtomicString create its StringImpl via create(), not the constructor, · 5d05a558
      levin@chromium.org authored
      so it gets allocated in a single heap block, saving memory and CPU cycles.
      This eliminates two StringImpl constructors, making the remaining ones
      unambiguous, so the "AdoptBuffer" parameter is no longer needed.
      Added const attribute to UChar* in StringImpl constructor, eliminating the
      need for several const_casts in calls to it.
      StringImpl also unfriends AtomicString (OMG drama!!!)
      https://bugs.webkit.org/show_bug.cgi?id=30141
      
      Patch by Jens Alfke <snej@chromium.org> on 2009-10-08
      Reviewed by Darin Adler.
      
      * platform/text/AtomicString.cpp:
      (WebCore::CStringTranslator::translate): Call StringImpl::create().
      (WebCore::UCharBufferTranslator::translate): Ditto.
      (WebCore::HashAndCharactersTranslator::translate): Ditto.
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::StringImpl): Remove unnecessary AdoptBuffer param.
      (WebCore::StringImpl::adopt): Ditto.
      (WebCore::StringImpl::createUninitialized): Ditto.
      (WebCore::StringImpl::create): Ditto.
      (WebCore::StringImpl::crossThreadString): Ditto.
      * platform/text/StringImpl.h:
      (WebCore::StringImpl::setHash): Used by AtomicString when creating StringImpls.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5d05a558
  26. 07 Oct, 2009 3 commits
    • jorlow@chromium.org's avatar
      2009-10-07 Jens Alfke <snej@chromium.org> · 0f79b586
      jorlow@chromium.org authored
              Reviewed by Dave Levin.
      
              Fix StringImpl::m_buffer
              https://bugs.webkit.org/show_bug.cgi?id=30189
      
              Fix my previous StringImpl patch to avoid using an indefinite-length array member,
              since MSVC doesn't like it. Instead, go back to offsetting by sizeof(StringImpl).
      
              * platform/text/StringImpl.cpp:
              (WebCore::StringImpl::StringImpl):
              (WebCore::StringImpl::createUninitialized):
              * platform/text/StringImpl.h:
              (WebCore::StringImpl::bufferIsInternal):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49279 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0f79b586
    • jorlow@chromium.org's avatar
      Build fix for http://trac.webkit.org/changeset/49272 on Windows · 64980ae7
      jorlow@chromium.org authored
      Patch by Jeremy Orlow <jorlow@chromium.org> on 2009-10-07
      * platform/text/StringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      64980ae7
    • eric@webkit.org's avatar
      2009-10-07 Jens Alfke <snej@chromium.org> · 06f4370a
      eric@webkit.org authored
              Reviewed by Darin Adler.
      
              Optimization of StringImpl:
              - Remove unnecessary m_bufferIsInternal member (saves 4 bytes). Instead, check whether
                m_data points to just past the end of the object's members.
              - copy() and createWithTerminatingNullCharacter() create the string in a single malloc
                block instead of 2 (saves ~20 bytes and considerable CPU cycles, increases locality).
              - Move m_length next to m_hash to save 4 bytes of padding in 64-bit builds.
      
              https://bugs.webkit.org/show_bug.cgi?id=29500
      
              * platform/text/StringImpl.cpp:
              (WebCore::StringImpl::StringImpl): Re-ordered members.
              (WebCore::StringImpl::~StringImpl): Change to is-buffer-internal check.
              (WebCore::StringImpl::createUninitialized): Use new m_buffer member instead of sizeof()
                  to ensure chars are copied to correct location.
              (WebCore::StringImpl::createWithTerminatingNullCharacter): Make sure copy is created
                  in a single malloc block.
              (WebCore::StringImpl::threadsafeCopy): Make sure copy is created in a single malloc block.
              (WebCore::StringImpl::crossThreadString): Make sure copy is created in a single malloc block.
              (WebCore::StringImpl::sharedBuffer): Change to is-buffer-internal check.
              * platform/text/StringImpl.h:
              (WebCore::StringImpl::startsWith): Just fixed a confusing param name.
              (WebCore::StringImpl::bufferIsInternal): Changed member var into accessor method.
              (WebCore::StringImpl::m_data): Repositioned for optimal member packing in 64-bit.
              (WebCore::StringImpl::m_buffer): Added to provide an explicit location for where internal buffer goes.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      06f4370a
  27. 06 Oct, 2009 1 commit
    • levin@chromium.org's avatar
      StringImpl needs a method to get an instance for another thread which doesn't... · bcb91543
      levin@chromium.org authored
      StringImpl needs a method to get an instance for another thread which doesn't copy the underlying buffer.
      https://bugs.webkit.org/show_bug.cgi?id=30095
      
      Patch by David Levin <levin@chromium.org> on 2009-10-06
      Reviewed by Oliver Hunt.
      
      JavaScriptCore:
      
      * wtf/CrossThreadRefCounted.h:
      Removed an unused function and assert improvement.
      (WTF::CrossThreadRefCounted::isOwnedByCurrentThread): Moved out common code from asserts.
      (WTF::CrossThreadRefCounted::ref): Changed assert to use the common method.
      (WTF::CrossThreadRefCounted::deref): Changed assert to use the common method.
      (WTF::CrossThreadRefCounted::crossThreadCopy): Since this includes a potentially
      non-threadsafe operation, add an assert that the class is owned by the current thread.
      
      WebCore:
      
      All String::copy methods were changed to call either threadsafeCopy or crossThreadString. The method
      call was made threadsafeCopy unless I could show that threadsafety wasn't needed.
      
      No visible change in functionality so no new tests.
      
      * dom/MessagePortChannel.cpp:
      (WebCore::MessagePortChannel::EventData::EventData):
      * loader/WorkerThreadableLoader.cpp:
      (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
      * loader/icon/IconDatabase.cpp:
      (WebCore::IconDatabase::open):
      (WebCore::IconDatabase::iconForPageURL):
      (WebCore::IconDatabase::iconURLForPageURL):
      (WebCore::IconDatabase::retainIconForPageURL):
      (WebCore::IconDatabase::releaseIconForPageURL):
      (WebCore::IconDatabase::setIconDataForIconURL):
      (WebCore::IconDatabase::setIconURLForPageURL):
      (WebCore::IconDatabase::databasePath):
      (WebCore::IconDatabase::defaultDatabaseFilename):
      * page/SecurityOrigin.cpp:
      (WebCore::SecurityOrigin::SecurityOrigin): Since this is used by SecurityOrigin::threadsafeCopy,
      it makes threadsafe calls.
      (WebCore::SecurityOrigin::threadsafeCopy): The only place that called this
      needed a threadsafe method.
      * page/SecurityOrigin.h:
      * platform/CrossThreadCopier.cpp:
      (WebCore::::copy):
      * platform/KURL.cpp:
      (WebCore::KURL::copy):
      * platform/network/HTTPHeaderMap.cpp:
      (WebCore::HTTPHeaderMap::copyData):
      * platform/network/ResourceErrorBase.cpp:
      (WebCore::ResourceErrorBase::copy):
      * platform/network/ResourceRequestBase.cpp:
      (WebCore::ResourceRequestBase::copyData):
      * platform/network/ResourceResponseBase.cpp:
      (WebCore::ResourceResponseBase::copyData):
      * platform/sql/SQLValue.cpp:
      (WebCore::SQLValue::SQLValue):
      (WebCore::SQLValue::string):
      * platform/sql/SQLValue.h:
      (WebCore::SQLValue::SQLValue):
      All constructors now initialize the m_number which is a double. Failure to
      do so can result in unexpected crashes when it is copied in the copy constructor.
      See http://blogs.msdn.com/oldnewthing/archive/2008/07/02/8679191.aspx, I was that colleague.
      * platform/text/PlatformString.h:
      * platform/text/String.cpp:
      (WebCore::String::threadsafeCopy):
      (WebCore::String::crossThreadString):
      * platform/text/StringImpl.cpp:
      Removed StringImpl::substringCopy which was no longer being used anywhere.
      (WebCore::StringImpl::threadsafeCopy): Changed the name to indicate that
      it is threadsafe.
      (WebCore::StringImpl::crossThreadString): The way to get strings for
      another thread which is not threadsafe. This shares the underlying buffer
      with both strings and gives them a way to do threadsafe refcounting for it.
      * platform/text/StringImpl.h:
      * storage/ChangeVersionWrapper.cpp:
      (WebCore::ChangeVersionWrapper::ChangeVersionWrapper):
      * storage/Database.cpp:
      (WebCore::updateGuidVersionMap):
      (WebCore::Database::Database):
      (WebCore::Database::getVersionFromDatabase):
      (WebCore::Database::setVersionInDatabase):
      (WebCore::Database::version):
      (WebCore::Database::setExpectedVersion):
      (WebCore::Database::securityOriginCopy):
      (WebCore::Database::stringIdentifier):
      * storage/DatabaseTracker.cpp:
      (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
      * storage/OriginQuotaManager.cpp:
      (WebCore::OriginQuotaManager::addDatabase):
      * storage/SQLError.h:
      (WebCore::SQLError::message):
      (WebCore::SQLError::SQLError):
      * storage/SQLStatement.cpp:
      (WebCore::SQLStatement::SQLStatement):
      * storage/StorageAreaSync.cpp:
      (WebCore::StorageAreaSync::syncTimerFired):
      * storage/StorageMap.cpp:
      (WebCore::StorageMap::importItem):
      * storage/StorageNamespaceImpl.cpp:
      (WebCore::StorageNamespaceImpl::StorageNamespaceImpl):
      * storage/StorageSyncManager.cpp:
      (WebCore::StorageSyncManager::StorageSyncManager):
      * workers/DefaultSharedWorkerRepository.cpp:
      (WebCore::SharedWorkerProxy::url): Do the copy of the url in a way that is threadsafe.
      (WebCore::SharedWorkerProxy::name):
      (WebCore::SharedWorkerProxy::SharedWorkerProxy):
      (WebCore::DefaultSharedWorkerRepository::getProxy): Do the copy of the url in a way that is threadsafe.
      * workers/SharedWorkerThread.cpp:
      (WebCore::SharedWorkerThread::SharedWorkerThread):
      * workers/WorkerMessagingProxy.cpp:
      (WebCore::MessageWorkerContextTask::MessageWorkerContextTask):
      (WebCore::MessageWorkerTask::MessageWorkerTask):
      (WebCore::WorkerExceptionTask::WorkerExceptionTask):
      * workers/WorkerRunLoop.cpp:
      (WebCore::WorkerRunLoop::Task::Task):
      (WebCore::WorkerRunLoop::postTaskForMode):
      * workers/WorkerThread.cpp:
      (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      bcb91543
  28. 07 Aug, 2009 1 commit
    • beidson@apple.com's avatar
      WebCore: · 8127cdcb
      beidson@apple.com authored
      2009-08-07  Brady Eidson  <beidson@apple.com>
      
              Reviewed by Darin Adler.
      
              Implement the HTML5 hashchange event.
              https://bugs.webkit.org/show_bug.cgi?id=21605
      
              Test: fast/loader/hashchange-event.html
      
              * dom/EventNames.h: Add "hashchange"
              * html/HTMLAttributeNames.in: Add "onhashchange"
      
              * loader/FrameLoader.cpp:
              (WebCore::HashChangeEventTask::create):
              (WebCore::HashChangeEventTask::performTask):
              (WebCore::HashChangeEventTask::HashChangeEventTask):
              (WebCore::FrameLoader::scrollToAnchor): When an anchor navigation is completed and the
                new fragment identifier is different from the old one, queue a hash change event
                on the Document.
      
              Add a window event listener for the hashchange event if onhashchange is encountered:
              * html/HTMLBodyElement.cpp:
              (WebCore::HTMLBodyElement::parseMappedAttribute): 
              * html/HTMLFrameSetElement.cpp:
              (WebCore::HTMLFrameSetElement::parseMappedAttribute):
      
              Add a new string utility method that gives "null and empty are equivalent" behavior:
              * platform/text/PlatformString.h:
              (WebCore::equalIgnoringNullity):
              * platform/text/StringImpl.cpp:
              (WebCore::equalIgnoringNullity):
              * platform/text/StringImpl.h:
      
      LayoutTests:
      
      2009-08-07  Brady Eidson  <beidson@apple.com>
      
              Reviewed by Darin Adler.
      
              Implement the HTML5 hashchange event.
              https://bugs.webkit.org/show_bug.cgi?id=21605
      
              * fast/loader/hashchange-event-expected.txt: Added.
              * fast/loader/hashchange-event.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      8127cdcb
  29. 06 Aug, 2009 1 commit
  30. 18 Jun, 2009 1 commit
    • kmccullough@apple.com's avatar
      JavaScriptCore: · 918d6360
      kmccullough@apple.com authored
      2009-06-18  Kevin McCullough  <kmccullough@apple.com>
      
              Reviewed by Oliver Hunt.
      
              <rdar://problem/6940880> REGRESSION: Breakpoints don't break in 64-bit
      
              - Exposed functions now needed by WebCore.
      
              * JavaScriptCore.exp:
      
      WebCore:
      
      2009-06-18  Kevin McCullough  <kmccullough@apple.com>
      
              Reviewed by Oliver Hunt.
      
              <rdar://problem/6940880> REGRESSION: Breakpoints don't break in 64-bit
      
              Convert intptr_t to Strings so that we don't loose bits in the
              conversion to JS.  Previously they were being put into 32bit ints.
      
              * inspector/InspectorController.cpp: Convert the String back to an
              intptr_t.
              (WebCore::InspectorController::addBreakpoint):
              (WebCore::InspectorController::removeBreakpoint):
              * inspector/InspectorController.h:
              * inspector/InspectorController.idl: Use strings in JS to avoid 32bit
              truncation.
              * inspector/InspectorFrontend.cpp: Make the intptr_t into a String.
              (WebCore::InspectorFrontend::parsedScriptSource):
              * platform/text/PlatformString.h: Implemented the necessary conversion
              functions to be able to convert to and from an intptr_t.
              * platform/text/String.cpp: Ditto.
              (WebCore::String::toIntPtrStrict):
              (WebCore::String::toIntPtr):
              (WebCore::charactersToIntPtrStrict):
              (WebCore::charactersToIntPtr):
              * platform/text/StringImpl.cpp: Ditto.
              (WebCore::StringImpl::toIntPtrStrict):
              (WebCore::StringImpl::toIntPtr):
              * platform/text/StringImpl.h: Ditto.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      918d6360