1. 27 May, 2010 2 commits
    • 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
    • darin@apple.com's avatar
      2010-05-26 Darin Adler <darin@apple.com> · 019c8ffa
      darin@apple.com authored
              Reviewed by Kent Tamura.
      
              Null characters handled incorrectly in ToNumber conversion
              https://bugs.webkit.org/show_bug.cgi?id=38088
      
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::parseInt): Changed code to use UTF8String().data() instead of
              ascii() to fix the thread safety issue. Code path is covered by existing
              tests in run-javascriptcore-tests.
              (JSC::parseFloat): Moved comment to UString::toDouble since the issue
              affects all clients, not just parseFloat. Specifically, this also affects
              standard JavaScript numeric conversion, ToNumber.
      
              * runtime/UString.cpp:
              (JSC::UString::toDouble): Added a comment about incorrect space skipping.
              Changed trailing junk check to use the length of the CString instead of
              checking for a null character. Also got rid of a little unneeded logic
              in the case where we tolerate trailing junk.
      2010-05-26  Darin Adler  <darin@apple.com>
      
              Reviewed by Kent Tamura.
      
              Null characters handled incorrectly in ToNumber conversion
              https://bugs.webkit.org/show_bug.cgi?id=38088
      
              * fast/js/ToNumber-expected.txt: Updated for new tests and to
              expect PASS for two null character tests.
              * fast/js/ToNumber.js: Added more test cases.
              * fast/js/parseFloat-expected.txt: Updated for new test case.
              * fast/js/script-tests/parseFloat.js: Added a test case.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60328 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      019c8ffa
  2. 21 May, 2010 1 commit
  3. 24 Apr, 2010 1 commit
    • darin@apple.com's avatar
      2010-04-24 Darin Adler <darin@apple.com> · b3cdcf3f
      darin@apple.com authored
              Reviewed by Dan Bernstein.
      
              REGRESSION (r56560): Crash in parseFloat if passed invalid UTF-16 data
              https://bugs.webkit.org/show_bug.cgi?id=38083
              rdar://problem/7901044
      
              Tests: fast/js/ToNumber.html
                     fast/js/parseFloat.html
      
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::parseInt): Added a FIXME comment about a problem I noticed.
              (JSC::parseFloat): Added a FIXME comment about a problem I noticed;
              covered by test cases in the test I added.
              * runtime/UString.cpp:
              (JSC::UString::toDouble): Added FIXME comments about two problem I
              noticed; covered by test cases in the tests I added. Added a return
              statement so we don't crash when illegal UTF-16 sequences are present.
      2010-04-24  Darin Adler  <darin@apple.com>
      
              Reviewed by Dan Bernstein.
      
              REGRESSION (r56560): Crash in parseFloat if passed invalid UTF-16 data
              https://bugs.webkit.org/show_bug.cgi?id=38083
              rdar://problem/7901044
      
              * fast/js/parseFloat-expected.txt: Added.
              * fast/js/parseFloat.html: Added.
              * fast/js/script-tests/parseFloat.js: Added.
      
              * fast/js/ToNumber-expected.txt: Added.
              * fast/js/ToNumber.html: Added.
              * fast/js/script-tests/ToNumber.js: Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b3cdcf3f
  4. 21 Apr, 2010 1 commit
    • 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
  5. 04 Apr, 2010 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=37068 · 4f76aacd
      barraclough@apple.com authored
      Change UString to use a 0 rep for null strings instead of a null object.
      
      Reviewed by Oliver Hunt.
      
      No performance impact.
      
      * JavaScriptCore.exp:
      * runtime/InternalFunction.cpp:
      (JSC::InternalFunction::InternalFunction):
      * runtime/JSString.h:
      (JSC::RopeBuilder::JSString):
      * runtime/UString.cpp:
      (JSC::initializeUString):
      * runtime/UString.h:
      (JSC::UString::UString):
      (JSC::UString::data):
      (JSC::UString::size):
      (JSC::UString::isNull):
      (JSC::UString::isEmpty):
      (JSC::UString::cost):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57055 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4f76aacd
  6. 31 Mar, 2010 1 commit
    • barraclough@apple.com's avatar
      Bug 36871 - Remove JSC::CString · f43597db
      barraclough@apple.com authored
      Use WTF::CString instead (which until recently was WebCore::CString).
      
      Reviewed by Geoff Garen.
      
      JavaScriptCore: 
      
      * JavaScriptCore.exp:
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
      * runtime/UString.cpp:
      * runtime/UString.h:
      
      JavaScriptGlue: 
      
      * ForwardingHeaders/wtf/text: Added.
      * ForwardingHeaders/wtf/text/CString.h: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f43597db
  7. 25 Mar, 2010 1 commit
    • barraclough@apple.com's avatar
      Bug 36611 - Cleanup JSC::CString · 5fc5928b
      barraclough@apple.com authored
      Rename CString::c_str() -> CString::data(), CString::size() -> CString::length(),
      remove UString::getCString() (all uses are wrong, should use UString::UTF8String()).
      
      Reviewed by Geoff Garen.
      
      JavaScriptCore: 
      
      * bytecode/CodeBlock.cpp:
      (JSC::CodeBlock::printUnaryOp):
      (JSC::CodeBlock::printBinaryOp):
      (JSC::CodeBlock::printConditionalJump):
      (JSC::CodeBlock::printGetByIdOp):
      (JSC::CodeBlock::printPutByIdOp):
      (JSC::printGlobalResolveInfo):
      (JSC::printStructureStubInfo):
      (JSC::CodeBlock::printStructure):
      (JSC::CodeBlock::printStructures):
      (JSC::CodeBlock::dump):
      * jsc.cpp:
      (functionPrint):
      (functionDebug):
      (runInteractive):
      (fillBufferWithContentsOfFile):
      * profiler/CallIdentifier.h:
      (JSC::CallIdentifier::c_str):
      * profiler/Profile.cpp:
      (JSC::Profile::debugPrintDataSampleStyle):
      * profiler/ProfileNode.cpp:
      (JSC::ProfileNode::debugPrintData):
      (JSC::ProfileNode::debugPrintDataSampleStyle):
      * runtime/DateConversion.cpp:
      (JSC::parseDate):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::encode):
      (JSC::globalFuncJSCPrint):
      * runtime/UString.cpp:
      (JSC::operator==):
      (JSC::UString::toDouble):
      * runtime/UString.h:
      (JSC::CString::length):
      (JSC::CString::data):
      
      WebCore: 
      
      * bridge/NP_jsobject.cpp:
      (_NPN_Enumerate):
      * bridge/c/c_utility.cpp:
      (JSC::Bindings::convertValueToNPVariant):
      * bridge/jni/jsc/JNIBridgeJSC.cpp:
      (JavaField::valueFromInstance):
      (JavaField::setValueToInstance):
      * bridge/jni/jsc/JavaInstanceJSC.cpp:
      (JavaInstance::invokeMethod):
      * bridge/jni/jsc/JavaStringJSC.h:
      (JSC::Bindings::JavaStringImpl::UTF8String):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56560 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5fc5928b
  8. 22 Mar, 2010 1 commit
  9. 16 Mar, 2010 2 commits
    • darin@apple.com's avatar
      Rolled out r56081 since it broke the Windows build. · 7554dc19
      darin@apple.com authored
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56085 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7554dc19
    • darin@apple.com's avatar
      Added arrayLength function and used it instead of hand-written code. · 17041057
      darin@apple.com authored
      Reviewed by Sam Weinig.
      
      * JavaScriptCore.xcodeproj/project.pbxproj:
      Removed PtrAndFlags.h. The file was removed long ago.
      
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::privateExecute): Use arrayLength.
      
      * runtime/Collector.h:
      (JSC::CollectorBitmap::count): Remove WTF:: prefix from use
      of bitCount. In WTF we inject things into the global namespace
      and this is no exception.
      
      * runtime/DatePrototype.cpp:
      (JSC::formatLocaleDate): Use arrayLength.
      
      * runtime/JSFunction.h:
      (JSC::JSFunction::nativeFunction): Remove WTF:: prefix as above.
      (JSC::JSFunction::scopeChain): Ditto.
      (JSC::JSFunction::setScopeChain): Ditto.
      (JSC::JSFunction::setNativeFunction): Ditto.
      
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset): Use arrayLength.
      
      * runtime/JSImmediate.h:
      (JSC::reinterpretDoubleToIntptr): Remove WTF:: prefix as above.
      (JSC::reinterpretIntptrToDouble): Ditto.
      
      * runtime/JSONObject.cpp:
      (JSC::Stringifier::appendQuotedString): Use arrayLength.
      (JSC::Stringifier::toJSON): Ditto.
      (JSC::Stringifier::appendStringifiedValue): Ditto.
      * runtime/SmallStrings.cpp:
      (JSC::SmallStrings::SmallStrings): Ditto.
      
      * runtime/UString.cpp:
      (JSC::UString::from): Use arrayLength.
      
      * wtf/StdLibExtras.h:
      (WTF::bitwise_cast): Marked this inline!
      (WTF::arrayLength): Added function template (actually written by Sam).
      Added using declarations for public things in WTF namespace defined
      in this file.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      17041057
  10. 11 Mar, 2010 1 commit
    • barraclough@apple.com's avatar
      Rubber stamped by Oliver Hunt. · 939eb23b
      barraclough@apple.com authored
              
      Rename JSC::UStringImpl::data() to characters(), to match WebCore::StringImpl.
      
      JavaScriptCore: 
      
      * API/JSClassRef.cpp:
      (OpaqueJSClassContextData::OpaqueJSClassContextData):
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::keyForCharacterSwitch):
      * bytecompiler/NodesCodegen.cpp:
      (JSC::processClauseList):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::privateExecute):
      * jit/JITStubs.cpp:
      (JSC::DEFINE_STUB_FUNCTION):
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncToString):
      * runtime/Identifier.cpp:
      (JSC::Identifier::equal):
      (JSC::Identifier::addSlowCase):
      * runtime/JSString.cpp:
      (JSC::JSString::resolveRope):
      * runtime/UString.cpp:
      (JSC::UString::toStrictUInt32):
      (JSC::equal):
      * runtime/UString.h:
      (JSC::UString::data):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::characters):
      (JSC::UStringImpl::hash):
      (JSC::UStringImpl::setHash):
      
      WebCore: 
      
      * bridge/jni/jsc/JavaStringJSC.h:
      (JSC::Bindings::JavaStringImpl::uchars):
      * platform/text/AtomicString.cpp:
      (WebCore::AtomicString::add):
      (WebCore::AtomicString::find):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55833 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      939eb23b
  11. 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
  12. 16 Feb, 2010 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=34964 · 2b3ed85e
      barraclough@apple.com authored
      Leaks tool reports false memory leaks due to Rope implementation.
      
      Reviewed by Oliver Hunt.
      
      JavaScriptCore: 
      
      A rope is a recursive data structure where each node in the rope holds a set of
      pointers, each of which may reference either a string (in UStringImpl form) or
      another rope node.  A low bit in each pointer is used to distinguish between
      rope & string elements, in a fashion similar to the recently-removed
      PtrAndFlags class (see https://bugs.webkit.org/show_bug.cgi?id=33731 ).  Again,
      this causes a problem for Leaks – refactor to remove the magic pointer
      mangling.
      
      Move Rope out from JSString.h and rename to URopeImpl, to match UStringImpl.
      Give UStringImpl and URopeImpl a common parent class, UStringOrRopeImpl.
      Repurpose an otherwise invalid permutation to flags (static & should report
      memory cost) to identify ropes.
      
      This allows us to change the rope's fibers to interrogate the object rather
      than storing a bool within the low bits of the pointer (or in some cases the
      use of a common parent class removes the need to determine the type at all -
      there is a common interface to ref or get the length of either ropes or strings).
      
      * API/JSClassRef.cpp:
      (OpaqueJSClass::OpaqueJSClass):
      (OpaqueJSClassContextData::OpaqueJSClassContextData):
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::keyForCharacterSwitch):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::privateExecute):
      * jit/JITStubs.cpp:
      (JSC::DEFINE_STUB_FUNCTION):
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncToString):
      * runtime/Identifier.cpp:
      (JSC::Identifier::equal):
      (JSC::Identifier::addSlowCase):
      * runtime/JSString.cpp:
      (JSC::JSString::resolveRope):
      * runtime/JSString.h:
      (JSC::):
      (JSC::RopeBuilder::JSString):
      (JSC::RopeBuilder::~JSString):
      (JSC::RopeBuilder::appendStringInConstruct):
      (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
      (JSC::RopeBuilder::JSStringFinalizerStruct::JSStringFinalizerStruct):
      (JSC::RopeBuilder::JSStringFinalizerStruct::):
      * runtime/UString.cpp:
      (JSC::UString::toStrictUInt32):
      (JSC::equal):
      * runtime/UString.h:
      (JSC::UString::isEmpty):
      (JSC::UString::size):
      * runtime/UStringImpl.cpp:
      (JSC::URopeImpl::derefFibersNonRecursive):
      (JSC::URopeImpl::destructNonRecursive):
      * runtime/UStringImpl.h:
      (JSC::UStringOrRopeImpl::isRope):
      (JSC::UStringOrRopeImpl::length):
      (JSC::UStringOrRopeImpl::ref):
      (JSC::UStringOrRopeImpl::):
      (JSC::UStringOrRopeImpl::operator new):
      (JSC::UStringOrRopeImpl::UStringOrRopeImpl):
      (JSC::UStringImpl::adopt):
      (JSC::UStringImpl::createUninitialized):
      (JSC::UStringImpl::tryCreateUninitialized):
      (JSC::UStringImpl::data):
      (JSC::UStringImpl::cost):
      (JSC::UStringImpl::deref):
      (JSC::UStringImpl::UStringImpl):
      (JSC::UStringImpl::):
      (JSC::URopeImpl::tryCreateUninitialized):
      (JSC::URopeImpl::initializeFiber):
      (JSC::URopeImpl::fiberCount):
      (JSC::URopeImpl::fibers):
      (JSC::URopeImpl::deref):
      (JSC::URopeImpl::URopeImpl):
      (JSC::URopeImpl::hasOneRef):
      (JSC::UStringOrRopeImpl::deref):
      
      WebCore: 
      
      Renamed cUStringImpl::size() to UStringImpl::size()UStringImpl::length()
      (matches WebCore::StringImpl).
      
      * bridge/jni/jsc/JavaStringJSC.h:
      (JSC::Bindings::JavaStringImpl::length):
      * platform/text/AtomicString.cpp:
      (WebCore::AtomicString::add):
      (WebCore::AtomicString::find):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2b3ed85e
  13. 15 Feb, 2010 1 commit
    • barraclough@apple.com's avatar
      Bug 34952 - String lengths in UString should be unsigned. · 2049d9a7
      barraclough@apple.com authored
      This matches WebCore::StringImpl, and better unifies behaviour throughout JSC.
      
      Reviewed by Geoff Garen.
      
      JavaScriptCore: 
      
      * JavaScriptCore.exp:
      * bytecode/EvalCodeCache.h:
      * runtime/Identifier.cpp:
      (JSC::Identifier::equal):
      * runtime/Identifier.h:
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEscape):
      * runtime/JSONObject.cpp:
      (JSC::gap):
      (JSC::Stringifier::indent):
      * runtime/NumberPrototype.cpp:
      (JSC::numberProtoFuncToFixed):
      (JSC::numberProtoFuncToPrecision):
      * runtime/RegExp.cpp:
      (JSC::RegExp::match):
      * runtime/StringPrototype.cpp:
      (JSC::substituteBackreferencesSlow):
      (JSC::stringProtoFuncReplace):
      (JSC::stringProtoFuncSplit):
      (JSC::trimString):
      * runtime/UString.cpp:
      (JSC::UString::UString):
      (JSC::UString::from):
      (JSC::UString::getCString):
      (JSC::UString::ascii):
      (JSC::UString::operator[]):
      (JSC::UString::toStrictUInt32):
      (JSC::UString::find):
      (JSC::UString::rfind):
      (JSC::UString::substr):
      (JSC::operator<):
      (JSC::operator>):
      (JSC::compare):
      (JSC::equal):
      (JSC::UString::UTF8String):
      * runtime/UString.h:
      (JSC::UString::size):
      (JSC::operator==):
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::create):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::create):
      (JSC::UStringImpl::size):
      (JSC::UStringImpl::computeHash):
      (JSC::UStringImpl::UStringImpl):
      
      WebCore: 
      
      * bindings/js/JSDOMWindowCustom.cpp:
      (WebCore::JSDOMWindow::atob):
      (WebCore::JSDOMWindow::btoa):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2049d9a7
  14. 09 Feb, 2010 2 commits
    • barraclough@apple.com's avatar
      Three small string fixes: · 3cb3d047
      barraclough@apple.com authored
      (1) StringBuilder::release should CRASH if the buffer allocation failed.
      (2) Remove weird, dead code from JSString::tryGetValue, replace with an ASSERT.
      (3) Move UString::createFromUTF8 out to the API, as tryCreateStringFromUTF8.
          This is only used from the API, and (now) unlike other UString::create
          methods may return UString::null() to indicate failure cases.  Better
          handle these in the API.
      
      Reviewed by Oliver Hunt.
      
      * API/JSClassRef.cpp:
      (tryCreateStringFromUTF8):
      (OpaqueJSClass::OpaqueJSClass):
      (OpaqueJSClassContextData::OpaqueJSClassContextData):
      * runtime/JSString.h:
      (JSC::Fiber::tryGetValue):
      * runtime/StringBuilder.h:
      (JSC::StringBuilder::release):
      * runtime/UString.cpp:
      (JSC::UString::UString):
      (JSC::UString::from):
      (JSC::UString::find):
      * runtime/UString.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3cb3d047
    • barraclough@apple.com's avatar
      Make String.replace throw an exception on out-of-memory, rather than · a8a20144
      barraclough@apple.com authored
      returning a null (err, empty-ish) string.  Move String::replaceRange
      and String::spliceSubstringsWithSeparators out to StringPrototype -
      these were fairly specific use anyway, and we can better integrate
      throwing the JS expcetion this way.
      
      Reviewed by Oliver Hunt
      
      Also removes redundant assignment operator from UString.
      
      * JavaScriptCore.exp:
      * runtime/StringPrototype.cpp:
      (JSC::StringRange::StringRange):
      (JSC::jsSpliceSubstringsWithSeparators):
      (JSC::jsReplaceRange):
      (JSC::stringProtoFuncReplace):
      * runtime/UString.cpp:
      * runtime/UString.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a8a20144
  15. 06 Feb, 2010 1 commit
    • barraclough@apple.com's avatar
      Change UStringImpl::create to CRASH if the string cannot be allocated, · e37590bc
      barraclough@apple.com authored
      rather than returning a null string (which will behave like a zero-length
      string if used).
      
      Reviewed by Geoff Garen.
      
      Also move createRep function from UString to become new overloaded
      UStringImpl::create methods.  In doing so, bring their behaviour closer to
      being in line with WebCore::StringImpl, in removing the behaviour that they
      can be used to produce null UStrings (ASSERT the char* provided is non-null).
      This behaviour of converting null C-strings to null UStrings is inefficient
      (cmompared to just using UString::null()), incompatible with WebCore::StringImpl's
      behaviour, and may generate unexpected behaviour, since in many cases a null
      UString can be used like an empty string.
      
      With these changes UStringImpl need not have a concept of null impls, we can
      start transitioning this to become an implementation detail of UString, that
      internally it chooses to use a null-object rather than an actually zero impl
      pointer.
      
      * JavaScriptCore.exp:
      * debugger/Debugger.cpp:
      (JSC::Debugger::recompileAllJSFunctions):
      * debugger/DebuggerCallFrame.cpp:
      (JSC::DebuggerCallFrame::calculatedFunctionName):
      * parser/Parser.cpp:
      (JSC::Parser::parse):
      * profiler/Profile.cpp:
      (JSC::Profile::Profile):
      * profiler/ProfileGenerator.cpp:
      (JSC::ProfileGenerator::stopProfiling):
      * runtime/Error.cpp:
      (JSC::Error::create):
      (JSC::throwError):
      * runtime/ExceptionHelpers.cpp:
      (JSC::createError):
      * runtime/Identifier.cpp:
      (JSC::Identifier::add):
      * runtime/PropertyNameArray.cpp:
      (JSC::PropertyNameArray::add):
      * runtime/UString.cpp:
      (JSC::initializeUString):
      (JSC::UString::UString):
      (JSC::UString::operator=):
      * runtime/UString.h:
      (JSC::UString::isNull):
      (JSC::UString::null):
      (JSC::UString::rep):
      (JSC::UString::UString):
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::create):
      * runtime/UStringImpl.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e37590bc
  16. 19 Jan, 2010 1 commit
    • barraclough@apple.com's avatar
      Revert r53454, since it causes much sadness in this world. · 64d1d2ec
      barraclough@apple.com authored
      Patch by Gavin Barraclough <barraclough@apple.com> on 2010-01-18
      Reviewed by NOBODY (build fix).
      
      * runtime/UString.cpp:
      (JSC::UString::spliceSubstringsWithSeparators):
      (JSC::UString::replaceRange):
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::baseSharedBuffer):
      (JSC::UStringImpl::sharedBuffer):
      (JSC::UStringImpl::~UStringImpl):
      * runtime/UStringImpl.h:
      (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
      (JSC::UntypedPtrAndBitfield::asPtr):
      (JSC::UntypedPtrAndBitfield::operator&=):
      (JSC::UntypedPtrAndBitfield::operator|=):
      (JSC::UntypedPtrAndBitfield::operator&):
      (JSC::UStringImpl::create):
      (JSC::UStringImpl::cost):
      (JSC::UStringImpl::isIdentifier):
      (JSC::UStringImpl::setIsIdentifier):
      (JSC::UStringImpl::ref):
      (JSC::UStringImpl::deref):
      (JSC::UStringImpl::checkConsistency):
      (JSC::UStringImpl::UStringImpl):
      (JSC::UStringImpl::bufferOwnerString):
      (JSC::UStringImpl::bufferOwnership):
      (JSC::UStringImpl::isStatic):
      * wtf/StringHashFunctions.h:
      (WTF::stringHash):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      64d1d2ec
  17. 18 Jan, 2010 3 commits
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=33731 · b247c1e5
      barraclough@apple.com authored
      Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags).
      
      Patch by Gavin Barraclough <barraclough@apple.com> on 2010-01-18
      Reviewed by Oliver Hunt.
      
      This break the OS X Leaks tool.  Instead, free up some more bits from the refCount.
      
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::sharedBuffer):
      (JSC::UStringImpl::~UStringImpl):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::cost):
      (JSC::UStringImpl::checkConsistency):
      (JSC::UStringImpl::UStringImpl):
      (JSC::UStringImpl::bufferOwnerString):
      (JSC::UStringImpl::):
      * wtf/StringHashFunctions.h:
      (WTF::stringHash):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b247c1e5
    • ossy@webkit.org's avatar
      Rubber-stamped by Gustavo Noronha Silva. · 989d6e35
      ossy@webkit.org authored
      Rolling out r53391 and r53392 because of random crashes on buildbots.
      https://bugs.webkit.org/show_bug.cgi?id=33731
      
      * bytecode/CodeBlock.h:
      (JSC::CallLinkInfo::seenOnce):
      (JSC::CallLinkInfo::setSeen):
      (JSC::MethodCallLinkInfo::MethodCallLinkInfo):
      (JSC::MethodCallLinkInfo::seenOnce):
      (JSC::MethodCallLinkInfo::setSeen):
      * jit/JIT.cpp:
      (JSC::JIT::unlinkCall):
      * jit/JITPropertyAccess.cpp:
      (JSC::JIT::patchMethodCallProto):
      * runtime/UString.cpp:
      (JSC::UString::spliceSubstringsWithSeparators):
      (JSC::UString::replaceRange):
      * runtime/UString.h:
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::baseSharedBuffer):
      (JSC::UStringImpl::sharedBuffer):
      (JSC::UStringImpl::~UStringImpl):
      * runtime/UStringImpl.h:
      (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
      (JSC::UntypedPtrAndBitfield::asPtr):
      (JSC::UntypedPtrAndBitfield::operator&=):
      (JSC::UntypedPtrAndBitfield::operator|=):
      (JSC::UntypedPtrAndBitfield::operator&):
      (JSC::UStringImpl::create):
      (JSC::UStringImpl::cost):
      (JSC::UStringImpl::isIdentifier):
      (JSC::UStringImpl::setIsIdentifier):
      (JSC::UStringImpl::ref):
      (JSC::UStringImpl::deref):
      (JSC::UStringImpl::checkConsistency):
      (JSC::UStringImpl::UStringImpl):
      (JSC::UStringImpl::bufferOwnerString):
      (JSC::UStringImpl::bufferOwnership):
      (JSC::UStringImpl::isStatic):
      * wtf/StringHashFunctions.h:
      (WTF::stringHash):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      989d6e35
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=33731 · 2d208f8c
      barraclough@apple.com authored
      Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags).
      
      Reviewed by Oliver Hunt.
      
      This break the OS X Leaks tool.  Instead, free up some more bits from the refCount.
      
      * runtime/UStringImpl.cpp:
      (JSC::UStringImpl::sharedBuffer):
      (JSC::UStringImpl::~UStringImpl):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::cost):
      (JSC::UStringImpl::checkConsistency):
      (JSC::UStringImpl::UStringImpl):
      (JSC::UStringImpl::bufferOwnerString):
      (JSC::UStringImpl::):
      * wtf/StringHashFunctions.h:
      (WTF::stringHash):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2d208f8c
  18. 14 Jan, 2010 1 commit
    • barraclough@apple.com's avatar
      JavaScriptCore: Make naming & behaviour of UString[Impl] methods more consistent. · b150b88f
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=33702
      
      Reviewed by Sam Weinig.
      
      UString::create() creates a copy of the UChar* passed, but UStringImpl::create() assumes
      that it should assume ownership of the provided buffer (with UString::createNonCopying()
      and UStringImpl::createCopying() providing the alternate behaviours).  Unify on create()
      taking a copy of the provided buffer.  For non-copying cases, use the name 'adopt', and
      make this method take a Vector<UChar>&.  For cases where non-copying construction was being
      used, other than from a Vector<UChar>, change the code to allocate the storage along with
      the UStringImpl using UStringImpl::createUninitialized().  (The adopt() method also more
      closely matches that of WebCore::StringImpl).
      
      Also, UString::createUninitialized() and UStringImpl::createUninitialized() have incompatible
      behaviours, in that the UString form sets the provided UChar* to a null or non-null value to
      indicate success or failure, but UStringImpl uses the returned PassRefPtr<UStringImpl> to
      indicate when allocation has failed (potentially leaving the output Char* uninitialized).
      This is also incompatible with WebCore::StringImpl's behaviour, in that
      StringImpl::createUninitialized() will CRASH() if unable to allocate.  Some uses of
      createUninitialized() in JSC are unsafe, since they do not test the result for null.
      UStringImpl's indication is preferable, since we may want a successful call to set the result
      buffer to 0 (specifically, StringImpl returns 0 for the buffer where createUninitialized()
      returns the empty string, which seems reasonable to catch bugs early).  UString's method
      cannot support UStringImpl's behaviour directly, since it returns an object rather than a
      pointer.
          - remove UString::createUninitialized(), replace with calls to UStringImpl::createUninitialized()
          - create a UStringImpl::tryCreateUninitialized() form UStringImpl::createUninitialized(),
            with current behaviour, make createUninitialized() crash on failure to allocate.
          - make cases in JSC that do not check the result call createUninitialized(), and cases that do
            check call tryCreateUninitialized().
      
      Rename computedHash() to existingHash(), to bring this in line wih WebCore::StringImpl.
      
      * API/JSClassRef.cpp:
      (OpaqueJSClassContextData::OpaqueJSClassContextData):
      * JavaScriptCore.exp:
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncToString):
      * runtime/Identifier.cpp:
      (JSC::CStringTranslator::translate):
      (JSC::UCharBufferTranslator::translate):
      * runtime/JSString.cpp:
      (JSC::JSString::resolveRope):
      * runtime/Lookup.cpp:
      (JSC::HashTable::createTable):
      * runtime/Lookup.h:
      (JSC::HashTable::entry):
      * runtime/StringBuilder.h:
      (JSC::StringBuilder::release):
      * runtime/StringConstructor.cpp:
      (JSC::stringFromCharCodeSlowCase):
      * runtime/StringPrototype.cpp:
      (JSC::substituteBackreferencesSlow):
      (JSC::stringProtoFuncToLowerCase):
      (JSC::stringProtoFuncToUpperCase):
      (JSC::stringProtoFuncFontsize):
      (JSC::stringProtoFuncLink):
      * runtime/Structure.cpp:
      (JSC::Structure::despecifyDictionaryFunction):
      (JSC::Structure::get):
      (JSC::Structure::despecifyFunction):
      (JSC::Structure::put):
      (JSC::Structure::remove):
      (JSC::Structure::insertIntoPropertyMapHashTable):
      (JSC::Structure::checkConsistency):
      * runtime/Structure.h:
      (JSC::Structure::get):
      * runtime/StructureTransitionTable.h:
      (JSC::StructureTransitionTableHash::hash):
      * runtime/UString.cpp:
      (JSC::createRep):
      (JSC::UString::UString):
      (JSC::UString::spliceSubstringsWithSeparators):
      (JSC::UString::replaceRange):
      (JSC::UString::operator=):
      * runtime/UString.h:
      (JSC::UString::adopt):
      (JSC::IdentifierRepHash::hash):
      (JSC::makeString):
      * runtime/UStringImpl.h:
      (JSC::UStringImpl::adopt):
      (JSC::UStringImpl::create):
      (JSC::UStringImpl::createUninitialized):
      (JSC::UStringImpl::tryCreateUninitialized):
      (JSC::UStringImpl::existingHash):
      
      WebCore: Rubber stamped by Sam Weinig.
      
      Make naming & behaviour of UString[Impl] methods more consistent.
      https://bugs.webkit.org/show_bug.cgi?id=33702
      
      WebCore change reflecting UString method name change computedHash() -> existingHash().
      
      * platform/text/AtomicString.cpp:
      (WebCore::AtomicString::add):
      (WebCore::AtomicString::find):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b150b88f
  19. 05 Jan, 2010 1 commit
    • mjs@apple.com's avatar
      2010-01-04 Maciej Stachowiak <mjs@apple.com> · acbcc283
      mjs@apple.com authored
              Reviewed by Darin Fisher.
      
              Reorganize, document and rename OS() platform macros.
              https://bugs.webkit.org/show_bug.cgi?id=33198
      
              * wtf/Platform.h: Rename, reorganize and document OS() macros.
      
              Adapt to name changes. Also fixed a few incorrect OS checks.
      
              * API/JSContextRef.cpp:
              * assembler/MacroAssemblerARM.cpp:
              (JSC::isVFPPresent):
              * assembler/MacroAssemblerX86Common.h:
              * bytecode/SamplingTool.cpp:
              * config.h:
              * interpreter/RegisterFile.cpp:
              (JSC::RegisterFile::~RegisterFile):
              * interpreter/RegisterFile.h:
              (JSC::RegisterFile::RegisterFile):
              (JSC::RegisterFile::grow):
              * jit/ExecutableAllocator.h:
              * jit/ExecutableAllocatorFixedVMPool.cpp:
              * jit/ExecutableAllocatorPosix.cpp:
              * jit/ExecutableAllocatorSymbian.cpp:
              * jit/ExecutableAllocatorWin.cpp:
              * jit/JITOpcodes.cpp:
              (JSC::JIT::privateCompileCTIMachineTrampolines):
              * jit/JITStubs.cpp:
              * jsc.cpp:
              (main):
              * parser/Grammar.y:
              * profiler/ProfileNode.cpp:
              (JSC::getCount):
              * runtime/Collector.cpp:
              (JSC::Heap::Heap):
              (JSC::Heap::allocateBlock):
              (JSC::Heap::freeBlockPtr):
              (JSC::currentThreadStackBase):
              (JSC::getCurrentPlatformThread):
              (JSC::suspendThread):
              (JSC::resumeThread):
              (JSC::getPlatformThreadRegisters):
              (JSC::otherThreadStackPointer):
              * runtime/Collector.h:
              * runtime/DateConstructor.cpp:
              * runtime/DatePrototype.cpp:
              (JSC::formatLocaleDate):
              * runtime/InitializeThreading.cpp:
              (JSC::initializeThreading):
              * runtime/MarkStack.h:
              (JSC::MarkStack::MarkStackArray::shrinkAllocation):
              * runtime/MarkStackPosix.cpp:
              * runtime/MarkStackSymbian.cpp:
              * runtime/MarkStackWin.cpp:
              * runtime/StringPrototype.cpp:
              (JSC::stringProtoFuncLastIndexOf):
              * runtime/TimeoutChecker.cpp:
              (JSC::getCPUTime):
              * runtime/UString.cpp:
              (JSC::UString::from):
              * wtf/Assertions.cpp:
              * wtf/Assertions.h:
              * wtf/CurrentTime.cpp:
              (WTF::lowResUTCTime):
              * wtf/CurrentTime.h:
              (WTF::getLocalTime):
              * wtf/DateMath.cpp:
              * wtf/FastMalloc.cpp:
              (WTF::TCMalloc_ThreadCache::InitModule):
              (WTF::TCMallocStats::):
              * wtf/FastMalloc.h:
              * wtf/MathExtras.h:
              * wtf/RandomNumber.cpp:
              (WTF::randomNumber):
              * wtf/RandomNumberSeed.h:
              (WTF::initializeRandomNumberGenerator):
              * wtf/StringExtras.h:
              * wtf/TCSpinLock.h:
              (TCMalloc_SpinLock::Unlock):
              (TCMalloc_SlowLock):
              * wtf/TCSystemAlloc.cpp:
              * wtf/ThreadSpecific.h:
              (WTF::::destroy):
              * wtf/Threading.h:
              * wtf/ThreadingPthreads.cpp:
              (WTF::initializeThreading):
              (WTF::isMainThread):
              * wtf/ThreadingWin.cpp:
              (WTF::wtfThreadEntryPoint):
              (WTF::createThreadInternal):
              * wtf/VMTags.h:
              * wtf/unicode/icu/CollatorICU.cpp:
              (WTF::Collator::userDefault):
              * wtf/win/MainThreadWin.cpp:
              (WTF::initializeMainThreadPlatform):
      2010-01-04  Maciej Stachowiak  <mjs@apple.com>
      
              Reviewed by Darin Fisher.
      
              Reorganize, document and rename OS() platform macros.
              https://bugs.webkit.org/show_bug.cgi?id=33198
      
              Adapt to name changes.
      
              * src/ChromiumBridge.cpp:
              * src/EditorClientImpl.cpp:
              (WebKit::EditorClientImpl::isSelectTrailingWhitespaceEnabled):
              (WebKit::):
              (WebKit::EditorClientImpl::handleEditingKeyboardEvent):
              * src/FrameLoaderClientImpl.cpp:
              (WebKit::FrameLoaderClientImpl::createPlugin):
              * src/GraphicsContext3D.cpp:
              (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
              (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal):
              (WebCore::GraphicsContext3DInternal::makeContextCurrent):
              * src/WebFrameImpl.cpp:
              (WebKit::WebFrameImpl::selectionAsText):
              (WebKit::WebFrameImpl::printPage):
              * src/WebPluginContainerImpl.cpp:
              (WebKit::WebPluginContainerImpl::handleMouseEvent):
              (WebKit::WebPluginContainerImpl::handleKeyboardEvent):
              * src/WebViewImpl.cpp:
              (WebKit::WebViewImpl::mouseDown):
              (WebKit::WebViewImpl::mouseContextMenu):
              (WebKit::WebViewImpl::mouseUp):
              (WebKit::WebViewImpl::keyEvent):
              (WebKit::WebViewImpl::sendContextMenuEvent):
              (WebKit::WebViewImpl::setScrollbarColors):
              (WebKit::WebViewImpl::navigationPolicyFromMouseEvent):
      2010-01-04  Maciej Stachowiak  <mjs@apple.com>
      
              Reviewed by Darin Fisher.
      
              Reorganize, document and rename OS() platform macros.
              https://bugs.webkit.org/show_bug.cgi?id=33198
      
              Adapt to name changes.
      
              * webkit/webkitwebsettings.cpp:
              (webkit_get_user_agent):
      2010-01-04  Maciej Stachowiak  <mjs@apple.com>
      
              Reviewed by Darin Fisher.
      
              Reorganize, document and rename OS() platform macros.
              https://bugs.webkit.org/show_bug.cgi?id=33198
      
              Adapt to name changes. Also fixed a few incorrect OS checks.
      
              * accessibility/AccessibilityObject.h:
              * config.h:
              * dom/SelectElement.cpp:
              (WebCore::SelectElement::listBoxDefaultEventHandler):
              * inspector/InspectorFrontendHost.cpp:
              (WebCore::InspectorFrontendHost::platform):
              * loader/CachedFont.cpp:
              * loader/FTPDirectoryDocument.cpp:
              * loader/FTPDirectoryParser.cpp:
              * page/EventHandler.cpp:
              * page/Frame.cpp:
              (WebCore::Frame::setUseSecureKeyboardEntry):
              * page/NavigatorBase.cpp:
              (WebCore::NavigatorBase::platform):
              * page/Page.h:
              * page/Settings.cpp:
              (WebCore::Settings::Settings):
              * page/Settings.h:
              * page/chromium/DragControllerChromium.cpp:
              (WebCore::DragController::isCopyKeyDown):
              * page/chromium/EventHandlerChromium.cpp:
              (WebCore::EventHandler::accessKeyModifiers):
              * page/win/EventHandlerWin.cpp:
              (WebCore::EventHandler::createDraggingClipboard):
              * platform/FileSystem.h:
              * platform/KeyboardCodes.h:
              * platform/PurgeableBuffer.h:
              * platform/chromium/ChromiumBridge.h:
              * platform/chromium/ClipboardChromium.cpp:
              (WebCore::ClipboardChromium::writeRange):
              * platform/chromium/ClipboardUtilitiesChromium.cpp:
              * platform/chromium/ClipboardUtilitiesChromium.h:
              * platform/chromium/PasteboardChromium.cpp:
              (WebCore::Pasteboard::writeSelection):
              (WebCore::Pasteboard::writePlainText):
              (WebCore::Pasteboard::documentFragment):
              * platform/chromium/PlatformKeyboardEventChromium.cpp:
              (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
              (WebCore::PlatformKeyboardEvent::currentCapsLockState):
              * platform/chromium/PopupMenuChromium.cpp:
              (WebCore::PopupListBox::layout):
              (WebCore::PopupMenu::show):
              * platform/graphics/BitmapImage.h:
              (WebCore::BitmapImage::mayFillWithSolidColor):
              * platform/graphics/FloatPoint.h:
              * platform/graphics/FloatRect.h:
              * platform/graphics/FloatSize.h:
              * platform/graphics/FontCache.cpp:
              (WebCore::alternateFamilyName):
              * platform/graphics/FontCache.h:
              * platform/graphics/FontFastPath.cpp:
              (WebCore::Font::glyphDataForCharacter):
              * platform/graphics/GlyphBuffer.h:
              (WebCore::GlyphBuffer::advanceAt):
              (WebCore::GlyphBuffer::add):
              * platform/graphics/Gradient.h:
              * platform/graphics/GraphicsContext.cpp:
              * platform/graphics/GraphicsContext.h:
              * platform/graphics/GraphicsContext3D.h:
              * platform/graphics/ImageSource.h:
              * platform/graphics/IntRect.h:
              * platform/graphics/MediaPlayer.cpp:
              * platform/graphics/Path.h:
              * platform/graphics/Pattern.h:
              * platform/graphics/SimpleFontData.h:
              * platform/graphics/cg/ColorCG.cpp:
              * platform/graphics/cg/GraphicsContextCG.cpp:
              * platform/graphics/chromium/FontCustomPlatformData.cpp:
              (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
              (WebCore::FontCustomPlatformData::fontPlatformData):
              (WebCore::createFontCustomPlatformData):
              * platform/graphics/chromium/FontCustomPlatformData.h:
              * platform/graphics/chromium/FontPlatformData.h:
              * platform/graphics/opentype/OpenTypeUtilities.cpp:
              * platform/graphics/opentype/OpenTypeUtilities.h:
              * platform/graphics/qt/GraphicsContextQt.cpp:
              (WebCore::GraphicsContext::getWindowsContext):
              * platform/graphics/qt/ImageQt.cpp:
              * platform/graphics/skia/GraphicsContextSkia.cpp:
              (WebCore::GraphicsContext::clipToImageBuffer):
              * platform/graphics/skia/ImageBufferSkia.cpp:
              (WebCore::ImageBuffer::ImageBuffer):
              * platform/graphics/skia/PlatformContextSkia.cpp:
              (PlatformContextSkia::State::State):
              (PlatformContextSkia::PlatformContextSkia):
              (PlatformContextSkia::save):
              (PlatformContextSkia::restore):
              * platform/graphics/skia/PlatformContextSkia.h:
              * platform/graphics/win/IconWin.cpp:
              (WebCore::Icon::createIconForFiles):
              (WebCore::Icon::paint):
              * platform/graphics/wx/GraphicsContextWx.cpp:
              * platform/gtk/FileSystemGtk.cpp:
              (WebCore::filenameToString):
              (WebCore::filenameFromString):
              (WebCore::filenameForDisplay):
              * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
              * platform/network/curl/ResourceHandleManager.cpp:
              * platform/network/soup/ResourceHandleSoup.cpp:
              (WebCore::):
              * platform/text/String.cpp:
              (WebCore::String::format):
              (WebCore::String::number):
              * platform/text/TextEncoding.cpp:
              (WebCore::TextEncoding::encode):
              * platform/text/TextEncodingRegistry.cpp:
              (WebCore::buildBaseTextCodecMaps):
              (WebCore::extendTextCodecMaps):
              * platform/text/TextStream.cpp:
              * platform/text/TextStream.h:
              * platform/text/qt/TextCodecQt.cpp:
              (WebCore::TextCodecQt::decode):
              * platform/win/PlatformMouseEventWin.cpp:
              (WebCore::messageToEventType):
              (WebCore::PlatformMouseEvent::PlatformMouseEvent):
              * platform/win/PlatformScreenWin.cpp:
              (WebCore::deviceInfoForWidget):
              (WebCore::screenIsMonochrome):
              * platform/win/PopupMenuWin.cpp:
              (WebCore::PopupMenu::show):
              (WebCore::PopupMenu::paint):
              (WebCore::PopupMenu::registerClass):
              (WebCore::PopupMenu::PopupMenuWndProc):
              (WebCore::PopupMenu::wndProc):
              * platform/win/SystemTimeWin.cpp:
              (WebCore::userIdleTime):
              * platform/wx/FileSystemWx.cpp:
              (WebCore::unloadModule):
              * plugins/PluginDatabase.cpp:
              * plugins/PluginPackage.cpp:
              (WebCore::PluginPackage::compareFileVersion):
              * plugins/PluginPackage.h:
              * plugins/PluginView.cpp:
              (WebCore::PluginView::setFrameRect):
              (WebCore::PluginView::stop):
              (WebCore::PluginView::PluginView):
              * plugins/PluginView.h:
              * plugins/win/PluginDatabaseWin.cpp:
              (WebCore::addWindowsMediaPlayerPluginDirectory):
              (WebCore::addMacromediaPluginDirectories):
              * plugins/win/PluginPackageWin.cpp:
              (WebCore::PluginPackage::load):
              * plugins/win/PluginViewWin.cpp:
              (WebCore::registerPluginView):
              (WebCore::PluginView::wndProc):
              (WebCore::PluginView::updatePluginWidget):
              (WebCore::PluginView::paintIntoTransformedContext):
              (WebCore::PluginView::paintWindowedPluginIntoContext):
              (WebCore::PluginView::paint):
              (WebCore::PluginView::handleMouseEvent):
              (WebCore::PluginView::setParent):
              (WebCore::PluginView::setNPWindowRect):
              (WebCore::PluginView::platformStart):
      2010-01-04  Maciej Stachowiak  <mjs@apple.com>
      
              Reviewed by Darin Fisher.
      
              Reorganize, document and rename OS() platform macros.
              https://bugs.webkit.org/show_bug.cgi?id=33198
      
              Adapt to name changes.
              
              * DumpRenderTree/DumpRenderTree.h:
              * DumpRenderTree/config.h:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      acbcc283
  20. 21 Dec, 2009 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=32831 · 1c68c3de
      barraclough@apple.com authored
      Replace UString::Rep implementation, following introduction of ropes to JSC.
      
      Reviewed by Darin Adler.
      
      JavaScriptCore: 
      
          * Remove redundant overcapacity mechanisms.
          * Reduce memory cost of Rep's.
          * Add an inline storage mechanism akin to that in WebCore's StringImpl.
      
      ~1% Sunspider progression.
      
      * JavaScriptCore.exp:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * runtime/JSString.cpp:
      (JSC::JSString::resolveRope):
      * runtime/SmallStrings.cpp:
      (JSC::SmallStringsStorage::SmallStringsStorage):
      * runtime/UString.cpp:
      (JSC::initializeUString):
      (JSC::createRep):
      (JSC::UString::createFromUTF8):
      (JSC::UString::createUninitialized):
      (JSC::UString::spliceSubstringsWithSeparators):
      (JSC::UString::replaceRange):
      (JSC::UString::ascii):
      (JSC::UString::operator=):
      (JSC::UString::toStrictUInt32):
      (JSC::equal):
      * runtime/UString.h:
      (JSC::UString::isEmpty):
      (JSC::UString::cost):
      (JSC::makeString):
      * runtime/UStringImpl.cpp: Added.
      (JSC::UStringImpl::baseSharedBuffer):
      (JSC::UStringImpl::sharedBuffer):
      (JSC::UStringImpl::destroy):
      (JSC::UStringImpl::computeHash):
      * runtime/UStringImpl.h: Added.
      (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield):
      (JSC::UntypedPtrAndBitfield::asPtr):
      (JSC::UntypedPtrAndBitfield::operator&=):
      (JSC::UntypedPtrAndBitfield::operator|=):
      (JSC::UntypedPtrAndBitfield::operator&):
      (JSC::UStringImpl::create):
      (JSC::UStringImpl::createCopying):
      (JSC::UStringImpl::createUninitialized):
      (JSC::UStringImpl::data):
      (JSC::UStringImpl::size):
      (JSC::UStringImpl::cost):
      (JSC::UStringImpl::hash):
      (JSC::UStringImpl::computedHash):
      (JSC::UStringImpl::setHash):
      (JSC::UStringImpl::identifierTable):
      (JSC::UStringImpl::setIdentifierTable):
      (JSC::UStringImpl::ref):
      (JSC::UStringImpl::deref):
      (JSC::UStringImpl::allocChars):
      (JSC::UStringImpl::copyChars):
      (JSC::UStringImpl::computeHash):
      (JSC::UStringImpl::null):
      (JSC::UStringImpl::empty):
      (JSC::UStringImpl::checkConsistency):
      (JSC::UStringImpl::):
      (JSC::UStringImpl::UStringImpl):
      (JSC::UStringImpl::operator new):
      (JSC::UStringImpl::bufferOwnerString):
      (JSC::UStringImpl::bufferOwnership):
      (JSC::UStringImpl::isStatic):
      
      JavaScriptGlue: 
      
      * ForwardingHeaders/wtf/PossiblyNull.h: Added.
          - add forwarding header.
      
      WebCore: 
      
      * ForwardingHeaders/runtime/UStringImpl.h: Added.
          - add forwarding header.
      
      * platform/text/StringImpl.cpp:
      (WebCore::StringImpl::ustring):
          - order of arguments to UString::Rep constructor for shared strings changed.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1c68c3de
  21. 18 Dec, 2009 1 commit
    • barraclough@apple.com's avatar
      Add createNonCopying method to UString to make replace constructor passed bool, · e677126a
      barraclough@apple.com authored
      to make behaviour more explicit.  Add createFromUTF8 to UString (wrapping method
      on UString::Rep), since other cases of transliteration (e.g.  from ascii) are
      performed in UString constructors.  Add/use setHash & size() accessors on Rep,
      rather than accessing _hash/len directly.
      
      Reviewed by Sam Weinig.
      
      * API/JSClassRef.cpp:
      (OpaqueJSClass::OpaqueJSClass):
      * API/OpaqueJSString.cpp:
      (OpaqueJSString::ustring):
      * JavaScriptCore.exp:
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncToString):
      * runtime/Identifier.cpp:
      (JSC::Identifier::equal):
      (JSC::CStringTranslator::translate):
      (JSC::UCharBufferTranslator::translate):
      (JSC::Identifier::addSlowCase):
      * runtime/JSString.cpp:
      (JSC::JSString::resolveRope):
      * runtime/JSString.h:
      (JSC::JSString::Rope::Fiber::refAndGetLength):
      (JSC::JSString::Rope::append):
      * runtime/StringBuilder.h:
      (JSC::StringBuilder::release):
      * runtime/StringConstructor.cpp:
      (JSC::stringFromCharCodeSlowCase):
      * runtime/StringPrototype.cpp:
      (JSC::substituteBackreferencesSlow):
      (JSC::stringProtoFuncToLowerCase):
      (JSC::stringProtoFuncToUpperCase):
      (JSC::stringProtoFuncFontsize):
      (JSC::stringProtoFuncLink):
      * runtime/UString.cpp:
      (JSC::UString::UString):
      (JSC::UString::createNonCopying):
      (JSC::UString::createFromUTF8):
      * runtime/UString.h:
      (JSC::UString::Rep::setHash):
      (JSC::UString::~UString):
      (JSC::makeString):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e677126a
  22. 19 Nov, 2009 2 commits
  23. 18 Nov, 2009 1 commit
    • tkent@chromium.org's avatar
      2009-11-18 Kent Tamura <tkent@chromium.org> · e2a78115
      tkent@chromium.org authored
              Reviewed by Darin Adler.
      
              Move UString::from(double) implementation to new
              WTF::doubleToStringInJavaScriptFormat(), and expose it because WebCore
              code will use it.
              https://bugs.webkit.org/show_bug.cgi?id=31330
      
              - Introduce new function createRep(const char*, unsigned) and
                UString::UString(const char*, unsigned) to reduce 2 calls to strlen().
              - Fix a bug that dtoa() doesn't update *rve if the input value is NaN
                or Infinity.
      
              No new tests because this doesn't change the behavior.
      
              * JavaScriptCore.exp:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * runtime/UString.cpp:
              (JSC::createRep):
              (JSC::UString::UString):
              (JSC::UString::from): Move the code to doubleToStringInJavaScriptFormat().
              * runtime/UString.h:
              * wtf/dtoa.cpp:
              (WTF::dtoa): Fix a bug about rve.
              (WTF::append): A helper for doubleToStringInJavaScriptFormat().
              (WTF::doubleToStringInJavaScriptFormat): Move the code from UString::from(double).
              * wtf/dtoa.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51168 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e2a78115
  24. 11 Sep, 2009 1 commit
  25. 20 Aug, 2009 1 commit
    • ggaren@apple.com's avatar
      Added a number => string cache. · a60d51b4
      ggaren@apple.com authored
              
      Patch by Geoffrey Garen <ggaren@apple.com> on 2009-08-20
      Reviewed by Maciej Stachowiak.
      
      1.07x faster on v8 (1.7x faster on v8-splay).
      1.004x faster on SunSpider.
      
      * runtime/JSCell.h: Moved JSValue::toString to JSString.h.
      * runtime/JSGlobalData.h: Holds the cache.
      * runtime/JSNumberCell.cpp:
      (JSC::JSNumberCell::toString):
      (JSC::JSNumberCell::toThisString): Removed -0 special case.
      UString handles this now, since too many clients were
      special-casing it.
      
      * runtime/JSString.h:
      (JSC::JSValue::toString): Use the cache when converting
      an int or double to string.
      
      * runtime/Operations.h:
      (JSC::concatenateStrings): Call toString to take advantage
      of the cache.
      
      * runtime/SmallStrings.h:
      (JSC::NumericStrings::add):
      (JSC::NumericStrings::lookup): The cache.
      
      * runtime/UString.cpp:
      (JSC::UString::from): Added -0 special case mentioned above.
      Removed appendNumeric because it's mutually exclusive with the
      cache.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a60d51b4
  26. 12 Aug, 2009 4 commits
  27. 21 Jul, 2009 1 commit
    • aroben@apple.com's avatar
      Roll out r46153, r46154, and r46155 · 096e7e05
      aroben@apple.com authored
              These changes were causing build failures and assertion failures on
              Windows.
      
      JavaScriptCore:
      
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * runtime/JSArray.cpp:
              * runtime/StringPrototype.cpp:
              * runtime/UString.cpp:
              * runtime/UString.h:
              * wtf/FastMalloc.cpp:
              * wtf/FastMalloc.h:
              * wtf/Platform.h:
              * wtf/PossiblyNull.h: Removed.
      
      WebCore:
      
              * ForwardingHeaders/wtf/PossiblyNull.h: Removed.
              * platform/graphics/cg/ImageBufferCG.cpp:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      096e7e05
  28. 20 Jul, 2009 1 commit
  29. 12 Jun, 2009 1 commit
    • levin@chromium.org's avatar
      JavaScriptCore: · 1ef10580
      levin@chromium.org authored
      2009-06-12  David Levin  <levin@chromium.org>
      
              Reviewed by Darin Adler.
      
              UString shouldn't create sharedBuffer for SmallStrings.
              https://bugs.webkit.org/show_bug.cgi?id=26360
      
              The methods changed are not used by JSC, so there is no JS perf impact.  However,
              there is a potential DOM perf impact, so I re-ran several of the tests that
              I ran previously and ensured that the perf stay the same which caused me to
              adjust the minLengthToShare.
      
              * JavaScriptCore.exp:
              * runtime/UString.cpp:
              (JSC::UString::Rep::sharedBuffer):
                  Determines if the buffer being shared is big enough before doing so.
                  Previously, BaseString::sharedBuffer was called but it would only know
                  the length of the base string (BaseString::len) which may not be the same
                  as the string being shared (Rep::len).
              (JSC::UString::BaseString::sharedBuffer):
                  This is now only be used by Rep::sharedBuffer. which does the length check.
              * runtime/UString.h:
      
      WebCore:
      
      2009-06-12  David Levin  <levin@chromium.org>
      
              Reviewed by Darin Adler.
      
              UString shouldn't create sharedBuffer for SmallStrings.
              https://bugs.webkit.org/show_bug.cgi?id=26347
      
              Change the call to use the method UString::Rep::sharedBuffer due
              to changes in UString.
      
              No noticable change in behavior, so no test.
      
              * platform/text/StringImpl.cpp:
              (WebCore::StringImpl::create):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1ef10580
  30. 01 Jun, 2009 1 commit
    • levin@chromium.org's avatar
      JavaScriptCore: · 77fbf832
      levin@chromium.org authored
      2009-06-01  David Levin  <levin@chromium.org>
      
              Reviewed by Darin Alder and Maciej Stachowiak.
      
              Bug 26057: StringImpl should share buffers with UString.
              https://bugs.webkit.org/show_bug.cgi?id=26057
      
              * JavaScriptCore.exp:
              * runtime/UString.cpp:
              (JSC::UString::Rep::create):
              (JSC::UString::BaseString::sharedBuffer): Only do the sharing when
              the buffer exceeds a certain size.  The size was tuned by running
              various dom benchmarks with numbers ranging from 20 to 800 and finding
              a place that seemed to do the best overall.
              * runtime/UString.h:
      
      WebCore:
      
      2009-06-01  David Levin  <levin@chromium.org>
      
              Reviewed by Darin Alder and Maciej Stachowiak.
      
              Bug 26057: StringImpl should share buffers with UString.
              https://bugs.webkit.org/show_bug.cgi?id=26057
      
              This change results in the following performance improvements:
              On http://www.hixie.ch/tests/adhoc/perf/dom/artificial/core/001.html
              the time went from 78ms to 40ms for append (other times remained constant).
      
              On http://www.hixie.ch/tests/adhoc/perf/dom/artificial/core/002.html,
              the time went from 3900ms to 2600ms.
      
              For http://dromaeo.com/?dom, the time for DomModification improved by ~6%.
              Other tests in dom seemed to be faster across several runs but within the
              margin of error (except DOM Attributes which was slightly ~1.5% worse).
      
              Existing tests cover this code and there is no new functionality
              that is exposed to test.
      
              * platform/text/AtomicString.cpp:
              (WebCore::AtomicString::add):
              * platform/text/String.cpp:
              (WebCore::String::String):
              (WebCore::String::operator UString):
              * platform/text/StringImpl.cpp:
              (WebCore::StringImpl::StringImpl):
              (WebCore::StringImpl::~StringImpl):
              (WebCore::StringImpl::create): Consumes a shared buffer.
              (WebCore::StringImpl::ustring): Shares the StringImpl's buffer with the UString.
              (WebCore::StringImpl::sharedBuffer): Exposes the buffer that may be shared.
              * platform/text/StringImpl.h:
              (WebCore::StringImpl::hasTerminatingNullCharacter):
              (WebCore::StringImpl::inTable):
              (WebCore::StringImpl::setInTable): Converted the bools to be inside of PtrAndFlags
              to avoid growing StringImpl in size.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      77fbf832
  31. 25 May, 2009 1 commit
    • levin@chromium.org's avatar
      JavaScriptCore: · b34a1489
      levin@chromium.org authored
      2009-05-25  David Levin  <levin@chromium.org>
      
              Reviewed by Maciej Stachowiak and Oliver Hunt.
      
              https://bugs.webkit.org/show_bug.cgi?id=25126
              Allow the buffer underlying UString to be shared.
      
              In order to not grow the underlying size of any structure,
              there is a union in the Rep string which holds
               + m_sharedBuffer -- a pointer to the shared ref counted buffer
                 if the class is BaseString and the buffer is being shared OR
               + m_baseString -- the BaseString if the class is only UString::Rep
                 but not a UString::BaseString
      
              Ideally, m_sharedBuffer would be a RefPtr, but it cannot be because
              it is in a union.
      
              No change in sunspider perf.
      
              * JavaScriptCore.vcproj/WTF/WTF.vcproj:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * runtime/UString.cpp:
              (JSC::UString::Rep::share):
              (JSC::UString::Rep::destroy):
              (JSC::UString::BaseString::sharedBuffer):
              (JSC::UString::BaseString::setSharedBuffer):
              (JSC::UString::BaseString::slowIsBufferReadOnly):
              (JSC::expandCapacity):
              (JSC::UString::Rep::reserveCapacity):
              (JSC::UString::expandPreCapacity):
              (JSC::concatenate):
              (JSC::UString::append):
              * runtime/UString.h:
              (JSC::UString::Rep::Rep):
              (JSC::UString::Rep::):
              (JSC::UString::BaseString::isShared):
              (JSC::UString::BaseString::isBufferReadOnly):
              (JSC::UString::Rep::baseString):
              * wtf/CrossThreadRefCounted.h:
              (WTF::CrossThreadRefCounted::isShared):
              * wtf/OwnFastMallocPtr.h: Added.
              (WTF::OwnFastMallocPtr::OwnFastMallocPtr):
              (WTF::OwnFastMallocPtr::~OwnFastMallocPtr):
              (WTF::OwnFastMallocPtr::get):
              (WTF::OwnFastMallocPtr::release):
      
      JavaScriptGlue:
      
      2009-05-25  David Levin  <levin@chromium.org>
      
              Reviewed by Maciej Stachowiak and Oliver Hunt.
      
              https://bugs.webkit.org/show_bug.cgi?id=25126
      
              Added forwarding headers.
      
              * ForwardingHeaders/wtf/CrossThreadRefCounted.h: Added.
              * ForwardingHeaders/wtf/OwnFastMallocPtr.h: Added.
      
      WebCore:
      
      2009-05-25  David Levin  <levin@chromium.org>
      
              Reviewed by Maciej Stachowiak and Oliver Hunt.
      
              Added forwarding headers.
      
              * ForwardingHeaders/wtf/CrossThreadRefCounted.h: Added.
              * ForwardingHeaders/wtf/OwnFastMallocPtr.h: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44145 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b34a1489