1. 05 Nov, 2012 1 commit
    • fpizlo@apple.com's avatar
      Reduce the verbosity of referring to QNaN in JavaScriptCore · 3494d02f
      fpizlo@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=101174
      
      Reviewed by Geoffrey Garen.
      
      Introduces a #define QNaN in JSValue.h, and replaces all previous uses of
      std::numeric_limits<double>::quiet_NaN() with QNaN.
      
      * API/JSValueRef.cpp:
      (JSValueMakeNumber):
      (JSValueToNumber):
      * dfg/DFGSpeculativeJIT.cpp:
      (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
      * jit/JITPropertyAccess.cpp:
      (JSC::JIT::emitFloatTypedArrayGetByVal):
      * runtime/CachedTranscendentalFunction.h:
      (JSC::CachedTranscendentalFunction::initialize):
      * runtime/DateConstructor.cpp:
      (JSC::constructDate):
      * runtime/DateInstanceCache.h:
      (JSC::DateInstanceData::DateInstanceData):
      (JSC::DateInstanceCache::reset):
      * runtime/ExceptionHelpers.cpp:
      (JSC::InterruptedExecutionError::defaultValue):
      (JSC::TerminatedExecutionError::defaultValue):
      * runtime/JSCell.h:
      (JSC::JSValue::getPrimitiveNumber):
      * runtime/JSDateMath.cpp:
      (JSC::parseDateFromNullTerminatedCharacters):
      * runtime/JSGlobalData.cpp:
      (JSC::JSGlobalData::JSGlobalData):
      (JSC::JSGlobalData::resetDateCache):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::parseInt):
      (JSC::jsStrDecimalLiteral):
      (JSC::toDouble):
      (JSC::jsToNumber):
      (JSC::parseFloat):
      * runtime/JSValue.cpp:
      (JSC::JSValue::toNumberSlowCase):
      * runtime/JSValue.h:
      (JSC):
      * runtime/JSValueInlineMethods.h:
      (JSC::jsNaN):
      * runtime/MathObject.cpp:
      (JSC::mathProtoFuncMax):
      (JSC::mathProtoFuncMin):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3494d02f
  2. 26 Sep, 2012 2 commits
    • barraclough@apple.com's avatar
      REGRESSION (r129456): http/tests/security/xss-eval.html is failing on JSC platforms · 1e61b896
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=97529
      
      Reviewed by Filip Pizlo.
      
      A recent patch changed JSC's EvalError behaviour; bring this more into line with other browsers.
      
      Source/JavaScriptCore: 
      
      JSC currently throws an EvalError if you try to call eval with a this object that doesn't
      match the given eval function. This does not match other browsers, which generally just
      ignore the this value that was passed, and eval the string in the eval function's environment.
      
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
          - Remove EvalError, ignore passed this value.
      
      LayoutTests: 
      
      * fast/js/eval-cross-window-expected.txt:
      * fast/js/eval-cross-window.html:
          - Changed not to expect EvalErrors (this matches other browsers), and modified testThis
            to check that the this object is always set to the global object.
      * http/tests/security/resources/xss-eval2.html:
      * http/tests/security/resources/xss-eval3.html:
      * http/tests/security/xss-eval-expected.txt:
      * http/tests/security/xss-eval.html:
          - Updated. Access via the global environment is not a security risk, since the eval is
            accessing it's own document's informantion. Access via the shell attempts to access
            the navigated pages document, tripping an access check & throwing a TypeError.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129712 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1e61b896
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r129592. · 9ab98ef6
      commit-queue@webkit.org authored
      http://trac.webkit.org/changeset/129592
      https://bugs.webkit.org/show_bug.cgi?id=97670
      
      Failures in Chromium security tests (Requested by schenney on
      #webkit).
      
      Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-26
      
      Source/JavaScriptCore:
      
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
      
      LayoutTests:
      
      * fast/js/eval-cross-window-expected.txt:
      * fast/js/eval-cross-window.html:
      * http/tests/security/cross-frame-access-call-expected.txt:
      * http/tests/security/cross-frame-access-call.html:
      * http/tests/security/resources/xss-eval2.html:
      * http/tests/security/resources/xss-eval3.html:
      * http/tests/security/xss-eval-expected.txt:
      * http/tests/security/xss-eval.html:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9ab98ef6
  3. 25 Sep, 2012 1 commit
    • barraclough@apple.com's avatar
      REGRESSION (r129456): http/tests/security/xss-eval.html is failing on JSC platforms · b364bcbe
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=97529
      
      Reviewed by Filip Pizlo.
      
      A recent patch changed JSC's EvalError behaviour; bring this more into line with other browsers.
      
      Source/JavaScriptCore: 
      
      JSC currently throws an EvalError if you try to call eval with a this object that doesn't
      match the given eval function. This does not match other browsers, which generally just
      ignore the this value that was passed, and eval the string in the eval function's environment.
      
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
          - Remove EvalError, ignore passed this value.
      
      LayoutTests: 
      
      * fast/js/eval-cross-window-expected.txt:
      * fast/js/eval-cross-window.html:
          - Changed not to expect EvalErrors (this matches other browsers), and modified testThis
            to check that the this object is always set to the global object.
      * http/tests/security/resources/xss-eval2.html:
      * http/tests/security/resources/xss-eval3.html:
      * http/tests/security/xss-eval-expected.txt:
      * http/tests/security/xss-eval.html:
          - Updated. Access via the global environment is not a security risk, since the eval is
            accessing it's own document's informantion. Access via the shell attempts to access
            the navigated pages document, tripping an access check & throwing a TypeError.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b364bcbe
  4. 24 Sep, 2012 1 commit
    • barraclough@apple.com's avatar
      Remove JSObject::unwrappedGlobalObject(), JSObject::unwrappedObject() · 51bdc905
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=97519
      
      Reviewed by Geoff Garen.
      
      ../JavaScriptCore: 
      
      unwrappedGlobalObject() was only needed because globalObject() doesn't always return a helpful result -
      specifically for WebCore's window shell the structure's globalObject is set to null. We can fix this by
      simply keeping the structure up to date as the window navigates, obviating the need for this function.
      
      The only other use of unwrappedObject() came from globalFuncEval(), and this can be trivially removed
      by flipping the way we perform this globalObject check (which we may also be able to remove!) - instead
      of getting the globalObject from the provided this value & comparing to the expected globalObject, we
      can get the this value from the expected globalObject, and compare to that provided.
      
      * runtime/JSGlobalObject.cpp:
          - Call globalObject() instead of unwrappedGlobalObject().
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
          - Changed to compare this object values, instead of globalObjects -
            this means we only need to be able to map globalObject -> this,
            and not vice versa.
      * runtime/JSObject.cpp:
      (JSC::JSObject::allowsAccessFrom):
      (JSC::JSObject::createInheritorID):
          - Call globalObject() instead of unwrappedGlobalObject().
      * runtime/JSObject.h:
      (JSObject):
          - Removed unwrappedGlobalObject(), unwrappedObject().
      
      ../WebCore: 
      
      JSDOMWindowShell::setWindow should update the structure's globalObject.
      
      * bindings/js/JSDOMWindowShell.h:
      (WebCore::JSDOMWindowShell::setWindow):
          - Update the JSDOMWindowShell's structure's globalObject when the
            window changes.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      51bdc905
  5. 11 Sep, 2012 1 commit
    • ggaren@apple.com's avatar
      JSActivation should inline allocate its registers, and eliminate · 06a8bb6e
      ggaren@apple.com authored
      'arguments' registers in the common case
      https://bugs.webkit.org/show_bug.cgi?id=96427
      
      Reviewed by Filip Pizlo.
      
      This cuts the size class for simple closures down to 64 bytes.
      
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::BytecodeGenerator::BytecodeGenerator): Set the usesNonStrictEval
      flag, which is new. Use a more specific test for whether a function
      uses 'arguments', so we can avoid allocating, initializing, and tearing
      off those registers in the common case. Distinguish between capturing
      arguments and not, so we can avoid allocating space for arguments in
      the torn-off object.
      
      We can make this even more general in the future, with some bytecode
      generator refactoring.
      
      (JSC::BytecodeGenerator::resolve): Updated for new interface.
      
      * bytecompiler/BytecodeGenerator.h:
      (BytecodeGenerator):
      (JSC::BytecodeGenerator::symbolTable): Updated some types.
      
      * heap/Heap.cpp:
      (JSC::Heap::isValidAllocation): Allow large allocations, now that they
      are both supported and used.
      
      * heap/Heap.h:
      (Heap): Added a new form of allocateCell that specifies the full size
      of the allocation, to allow for extra space on the end.
      
      * interpreter/CallFrame.h:
      (JSC::ExecState::argumentOffset):
      (JSC::ExecState::argumentOffsetIncludingThis):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::unwindCallFrame): Refactored this code to be more
      specific about tearing off 'arguments' vs activations. This is something
      I forgot in my last patch, and it is required now that we can have
      acitvations without 'arguments' registers.
      
      * runtime/Arguments.h:
      (JSC::Arguments::setRegisters): No need for setRegisters anymore because
      the activation object's storage doesn't change.
      
      * runtime/JSActivation.cpp:
      (JSC::JSActivation::JSActivation): Initialize our storage manually because
      it's not declared to the C++ compiler.
      
      (JSC::JSActivation::visitChildren): No copyAndAppend because our storage
      is not out-of-line anymore.
      
      (JSC::JSActivation::symbolTableGet):
      (JSC::JSActivation::symbolTablePut):
      (JSC::JSActivation::getOwnPropertyNames):
      (JSC::JSActivation::symbolTablePutWithAttributes):
      (JSC::JSActivation::getOwnPropertySlot):
      (JSC::JSActivation::getOwnPropertyDescriptor):
      (JSC::JSActivation::argumentsGetter): Refactored isTornOff() testing to
      avoid using a data member and to avoid hard-coding any offset assumptions.
      
      * runtime/JSActivation.h:
      (JSC):
      (JSActivation):
      (JSC::JSActivation::create):
      (JSC::JSActivation::isDynamicScope):
      (JSC::JSActivation::captureStart):
      (JSC::JSActivation::storageSize):
      (JSC::JSActivation::storageSizeInBytes):
      (JSC::JSActivation::registerOffset):
      (JSC::JSActivation::tearOff):
      (JSC::JSActivation::isTornOff):
      (JSC::JSActivation::storage):
      (JSC::JSActivation::allocationSize):
      (JSC::JSActivation::isValid): New helper functions for doing the math
      on our inline storage. Note that in the "AllOfTheThings" tear-off case,
      the number of things is not known at compile time, so we store the
      number in the argument count register. We can't just copy the raw contents
      of the register beacuse we need a value that is safe for precise marking,
      and the value in the register file has an invalid tag.
      
      * runtime/JSCell.h:
      (JSC::allocateCell): New function for allocating with extra storage
      on the end.
      
      * runtime/JSSymbolTableObject.h:
      (JSC::JSSymbolTableObject::JSSymbolTableObject):
      (JSC::JSSymbolTableObject::finishCreation):
      * runtime/JSVariableObject.h:
      (JSC::JSVariableObject::JSVariableObject):
      (JSVariableObject): Make it easier for subclasses to use their symbol
      tables during construction, by passing the table as a constructor argument.
      
      * runtime/SymbolTable.h:
      (JSC::SharedSymbolTable::usesNonStrictEval):
      (JSC::SharedSymbolTable::setUsesNonStrictEval):
      (SharedSymbolTable):
      (JSC::SharedSymbolTable::captureMode):
      (JSC::SharedSymbolTable::setCaptureMode):
      (JSC::SharedSymbolTable::captureStart):
      (JSC::SharedSymbolTable::setCaptureStart):
      (JSC::SharedSymbolTable::captureEnd):
      (JSC::SharedSymbolTable::setCaptureEnd):
      (JSC::SharedSymbolTable::parameterCountIncludingThis):
      (JSC::SharedSymbolTable::setParameterCountIncludingThis):
      (JSC::SharedSymbolTable::SharedSymbolTable): Added data members to more
      precisely describe what kind of capture is in play, and to avoid having
      data members in the activation. We expect N activations per symbol table,
      so this can be a big savings in heavy closure usage.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128260 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      06a8bb6e
  6. 04 Sep, 2012 1 commit
    • benjamin@webkit.org's avatar
      Improve JSC use of Strings after the UString->String change · 762e2c65
      benjamin@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=95633
      
      Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-04
      Reviewed by Geoffrey Garen.
      
      This patch improve the use of strings in the JSC runtime.
      
      The initialization of Identifier is left for future patches.
      
      The improvements are the following:
      -5% faster to raise one of the modified exception.
      -3 times faster to execute Boolean::toString()
      
      Most of the changes are just about using the new methods
      for string literals.
      
      With the changes, the binary on x86_64 gets 176 bytes smaller.
      
      * API/JSCallbackObjectFunctions.h:
      (JSC::::staticFunctionGetter):
      (JSC::::callbackGetter):
      * API/JSContextRef.cpp:
      (JSContextCreateBacktrace):
      * API/JSObjectRef.cpp:
      (JSObjectMakeFunctionWithCallback):
      * bytecode/CodeBlock.cpp:
      (JSC::valueToSourceString):
      (JSC::CodeBlock::nameForRegister):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::addStackTraceIfNecessary):
      * runtime/ArrayConstructor.cpp:
      (JSC::constructArrayWithSizeQuirk):
      * runtime/ArrayPrototype.cpp:
      (JSC::shift):
      (JSC::unshift):
      (JSC::arrayProtoFuncPop):
      (JSC::arrayProtoFuncReverse):
      * runtime/BooleanPrototype.cpp:
      (JSC::booleanProtoFuncToString): Instead of instanciating new strings, reuse the
      keywords available in SmallStrings. Avoiding the creation of the JSString and StringImpl
      makes the method significantly faster.
      
      * runtime/DateConversion.cpp:
      (JSC::formatDateTime):
      * runtime/DatePrototype.cpp:
      (JSC::formatLocaleDate):
      (JSC::formateDateInstance):
      (JSC::dateProtoFuncToISOString):
      Change the way we use snprintf() for clarity and performance.
      
      Instead of allocating one extra byte to put a zero "just in case", we use the size returned
      by snprintf().
      To prevent any overflow from a programming mistake, we explicitely test for overflow and
      return an empty string.
      
      (JSC::dateProtoFuncToJSON):
      * runtime/Error.cpp:
      (JSC::createNotEnoughArgumentsError):
      (JSC::throwTypeError):
      (JSC::throwSyntaxError):
      * runtime/Error.h:
      (JSC::StrictModeTypeErrorFunction::create):
      * runtime/ErrorPrototype.cpp:
      (JSC::ErrorPrototype::finishCreation):
      (JSC::errorProtoFuncToString):
      Using a null String is correct because (8) uses jsString(), (9) tests for a length of 0.
      
      * runtime/ExceptionHelpers.cpp:
      (JSC::InterruptedExecutionError::defaultValue):
      (JSC::TerminatedExecutionError::defaultValue):
      (JSC::createStackOverflowError):
      (JSC::createOutOfMemoryError):
      * runtime/Executable.cpp:
      (JSC::EvalExecutable::compileInternal):
      (JSC::FunctionExecutable::paramString):
      * runtime/FunctionConstructor.cpp:
      (JSC::constructFunction):
      (JSC::constructFunctionSkippingEvalEnabledCheck):
      * runtime/FunctionPrototype.h:
      (JSC::FunctionPrototype::create):
      Using a null String for the name is correct because InternalFunction uses jsString()
      to create the name value.
      
      * runtime/InternalFunction.cpp:
      (JSC::InternalFunction::finishCreation):
      There is no need to create an empty string for a null string, jsString() handle both
      cases as empty JSString.
      
      * runtime/JSArray.cpp:
      (JSC::reject):
      (JSC::SparseArrayValueMap::put):
      (JSC::JSArray::put):
      (JSC::JSArray::putByIndexBeyondVectorLength):
      (JSC::JSArray::putDirectIndexBeyondVectorLength):
      (JSC::JSArray::setLength):
      (JSC::JSArray::pop):
      (JSC::JSArray::push):
      * runtime/JSFunction.cpp:
      (JSC::JSFunction::finishCreation): Same issue as InternalFunction::finishCreation.
      
      (JSC::JSFunction::callerGetter):
      (JSC::JSFunction::defineOwnProperty):
      * runtime/JSGlobalData.cpp:
      (JSC::enableAssembler): Use CFSTR() instead of CFStringCreateWithCString().
      CFStringCreateWithCString() copy the content and may choose to decode the data.
      CFSTR() is much more efficient.
      
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      JSFunction uses jsString() to create the name, we can use null strings instead
      of creating empty strings.
      
      (JSC::JSGlobalObject::createThrowTypeError): ditto.
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::encode):
      (JSC::decode):
      (JSC::globalFuncEval):
      * runtime/JSONObject.cpp:
      (JSC::Stringifier::appendStringifiedValue):
      (JSC::Stringifier::Holder::appendNextProperty):
      (JSC::JSONProtoFuncParse):
      (JSC::JSONProtoFuncStringify):
      * runtime/JSObject.cpp:
      (JSC::JSObject::put):
      (JSC::JSObject::defaultValue):
      (JSC::JSObject::hasInstance):
      (JSC::JSObject::defineOwnProperty):
      * runtime/JSString.cpp:
      Return an empty JSString to avoid the creation of a temporary empty String.
      
      (JSC::JSRopeString::getIndexSlowCase):
      * runtime/JSString.h:
      (JSC): Remove the versions of jsNontrivialString() taking a char*. All the callers
      have been replaced by calls using ASCIILiteral.
      
      * runtime/JSValue.cpp:
      (JSC::JSValue::putToPrimitive):
      * runtime/LiteralParser.cpp:
      (JSC::::Lexer::lex):
      (JSC::::Lexer::lexString):
      (JSC::::Lexer::lexNumber):
      (JSC::::parse):
      * runtime/LiteralParser.h:
      (JSC::LiteralParser::getErrorMessage):
      * runtime/NumberPrototype.cpp:
      (JSC::numberProtoFuncToExponential):
      (JSC::numberProtoFuncToFixed):
      (JSC::numberProtoFuncToPrecision):
      (JSC::numberProtoFuncToString):
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorGetPrototypeOf):
      (JSC::objectConstructorGetOwnPropertyDescriptor):
      (JSC::objectConstructorGetOwnPropertyNames):
      (JSC::objectConstructorKeys):
      (JSC::toPropertyDescriptor):
      (JSC::objectConstructorDefineProperty):
      (JSC::objectConstructorDefineProperties):
      (JSC::objectConstructorCreate):
      (JSC::objectConstructorSeal):
      (JSC::objectConstructorFreeze):
      (JSC::objectConstructorPreventExtensions):
      (JSC::objectConstructorIsSealed):
      (JSC::objectConstructorIsFrozen):
      (JSC::objectConstructorIsExtensible):
      * runtime/ObjectPrototype.cpp:
      (JSC::objectProtoFuncDefineGetter):
      (JSC::objectProtoFuncDefineSetter):
      (JSC::objectProtoFuncToString):
      * runtime/RegExpConstructor.cpp:
      (JSC::constructRegExp):
      * runtime/RegExpObject.cpp:
      (JSC::reject):
      (JSC::regExpObjectSource):
      * runtime/RegExpPrototype.cpp:
      (JSC::regExpProtoFuncCompile):
      * runtime/StringObject.cpp:
      (JSC::StringObject::defineOwnProperty):
      * runtime/StringPrototype.cpp:
      (JSC::jsSpliceSubstrings):
      (JSC::jsSpliceSubstringsWithSeparators):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      762e2c65
  7. 30 Aug, 2012 2 commits
    • ggaren@apple.com's avatar
      Use one object instead of two for closures, eliminating ScopeChainNode · b11e7874
      ggaren@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=95501
      
      Reviewed by Filip Pizlo.
      
      ../JavaScriptCore: 
      
      This patch removes ScopeChainNode, and moves all the data and related
      functions that used to be in ScopeChainNode into JSScope.
      
      Most of this patch is mechanical changes to use a JSScope* where we used
      to use a ScopeChainNode*. I've only specifically commented about items
      that were non-mechanical.
      
      * runtime/Completion.cpp:
      (JSC::evaluate):
      * runtime/Completion.h: Don't require an explicit scope chain argument
      when evaluating code. Clients never wanted anything other than the
      global scope, and other arbitrary scopes probably wouldn't work
      correctly, anyway.
      
      * runtime/JSScope.cpp:
      * runtime/JSScope.h:
      (JSC::JSScope::JSScope): JSScope now requires the data we used to pass to
      ScopeChainNode, so it can link itself into the scope chain correctly.
      
      * runtime/JSWithScope.h:
      (JSC::JSWithScope::create):
      (JSC::JSWithScope::JSWithScope): JSWithScope gets an extra constructor
      for specifically supplying your own scope chain. The DOM needs this
      interface for setting up the scope chain for certain event handlers.
      Other clients always just push the JSWithScope to the head of the current
      scope chain.
      
      ../WebCore: 
      
      Mechanical changes to update for JSC interface changes.
      
      ../WebKit/mac: 
      
      Mechanical change to update for JSC interface change.
      
      ../WebKit/qt: 
      
      Mechanical change to update for JSC interface change.
      
      * Api/qwebelement.cpp:
      (QWebElement::evaluateJavaScript):
      
      ../WebKit2: 
      
      Mechanical changes to update for JSC interface change.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b11e7874
    • benjamin@webkit.org's avatar
      Replace JSC::UString by WTF::String · cff06e46
      benjamin@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=95271
      
      Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-08-30
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore: 
      
      Having JSC::UString and WTF::String increase the complexity of working on WebKit, and
      add useless conversions in the bindings. It also cause some code bloat.
      
      The performance advantages of UString have been ported over in previous patches. This patch
      is the last step: getting rid of UString.
      
      In addition to the simplified code, this also reduce the binary size by 15kb on x86_64.
      
      * API/OpaqueJSString.cpp:
      (OpaqueJSString::ustring):
      * runtime/Identifier.h:
      (JSC::Identifier::ustring):
      To avoid changing everything at once, the function named ustring() were kept as is. They
      will be renamed in a follow up patch.
      
      * runtime/JSString.h:
      (JSC::JSString::string):
      (JSC::JSValue::toWTFString):
      (JSC::inlineJSValueNotStringtoString):
      (JSC::JSValue::toWTFStringInline):
      Since JSValue::toString() already exist (and return the JSString), the direct accessor is renamed
      to ::toWTFString(). We may change ::string() to ::jsString() and ::toWTFString() to ::toString()
      in the future.
      
      * runtime/StringPrototype.cpp:
      (JSC::substituteBackreferencesSlow): Replace the use of UString::getCharacters<>() by String::getCharactersWithUpconvert<>().
      
      Source/WebCore: 
      
      Update the code to use String instead of UString.
      
      On x86_64, this reduces the binary size by 22kb.
      
      Since it is no longer possible to differenciate JSC::jsString() and WebCore::jsString() by the input
      types, WebCore::jsString() is renated to WebCore::jsStringWithCache().
      
      Since the cache is using a PtrHash, JSC::jsString() is used in place of the old WebCore::jsString() when
      the string is generated locally. This is because the cache can never match in those cases.
      
      Source/WebKit/blackberry: 
      
      Replace UString by String.
      
      * WebCoreSupport/ClientExtension.cpp:
      * WebCoreSupport/PagePopupBlackBerry.cpp:
      (WebCore::PagePopupBlackBerry::installDomFunction):
      
      Source/WebKit/efl: 
      
      Replace UString by String.
      
      * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
      (DumpRenderTreeSupportEfl::sendWebIntentResponse):
      * ewk/ewk_frame.cpp:
      (ewk_frame_script_execute):
      
      Source/WebKit/gtk: 
      
      Replace UString by String.
      
      * gdom/ConvertToGCharPrivate.h:
      (copyAsGchar):
      
      Source/WebKit/mac: 
      
      Get rid of UString, replace it by String, and simplify the code when possible.
      
      On x86_64, this reduces the binary size by 7kb.
      
      * Plugins/Hosted/NetscapePluginHostProxy.mm:
      (identifierFromIdentifierRep):
      * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
      (WebKit::NetscapePluginInstanceProxy::addValueToArray):
      (WebKit::NetscapePluginInstanceProxy::moveGlobalExceptionToExecState):
      * Plugins/Hosted/ProxyInstance.mm:
      (WebKit::ProxyRuntimeMethod::create):
      (WebKit::ProxyRuntimeMethod::finishCreation):
      (WebKit::ProxyInstance::getPropertyNames):
      (WebKit::ProxyInstance::methodsNamed):
      (WebKit::ProxyInstance::fieldNamed):
      * WebView/WebFrame.mm:
      (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
      (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
      * WebView/WebScriptDebugDelegate.mm:
      (-[WebScriptCallFrame functionName]):
      (-[WebScriptCallFrame evaluateWebScript:]):
      * WebView/WebScriptDebugger.h:
      (WTF):
      (JSC):
      (WebScriptDebugger):
      * WebView/WebScriptDebugger.mm:
      (toNSURL):
      (WebScriptDebugger::sourceParsed):
      * WebView/WebView.mm:
      (aeDescFromJSValue):
      
      Source/WebKit/qt: 
      
      Replace UString by String.
      
      * Api/qwebelement.cpp:
      (QWebElement::evaluateJavaScript):
      
      Source/WebKit/win: 
      
      Replace UString by String.
      
      * WebFrame.cpp:
      (WebFrame::stringByEvaluatingJavaScriptInScriptWorld):
      * WebView.cpp:
      (WebView::stringByEvaluatingJavaScriptFromString):
      
      Source/WebKit/wx: 
      
      Update the #includes to use the correct types.
      
      * WebFrame.cpp:
      * WebView.cpp:
      
      Source/WebKit2: 
      
      Update to code to switch from UString to String.
      
      * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
      (WebKit::JSNPMethod::finishCreation):
      * WebProcess/Plugins/Netscape/JSNPMethod.h:
      (WebKit::JSNPMethod::create):
      (JSNPMethod):
      * WebProcess/Plugins/Netscape/JSNPObject.cpp:
      (WebKit::npIdentifierFromIdentifier):
      * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
      (WebKit::NPRuntimeObjectMap::evaluate):
      (WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState):
      
      Source/WTF: 
      
      * wtf/Platform.h: Useless edit to force a full build. This is needed for some bots for some reason.
      * wtf/text/WTFString.h: Export a symbol that was exported on UString and needed in WebCore.
      
      Add String::getCharactersWithUpconvert<>(), which is similar to String::getCharacters<>() but with the same
      behaviors as UString::getCharacters<>().
      
      String::getCharactersWithUpconvert<>() is useful when manipulating multiple strings, it allow writting code
      using 16bits characters if any of the input String is not 8bit.
      
      Tools: 
      
      Get rid of UString.
      
      * DumpRenderTree/efl/WorkQueueItemEfl.cpp:
      * gdb/webkit.py:
      (WTFStringPrinter.to_string):
      (JSCIdentifierPrinter.to_string):
      (JSCJSStringPrinter.to_string):
      (add_pretty_printers):
      
      Websites/webkit.org: 
      
      Update the coding style to avoid mentioning a class that no longer exist.
      
      * coding/coding-style.html:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      cff06e46
  8. 06 Apr, 2012 1 commit
    • darin@apple.com's avatar
      Streamline strtod and fix some related problems · 9be7456e
      darin@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=82857
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore:
      
      * parser/Lexer.cpp:
      (JSC::Lexer<>::lex): Use parseDouble. Since we have already scanned the number
      and we know it has only correct characters, leading spaces, trailing junk, and
      trailing spaces are not a possibility. No need to add a trailing null character.
      
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::parseInt): Changed overflow based 10 case to use parseDouble. No need
      to allow trailing junk since the code above already allows only numeric digits
      in the string. This code path is used only in unusual cases, so it's not
      optimized for 8-bit strings, but easily could be.
      (JSC::jsStrDecimalLiteral): Removed the allow trailing junk argument to this
      function template because all the callers are OK with trailing junk. Use the
      parseDouble function. No need to copy the data into a byte buffer, because
      parseDouble handles that.
      (JSC::toDouble): Got rid of the DisallowTrailingJunk argument to the
      jsStrDecimalLiteral function template. That's OK because this function
      already checks for trailing junk and handles it appropriately. The old code
      path was doing it twice.
      (JSC::parseFloat): Got rid of the AllowTrailingJunk argument to the
      jsStrDecimalLiteral function template; the template allows junk unconditionally.
      
      * runtime/LiteralParser.cpp:
      (JSC::::Lexer::lexNumber): Use parseDouble. Since we have already scanned the number
      and we know it has only correct characters, leading spaces, trailing junk, and
      trailing spaces are not a possibility. No need to add a trailing null character.
      No need to copy the data into a byte buffer, because parseDouble handles that.
      We could optimize the UChar case even more because we know all the characters
      are ASCII, but not doing that at this time.
      
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Updated.
      
      Source/WebCore:
      
      Refactoring of code covered by existing tests.
      
      * dom/ViewportArguments.cpp:
      (WebCore::numericPrefix): Removed a confusing comment that just said
      "we tolerate extra characters" in a roundabout way. Made the "ok"
      argument optional. Changed to call the new version of charactersToFloat
      that returns the number of characters parsed rather than using the
      charactersToFloatIgnoringJunk/didReadNumber solution from before.
      (WebCore::findSizeValue): Since numericPrefix is guaranteed to return 0
      when it can't parse, removed the "ok" code. Also changed the unusual
      syntax "float(1.0)" to just "1", which works just as well.
      (WebCore::findScaleValue): Ditto.
      (WebCore::findUserScalableValue): Ditto.
      
      * html/parser/HTMLParserIdioms.cpp:
      (WebCore::parseToDoubleForNumberType): Removed an unneeded code path
      and replaced it with an assertion; toDouble no longer will return infinity
      or not-a-number values.
      
      Source/WTF:
      
      Replaced the strtod function template with a parseDouble function, eliminating
      the following unneeded features:
      
      - need for a trailing null character and a call to strlen
      - needless conversion of string lengths from size_t to int and back that created
        the possibility of incorrect truncation
      - one level of function call; use inlining instead
      - construction of the StringToDoubleConverter object; it was used to pass
        arguments that are known at compile time
      - most of the StringToDoubleConverter::StringToDouble function's body; it was
        code we did not need
      - parsing of Infinity and NaN at the strtod level; added recently when we moved
        from the old strtod to the new one, and not needed or helpful at this level
      - multiple copies of code to narrow to single byte strings; in many cases
        this was done even when starting with an LChar string that is already
        single-byte, now we handle this with an overload of parseDouble
      
      * wtf/dtoa.cpp:
      Removed a long comment about the original strtod function that no longer
      applies since we deleted that function long ago. Removed a lot of includes.
      Removed the strtod function templates and its instantiations, since they
      are now replaced by the parseDouble function.
      (WTF::Internal::parseDoubleFromLongString): Added.
      * wtf/dtoa.h:
      Added an include of ASCIICType.h so we can use isASCII in a function in this
      header. Left the heretofore unneeded include of double-conversion.h, since we
      now want to use it in a function in this header. Removed the AllowTrailingJunkTag
      and AllowTrailingSpacesTag enumerations and the strtod function template. Added
      new parseDouble function, and inline implementation of it.
      
      * wtf/dtoa/double-conversion.cc: Removed quite a bit of unused code, hardcoding
      all the StringToDouble function arguments that come from data members so it can
      be a much smaller static member function. Also changed the types of arguments
      from int to size_t.
      * wtf/dtoa/double-conversion.h: Removed most of the StringToDoubleConverter
      class, leaving only the conversion function as a static member function.
      
      * wtf/text/StringImpl.cpp:
      (WTF::StringImpl::toDouble): Got rid of didReadNumber.
      (WTF::StringImpl::toFloat): Ditto.
      * wtf/text/StringImpl.h: Ditto.
      * wtf/text/WTFString.cpp:
      (WTF::String::toDouble): Got rid of didReadNumber.
      (WTF::String::toFloat): Ditto.
      (WTF::toDoubleType): Rewrote this function to use parseDouble. Moved the code
      to skip leading spaces here, because other callers of parseDouble don't want
      to do that. Repurposed the check for an empty string so it's now the same
      code shared by all the "parsed nothing" cases. Removed the code to convert
      the buffer to ASCII for two reasons: (1) We don't need that code at all when
      CharType is LChar, and (2) We now handle this through the two overloads for
      the parseDouble function. Disallowing trailing junk is now handled here,
      rather than inside parseDouble.
      (WTF::charactersToDouble): Updated for changes to toDoubleType. Removed the
      didReadNumber argument.
      (WTF::charactersToFloat): Ditto. Also added overloads that return the parsed
      length. These are a slightly more powerful way to do what didReadNumber was
      used for before.
      
      * wtf/text/WTFString.h: Added comments, eliminated didReadNumber, and added
      overloads of charactersToFloat that replace charactersToFloatIgnoringJunk.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9be7456e
  9. 05 Apr, 2012 1 commit
    • oliver@apple.com's avatar
      Replace static_cast with jsCast when casting JSCell subclasses in JSC · 0c59caf6
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=83307
      
      Reviewed by Gavin Barraclough.
      
      Replace all usage of static_cast<JSCell subtype*> with jsCast<> in JavaScriptCore.
      This results in assertions when unsafe casts are performed, but simply leaves
      a static_cast<> in release builds.
      
      * API/APICast.h:
      (toJS):
      * API/JSCallbackConstructor.cpp:
      (JSC::constructJSCallback):
      * API/JSCallbackFunction.cpp:
      (JSC::JSCallbackFunction::call):
      * API/JSCallbackObjectFunctions.h:
      (JSC::::asCallbackObject):
      (JSC::::finishCreation):
      (JSC::::construct):
      (JSC::::call):
      * API/JSObjectRef.cpp:
      (JSObjectGetPrivate):
      (JSObjectSetPrivate):
      (JSObjectGetPrivateProperty):
      (JSObjectSetPrivateProperty):
      (JSObjectDeletePrivateProperty):
      * API/JSValueRef.cpp:
      (JSValueIsObjectOfClass):
      * API/JSWeakObjectMapRefPrivate.cpp:
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::BytecodeGenerator::resolve):
      (JSC::BytecodeGenerator::resolveConstDecl):
      * debugger/DebuggerActivation.cpp:
      (JSC::DebuggerActivation::finishCreation):
      * dfg/DFGOperations.cpp:
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::execute):
      (JSC::Interpreter::privateExecute):
      * jit/JITStubs.cpp:
      (JSC::DEFINE_STUB_FUNCTION):
      * runtime/Executable.h:
      (JSC::isHostFunction):
      * runtime/JSActivation.h:
      (JSC::asActivation):
      * runtime/JSArray.cpp:
      (JSC::JSArray::defineOwnProperty):
      * runtime/JSArray.h:
      (JSC::asArray):
      * runtime/JSBoundFunction.cpp:
      (JSC::boundFunctionCall):
      (JSC::boundFunctionConstruct):
      * runtime/JSByteArray.h:
      (JSC::asByteArray):
      * runtime/JSCell.cpp:
      (JSC::JSCell::toObject):
      * runtime/JSCell.h:
      (JSC::jsCast):
      * runtime/JSGlobalObject.h:
      (JSC::asGlobalObject):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
      * runtime/JSObject.cpp:
      (JSC::JSObject::setPrototypeWithCycleCheck):
      (JSC::JSObject::allowsAccessFrom):
      (JSC::JSObject::toThisObject):
      (JSC::JSObject::unwrappedObject):
      * runtime/JSObject.h:
      (JSC::asObject):
      * runtime/JSPropertyNameIterator.h:
      (JSC::Register::propertyNameIterator):
      * runtime/JSString.h:
      (JSC::asString):
      (JSC::JSValue::toString):
      * runtime/StringPrototype.cpp:
      (JSC::stringProtoFuncSubstr):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113363 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0c59caf6
  10. 13 Mar, 2012 1 commit
    • mhahnenberg@apple.com's avatar
      Type conversion of exponential part failed · 390efa9f
      mhahnenberg@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=80673
      
      Reviewed by Geoffrey Garen.
      
      * parser/Lexer.cpp:
      (JSC::::lex):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::parseInt):
      (JSC):
      (JSC::jsStrDecimalLiteral): Added another template argument that exposes whether or not
      we accept trailing junk to clients of jsStrDecimalLiteral. Also added additional template 
      parameter for strtod to allow trailing spaces.
      (JSC::toDouble):
      (JSC::parseFloat): Accept trailing junk, as per the ECMA 262 spec (15.1.2.3).
      * runtime/LiteralParser.cpp:
      (JSC::::Lexer::lexNumber):
      * tests/mozilla/expected.html: Update the expected page for run-javascriptcore-tests so that 
      we will run ecma/TypeConversion/9.3.1-3.js as a regression test now.
      * wtf/dtoa.cpp:
      (WTF):
      (WTF::strtod): We also needed to sometimes accept trailing spaces to pass a few other tests that were 
      broken by changing the default allowance of trailing junk in jsStrDecimalLiteral.
      * wtf/dtoa.h:
      * wtf/dtoa/double-conversion.cc: When the AdvanceToNonspace function was lifted out of the 
      Chromium codebase, the person porting it only thought to check for spaces when skipping whitespace.
      A few of our JSC tests check for other types of trailing whitespace, so I've added checks for those 
      here to cover those cases (horizontal tab, vertical tab, carriage return, form feed, and line feed).
      * wtf/text/WTFString.cpp:
      (WTF::toDoubleType): Disallow trailing spaces, as this breaks form input verification stuff.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@110657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      390efa9f
  11. 07 Mar, 2012 1 commit
    • eric@webkit.org's avatar
      Make WTF public headers use fully-qualified include paths and remove ForwardingHeaders/wtf · 3979f2d4
      eric@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=80363
      
      Reviewed by Mark Rowe.
      
      Source/JavaScriptCore:
      
      Historically WTF has been part of JavaScriptCore, and on Mac and Windows
      its headers have appeared as part of the "private" headers exported by
      JavaScriptCore.  All of the WTF headers there are "flattened" into a single
      private headers directory, and WebCore, WebKit and WebKit2 have used "ForwardingHeaders"
      to re-map fully-qualified <wtf/text/Foo.h> includes to simple <JavaScriptCore/Foo.h> includes.
      
      However, very soon, we are moving the WTF source code out of JavaScriptCore into its
      own directory and project.  As part of such, the WTF headers will no longer be part of
      the JavaScriptCore private interfaces.
      In preparation for that, this change makes both the Mac and Win builds export
      WTF headers in a non-flattened manner.  On Mac, that means into usr/local/include/wtf
      (and subdirectories), on Windows for now that means JavaScriptCore/wtf (and subdirectories).
      
      There are 5 parts to this change.
      1.  Updates the JavaScriptCore XCode and VCProj files to actually install these headers
          (and header directories) into the appropriate places in the build directory.
      2.  Updates JavaScriptCore.xcodeproj to look for these WTF headers in this install location
          (WebCore, WebKit, etc. had already been taught to look in previous patches).
      3.  Fixes all JavaScriptCore source files, and WTF headers to include WTF headers
          using fully qualified paths.
      4.  Stops the Mac and Win builds from installing these WTF headers in their old "flattened" location.
      5.  Removes WebCore and WebKit ForwardingHeaders/wtf directories now that the flattened headers no longer exist.
      
      Unfortunately we see no way to do this change in smaller parts, since all of these steps are interdependant.
      It is possible there are internal Apple projects which depend on JavaScriptCore/Foo.h working for WTF
      headers, those will have to be updated to use <wtf/Foo.h> after this change.
      I've discussed this proposed change at length with Mark Rowe, and my understanding is they
      are ready for (and interested in) this change happening.
      
      * API/tests/JSNode.c:
      * API/tests/JSNodeList.c:
      * Configurations/Base.xcconfig:
      * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * assembler/MacroAssemblerCodeRef.h:
      * bytecompiler/BytecodeGenerator.h:
      * dfg/DFGOperations.cpp:
      * heap/GCAssertions.h:
      * heap/HandleHeap.h:
      * heap/HandleStack.h:
      * heap/MarkedSpace.h:
      * heap/PassWeak.h:
      * heap/Strong.h:
      * heap/Weak.h:
      * jit/HostCallReturnValue.cpp:
      * jit/JIT.cpp:
      * jit/JITStubs.cpp:
      * jit/ThunkGenerators.cpp:
      * parser/Lexer.cpp:
      * runtime/Completion.cpp:
      * runtime/Executable.cpp:
      * runtime/Identifier.h:
      * runtime/InitializeThreading.cpp:
      * runtime/JSDateMath.cpp:
      * runtime/JSGlobalObjectFunctions.cpp:
      * runtime/JSStringBuilder.h:
      * runtime/JSVariableObject.h:
      * runtime/NumberPrototype.cpp:
      * runtime/WriteBarrier.h:
      * tools/CodeProfile.cpp:
      * tools/TieredMMapArray.h:
      * wtf/AVLTree.h:
      * wtf/Alignment.h:
      * wtf/AlwaysInline.h:
      * wtf/ArrayBufferView.h:
      * wtf/Assertions.h:
      * wtf/Atomics.h:
      * wtf/Bitmap.h:
      * wtf/BoundsCheckedPointer.h:
      * wtf/CheckedArithmetic.h:
      * wtf/Deque.h:
      * wtf/ExportMacros.h:
      * wtf/FastAllocBase.h:
      * wtf/FastMalloc.h:
      * wtf/Float32Array.h:
      * wtf/Float64Array.h:
      * wtf/Functional.h:
      * wtf/HashCountedSet.h:
      * wtf/HashFunctions.h:
      * wtf/HashMap.h:
      * wtf/HashSet.h:
      * wtf/HashTable.h:
      * wtf/HashTraits.h:
      * wtf/Int16Array.h:
      * wtf/Int32Array.h:
      * wtf/Int8Array.h:
      * wtf/IntegralTypedArrayBase.h:
      * wtf/ListHashSet.h:
      * wtf/MainThread.h:
      * wtf/MetaAllocator.h:
      * wtf/Noncopyable.h:
      * wtf/OwnArrayPtr.h:
      * wtf/OwnPtr.h:
      * wtf/PackedIntVector.h:
      * wtf/ParallelJobs.h:
      * wtf/PassOwnArrayPtr.h:
      * wtf/PassOwnPtr.h:
      * wtf/PassRefPtr.h:
      * wtf/PassTraits.h:
      * wtf/Platform.h:
      * wtf/PossiblyNull.h:
      * wtf/RefCounted.h:
      * wtf/RefCountedLeakCounter.h:
      * wtf/RefPtr.h:
      * wtf/RetainPtr.h:
      * wtf/SimpleStats.h:
      * wtf/Spectrum.h:
      * wtf/StdLibExtras.h:
      * wtf/TCPageMap.h:
      * wtf/TemporaryChange.h:
      * wtf/ThreadSafeRefCounted.h:
      * wtf/Threading.h:
      * wtf/ThreadingPrimitives.h:
      * wtf/TypeTraits.h:
      * wtf/TypedArrayBase.h:
      * wtf/Uint16Array.h:
      * wtf/Uint32Array.h:
      * wtf/Uint8Array.h:
      * wtf/Uint8ClampedArray.h:
      * wtf/UnusedParam.h:
      * wtf/Vector.h:
      * wtf/VectorTraits.h:
      * wtf/dtoa/double-conversion.h:
      * wtf/dtoa/utils.h:
      * wtf/gobject/GRefPtr.h:
      * wtf/gobject/GlibUtilities.h:
      * wtf/text/AtomicString.h:
      * wtf/text/AtomicStringImpl.h:
      * wtf/text/CString.h:
      * wtf/text/StringConcatenate.h:
      * wtf/text/StringHash.h:
      * wtf/text/WTFString.h:
      * wtf/unicode/CharacterNames.h:
      * wtf/unicode/UTF8.h:
      * wtf/unicode/glib/UnicodeGLib.h:
      * wtf/unicode/qt4/UnicodeQt4.h:
      * wtf/unicode/wince/UnicodeWinCE.h:
      * wtf/url/api/ParsedURL.h:
      * wtf/url/api/URLString.h:
      * wtf/wince/FastMallocWinCE.h:
      * yarr/YarrJIT.cpp:
      
      Source/WebCore:
      
      ForwardingHeaders/wtf is no longer needed (or functional) now that
      JavaScriptCore no longer includes the WTF headers as private headers.
      
      * DerivedSources.make:
      * ForwardingHeaders/wtf/ASCIICType.h: Removed.
      * ForwardingHeaders/wtf/AVLTree.h: Removed.
      * ForwardingHeaders/wtf/Alignment.h: Removed.
      * ForwardingHeaders/wtf/AlwaysInline.h: Removed.
      * ForwardingHeaders/wtf/ArrayBuffer.h: Removed.
      * ForwardingHeaders/wtf/ArrayBufferView.h: Removed.
      * ForwardingHeaders/wtf/Assertions.h: Removed.
      * ForwardingHeaders/wtf/Atomics.h: Removed.
      * ForwardingHeaders/wtf/Bitmap.h: Removed.
      * ForwardingHeaders/wtf/BloomFilter.h: Removed.
      * ForwardingHeaders/wtf/BumpPointerAllocator.h: Removed.
      * ForwardingHeaders/wtf/ByteArray.h: Removed.
      * ForwardingHeaders/wtf/CheckedArithmetic.h: Removed.
      * ForwardingHeaders/wtf/CheckedBoolean.h: Removed.
      * ForwardingHeaders/wtf/Compiler.h: Removed.
      * ForwardingHeaders/wtf/Complex.h: Removed.
      * ForwardingHeaders/wtf/CryptographicallyRandomNumber.h: Removed.
      * ForwardingHeaders/wtf/CurrentTime.h: Removed.
      * ForwardingHeaders/wtf/DataLog.h: Removed.
      * ForwardingHeaders/wtf/DateInstanceCache.h: Removed.
      * ForwardingHeaders/wtf/DateMath.h: Removed.
      * ForwardingHeaders/wtf/DecimalNumber.h: Removed.
      * ForwardingHeaders/wtf/Decoder.h: Removed.
      * ForwardingHeaders/wtf/Deque.h: Removed.
      * ForwardingHeaders/wtf/DisallowCType.h: Removed.
      * ForwardingHeaders/wtf/DoublyLinkedList.h: Removed.
      * ForwardingHeaders/wtf/DynamicAnnotations.h: Removed.
      * ForwardingHeaders/wtf/Encoder.h: Removed.
      * ForwardingHeaders/wtf/ExportMacros.h: Removed.
      * ForwardingHeaders/wtf/FastAllocBase.h: Removed.
      * ForwardingHeaders/wtf/FastMalloc.h: Removed.
      * ForwardingHeaders/wtf/FixedArray.h: Removed.
      * ForwardingHeaders/wtf/Float32Array.h: Removed.
      * ForwardingHeaders/wtf/Float64Array.h: Removed.
      * ForwardingHeaders/wtf/Forward.h: Removed.
      * ForwardingHeaders/wtf/Functional.h: Removed.
      * ForwardingHeaders/wtf/GetPtr.h: Removed.
      * ForwardingHeaders/wtf/HashCountedSet.h: Removed.
      * ForwardingHeaders/wtf/HashFunctions.h: Removed.
      * ForwardingHeaders/wtf/HashMap.h: Removed.
      * ForwardingHeaders/wtf/HashSet.h: Removed.
      * ForwardingHeaders/wtf/HashTable.h: Removed.
      * ForwardingHeaders/wtf/HashTraits.h: Removed.
      * ForwardingHeaders/wtf/HexNumber.h: Removed.
      * ForwardingHeaders/wtf/Int16Array.h: Removed.
      * ForwardingHeaders/wtf/Int32Array.h: Removed.
      * ForwardingHeaders/wtf/Int8Array.h: Removed.
      * ForwardingHeaders/wtf/ListHashSet.h: Removed.
      * ForwardingHeaders/wtf/ListRefPtr.h: Removed.
      * ForwardingHeaders/wtf/Locker.h: Removed.
      * ForwardingHeaders/wtf/MD5.h: Removed.
      * ForwardingHeaders/wtf/MainThread.h: Removed.
      * ForwardingHeaders/wtf/MathExtras.h: Removed.
      * ForwardingHeaders/wtf/MessageQueue.h: Removed.
      * ForwardingHeaders/wtf/MetaAllocator.h: Removed.
      * ForwardingHeaders/wtf/MetaAllocatorHandle.h: Removed.
      * ForwardingHeaders/wtf/NonCopyingSort.h: Removed.
      * ForwardingHeaders/wtf/Noncopyable.h: Removed.
      * ForwardingHeaders/wtf/NotFound.h: Removed.
      * ForwardingHeaders/wtf/OSAllocator.h: Removed.
      * ForwardingHeaders/wtf/OwnArrayPtr.h: Removed.
      * ForwardingHeaders/wtf/OwnPtr.h: Removed.
      * ForwardingHeaders/wtf/OwnPtrCommon.h: Removed.
      * ForwardingHeaders/wtf/PageAllocation.h: Removed.
      * ForwardingHeaders/wtf/PageAllocationAligned.h: Removed.
      * ForwardingHeaders/wtf/PageBlock.h: Removed.
      * ForwardingHeaders/wtf/PageReservation.h: Removed.
      * ForwardingHeaders/wtf/ParallelJobs.h: Removed.
      * ForwardingHeaders/wtf/PassOwnArrayPtr.h: Removed.
      * ForwardingHeaders/wtf/PassOwnPtr.h: Removed.
      * ForwardingHeaders/wtf/PassRefPtr.h: Removed.
      * ForwardingHeaders/wtf/Platform.h: Removed.
      * ForwardingHeaders/wtf/PossiblyNull.h: Removed.
      * ForwardingHeaders/wtf/RandomNumber.h: Removed.
      * ForwardingHeaders/wtf/RedBlackTree.h: Removed.
      * ForwardingHeaders/wtf/RefCounted.h: Removed.
      * ForwardingHeaders/wtf/RefCountedLeakCounter.h: Removed.
      * ForwardingHeaders/wtf/RefPtr.h: Removed.
      * ForwardingHeaders/wtf/RetainPtr.h: Removed.
      * ForwardingHeaders/wtf/SHA1.h: Removed.
      * ForwardingHeaders/wtf/SegmentedVector.h: Removed.
      * ForwardingHeaders/wtf/SimpleStats.h: Removed.
      * ForwardingHeaders/wtf/Spectrum.h: Removed.
      * ForwardingHeaders/wtf/StackBounds.h: Removed.
      * ForwardingHeaders/wtf/StaticConstructors.h: Removed.
      * ForwardingHeaders/wtf/StdLibExtras.h: Removed.
      * ForwardingHeaders/wtf/StringExtras.h: Removed.
      * ForwardingHeaders/wtf/StringHasher.h: Removed.
      * ForwardingHeaders/wtf/TemporaryChange.h: Removed.
      * ForwardingHeaders/wtf/ThreadRestrictionVerifier.h: Removed.
      * ForwardingHeaders/wtf/ThreadSafeRefCounted.h: Removed.
      * ForwardingHeaders/wtf/ThreadSpecific.h: Removed.
      * ForwardingHeaders/wtf/Threading.h: Removed.
      * ForwardingHeaders/wtf/ThreadingPrimitives.h: Removed.
      * ForwardingHeaders/wtf/TypeTraits.h: Removed.
      * ForwardingHeaders/wtf/Uint16Array.h: Removed.
      * ForwardingHeaders/wtf/Uint32Array.h: Removed.
      * ForwardingHeaders/wtf/Uint8Array.h: Removed.
      * ForwardingHeaders/wtf/Uint8ClampedArray.h: Removed.
      * ForwardingHeaders/wtf/UnusedParam.h: Removed.
      * ForwardingHeaders/wtf/VMTags.h: Removed.
      * ForwardingHeaders/wtf/ValueCheck.h: Removed.
      * ForwardingHeaders/wtf/Vector.h: Removed.
      * ForwardingHeaders/wtf/VectorTraits.h: Removed.
      * ForwardingHeaders/wtf/WTFThreadData.h: Removed.
      * ForwardingHeaders/wtf/dtoa.h: Removed.
      * ForwardingHeaders/wtf/dtoa/double-conversion.h: Removed.
      * ForwardingHeaders/wtf/text/ASCIIFastPath.h: Removed.
      * ForwardingHeaders/wtf/text/AtomicString.h: Removed.
      * ForwardingHeaders/wtf/text/AtomicStringHash.h: Removed.
      * ForwardingHeaders/wtf/text/AtomicStringImpl.h: Removed.
      * ForwardingHeaders/wtf/text/CString.h: Removed.
      * ForwardingHeaders/wtf/text/StringBuffer.h: Removed.
      * ForwardingHeaders/wtf/text/StringBuilder.h: Removed.
      * ForwardingHeaders/wtf/text/StringConcatenate.h: Removed.
      * ForwardingHeaders/wtf/text/StringHash.h: Removed.
      * ForwardingHeaders/wtf/text/StringImpl.h: Removed.
      * ForwardingHeaders/wtf/text/TextPosition.h: Removed.
      * ForwardingHeaders/wtf/text/WTFString.h: Removed.
      * ForwardingHeaders/wtf/unicode/CharacterNames.h: Removed.
      * ForwardingHeaders/wtf/unicode/Collator.h: Removed.
      * ForwardingHeaders/wtf/unicode/UTF8.h: Removed.
      * ForwardingHeaders/wtf/unicode/Unicode.h: Removed.
      * ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h: Removed.
      * ForwardingHeaders/wtf/unicode/wince/UnicodeWince.h: Removed.
      * ForwardingHeaders/wtf/url/ParsedURL.h: Removed.
      
      Source/WebKit/mac:
      
      ForwardingHeaders/wtf is no longer necessary (or functional) now that JavaScriptCore
      no longer includes the WTF headers as private headers.
      
      * ForwardingHeaders/wtf/ASCIICType.h: Removed.
      * ForwardingHeaders/wtf/AlwaysInline.h: Removed.
      * ForwardingHeaders/wtf/Assertions.h: Removed.
      * ForwardingHeaders/wtf/Deque.h: Removed.
      * ForwardingHeaders/wtf/DisallowCType.h: Removed.
      * ForwardingHeaders/wtf/FastMalloc.h: Removed.
      * ForwardingHeaders/wtf/Forward.h: Removed.
      * ForwardingHeaders/wtf/GetPtr.h: Removed.
      * ForwardingHeaders/wtf/HashCountedSet.h: Removed.
      * ForwardingHeaders/wtf/HashMap.h: Removed.
      * ForwardingHeaders/wtf/HashSet.h: Removed.
      * ForwardingHeaders/wtf/HashTraits.h: Removed.
      * ForwardingHeaders/wtf/ListHashSet.h: Removed.
      * ForwardingHeaders/wtf/ListRefPtr.h: Removed.
      * ForwardingHeaders/wtf/Locker.h: Removed.
      * ForwardingHeaders/wtf/MathExtras.h: Removed.
      * ForwardingHeaders/wtf/Noncopyable.h: Removed.
      * ForwardingHeaders/wtf/OwnArrayPtr.h: Removed.
      * ForwardingHeaders/wtf/OwnPtr.h: Removed.
      * ForwardingHeaders/wtf/OwnPtrCommon.h: Removed.
      * ForwardingHeaders/wtf/PassOwnPtr.h: Removed.
      * ForwardingHeaders/wtf/PassRefPtr.h: Removed.
      * ForwardingHeaders/wtf/Platform.h: Removed.
      * ForwardingHeaders/wtf/RefCounted.h: Removed.
      * ForwardingHeaders/wtf/RefCountedLeakCounter.h: Removed.
      * ForwardingHeaders/wtf/RefPtr.h: Removed.
      * ForwardingHeaders/wtf/RetainPtr.h: Removed.
      * ForwardingHeaders/wtf/StdLibExtras.h: Removed.
      * ForwardingHeaders/wtf/TemporaryChange.h: Removed.
      * ForwardingHeaders/wtf/Threading.h: Removed.
      * ForwardingHeaders/wtf/UnusedParam.h: Removed.
      * ForwardingHeaders/wtf/VMTags.h: Removed.
      * ForwardingHeaders/wtf/ValueCheck.h: Removed.
      * ForwardingHeaders/wtf/Vector.h: Removed.
      * ForwardingHeaders/wtf/VectorTraits.h: Removed.
      * ForwardingHeaders/wtf/unicode/Unicode.h: Removed.
      * ForwardingHeaders/wtf/unicode/icu/UnicodeIcu.h: Removed.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@110033 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      3979f2d4
  12. 06 Mar, 2012 1 commit
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r109837. · cbcd594c
      commit-queue@webkit.org authored
      http://trac.webkit.org/changeset/109837
      https://bugs.webkit.org/show_bug.cgi?id=80399
      
      breaks Mac Productions builds, too late to try and fix it
      tonight (Requested by eseidel on #webkit).
      
      Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-03-06
      
      Source/JavaScriptCore:
      
      * API/tests/JSNode.c:
      * API/tests/JSNodeList.c:
      * Configurations/Base.xcconfig:
      * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * assembler/MacroAssemblerCodeRef.h:
      * bytecompiler/BytecodeGenerator.h:
      * dfg/DFGOperations.cpp:
      * heap/GCAssertions.h:
      * heap/HandleHeap.h:
      * heap/HandleStack.h:
      * heap/MarkedSpace.h:
      * heap/PassWeak.h:
      * heap/Strong.h:
      * heap/Weak.h:
      * jit/HostCallReturnValue.cpp:
      * jit/JIT.cpp:
      * jit/JITStubs.cpp:
      * jit/ThunkGenerators.cpp:
      * parser/Lexer.cpp:
      * runtime/Completion.cpp:
      * runtime/Executable.cpp:
      * runtime/Identifier.h:
      * runtime/InitializeThreading.cpp:
      * runtime/JSDateMath.cpp:
      * runtime/JSGlobalObjectFunctions.cpp:
      * runtime/JSStringBuilder.h:
      * runtime/JSVariableObject.h:
      * runtime/NumberPrototype.cpp:
      * runtime/WriteBarrier.h:
      * tools/CodeProfile.cpp:
      * tools/TieredMMapArray.h:
      * yarr/YarrJIT.cpp:
      
      Tools:
      
      * Scripts/build-webkit:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      cbcd594c
  13. 05 Mar, 2012 1 commit
    • eric@webkit.org's avatar
      Source/JavaScriptCore: Update JavaScriptCore files to use fully-qualified WTF include paths · 37ac49ee
      eric@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=79960
      
      Reviewed by Adam Barth.
      
      This change does 5 small/related things:
       1. Updates JavaScriptCore.xcodeproj to install WTF headers into $BUILD/usr/local/include
          (WebCore, WebKit were already setup to look there, but JavaScriptCore.xcodeproj
          was not installing headers there.)
       2. Makes JavaScriptCore targets include $BUILD/usr/local/include in their
          header search path, as that's where the WTF headers will be installed.
       3. Similarly updates JavaScriptCore.vcproj/copy-files.cmd to copy WTF headers to PrivateHeaders/wtf/*
          in addition to the current behavior of flattening all headers to PrivateHeaders/*.h.
       4. Updates a bunch of JSC files to use #include <wtf/Foo.h> instead of #include "Foo.h"
          since soon the WTF headers will not be part of the JavaScriptCore Xcode project.
       5. Makes build-webkit build the WTF XCode project by default.
      
      * API/tests/JSNode.c:
      * API/tests/JSNodeList.c:
      * Configurations/Base.xcconfig:
      * assembler/MacroAssemblerCodeRef.h:
      * bytecompiler/BytecodeGenerator.h:
      * dfg/DFGOperations.cpp:
      * heap/GCAssertions.h:
      * heap/HandleHeap.h:
      * heap/HandleStack.h:
      * heap/MarkedSpace.h:
      * heap/PassWeak.h:
      * heap/Strong.h:
      * heap/Weak.h:
      * jit/HostCallReturnValue.cpp:
      * jit/JIT.cpp:
      * jit/JITStubs.cpp:
      * jit/ThunkGenerators.cpp:
      * parser/Lexer.cpp:
      * runtime/Completion.cpp:
      * runtime/Executable.cpp:
      * runtime/Identifier.h:
      * runtime/InitializeThreading.cpp:
      * runtime/JSDateMath.cpp:
      * runtime/JSGlobalObjectFunctions.cpp:
      * runtime/JSStringBuilder.h:
      * runtime/JSVariableObject.h:
      * runtime/NumberPrototype.cpp:
      * runtime/WriteBarrier.h:
      * tools/CodeProfile.cpp:
      * tools/TieredMMapArray.h:
      * yarr/YarrJIT.cpp:
      
      Tools: Update JavaScriptCore files to use fully-qualified WTF include path
      https://bugs.webkit.org/show_bug.cgi?id=79960
      
      Reviewed by Adam Barth.
      
      Build WTF/WTF.xcodeproj by default on Mac.
      
      * Scripts/build-webkit:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      37ac49ee
  14. 20 Feb, 2012 1 commit
    • barraclough@apple.com's avatar
      Move special __proto__ property to Object.prototype · 4f5c0c0f
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=78409
      
      Reviewed by Oliver Hunt.
      
      Re-implement this as a regular accessor property.  This has three key benefits:
      1) It makes it possible for objects to be given properties named __proto__.
      2) Object.prototype.__proto__ can be deleted, preventing object prototypes from being changed.
      3) This largely removes the magic used the implement __proto__, it can just be made a regular accessor property.
      
      Source/JavaScriptCore: 
      
      * parser/Parser.cpp:
      (JSC::::parseFunctionInfo):
          - No need to prohibit functions named __proto__.
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
          - Add __proto__ accessor to Object.prototype.
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncProtoGetter):
      (JSC::globalFuncProtoSetter):
          - Definition of the __proto__ accessor functions.
      * runtime/JSGlobalObjectFunctions.h:
          - Declaration of the __proto__ accessor functions.
      * runtime/JSObject.cpp:
      (JSC::JSObject::put):
          - Remove the special handling for __proto__, there is still a check to allow for a fast guard for accessors excluding __proto__.
      (JSC::JSObject::putDirectAccessor):
          - Track on the structure whether an object contains accessors other than one for __proto__.
      (JSC::JSObject::defineOwnProperty):
          - No need to prohibit definition of own properties named __proto__.
      * runtime/JSObject.h:
      (JSC::JSObject::inlineGetOwnPropertySlot):
          - Remove the special handling for __proto__.
      (JSC::JSValue::get):
          - Remove the special handling for __proto__.
      * runtime/JSString.cpp:
      (JSC::JSString::getOwnPropertySlot):
          - Remove the special handling for __proto__.
      * runtime/JSValue.h:
      (JSValue):
          - Made synthesizePrototype public (this may be needed by the __proto__ getter).
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorGetPrototypeOf):
          - Perform the security check & call prototype() directly.
      * runtime/Structure.cpp:
      (JSC::Structure::Structure):
          - Added 'ExcludingProto' variant of the 'hasGetterSetterProperties' state.
      * runtime/Structure.h:
      (JSC::Structure::hasGetterSetterPropertiesExcludingProto):
      (JSC::Structure::setHasGetterSetterProperties):
      (Structure):
          - Added 'ExcludingProto' variant of the 'hasGetterSetterProperties' state.
      
      Source/WebCore: 
      
      * bindings/js/JSDOMWindowBase.cpp:
      (WebCore::JSDOMWindowBase::allowsAccessFrom):
      (WebCore):
          - expose allowsAccessFrom check to JSC.
      * bindings/js/JSDOMWindowBase.h:
      (JSDOMWindowBase):
          - expose allowsAccessFrom check to JSC.
      
      LayoutTests: 
      
      * fast/js/Object-getOwnPropertyNames-expected.txt:
      * fast/js/cyclic-prototypes-expected.txt:
      * fast/js/parser-syntax-check-expected.txt:
      * fast/js/preventExtensions-expected.txt:
      * fast/js/prototypes-expected.txt:
          - Update results
      * fast/js/script-tests/Object-getOwnPropertyNames.js:
          - __proto__ is now a property of Object Prototype.
      * fast/js/script-tests/cyclic-prototypes.js:
          - setting an object's prototype to null removes __proto__ setter, future usage won't set prototype.
      * fast/js/script-tests/parser-syntax-check.js:
          - Allow functions named __proto__
      * fast/js/script-tests/preventExtensions.js:
          - Setting __proto__ should not throw.
      * fast/js/script-tests/prototypes.js:
          - Objects may contained own properties named __proto__, add new test cases.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108259 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4f5c0c0f
  15. 13 Feb, 2012 2 commits
    • mhahnenberg@apple.com's avatar
      Replace old strtod with new strtod · 7b69a48f
      mhahnenberg@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=68044
      
      Reviewed by Geoffrey Garen.
      
      * parser/Lexer.cpp: Added template argument. This version allows junk after numbers.
      (JSC::::lex):
      * runtime/JSGlobalObjectFunctions.cpp: Ditto.
      (JSC::parseInt):
      (JSC::jsStrDecimalLiteral):
      * runtime/LiteralParser.cpp: Ditto.
      (JSC::::Lexer::lexNumber):
      * wtf/dtoa.cpp: Replaced old strtod with a new version that uses the new StringToDoubleConverter.
      It takes a template argument to allow clients to determine statically whether it should allow 
      junk after the numbers or not.
      (WTF):
      (WTF::strtod):
      * wtf/dtoa.h:
      (WTF):
      * wtf/text/WTFString.cpp: Added template argument. This version does not allow junk after numbers.
      (WTF::toDoubleType):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7b69a48f
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=78434 · 2441d33f
      barraclough@apple.com authored
      Unreviewed - temporarily reverting r107498 will I fix a couple of testcases.
      
      Source/JavaScriptCore: 
      
      * parser/Parser.cpp:
      (JSC::::parseFunctionInfo):
      * runtime/ClassInfo.h:
      (MethodTable):
      (JSC):
      * runtime/JSCell.cpp:
      (JSC):
      * runtime/JSCell.h:
      (JSCell):
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC):
      * runtime/JSGlobalObjectFunctions.h:
      (JSC):
      * runtime/JSObject.cpp:
      (JSC::JSObject::put):
      (JSC):
      (JSC::JSObject::putDirectAccessor):
      (JSC::JSObject::defineOwnProperty):
      * runtime/JSObject.h:
      (JSC::JSObject::inlineGetOwnPropertySlot):
      (JSC::JSValue::get):
      * runtime/JSString.cpp:
      (JSC::JSString::getOwnPropertySlot):
      * runtime/JSValue.h:
      (JSValue):
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorGetPrototypeOf):
      * runtime/Structure.cpp:
      (JSC::Structure::Structure):
      * runtime/Structure.h:
      (JSC::Structure::setHasGetterSetterProperties):
      (Structure):
      
      Source/WebCore: 
      
      * bindings/js/JSDOMWindowBase.cpp:
      (WebCore):
      * bindings/js/JSDOMWindowBase.h:
      (JSDOMWindowBase):
      
      LayoutTests: 
      
      * fast/js/Object-getOwnPropertyNames-expected.txt:
      * fast/js/cyclic-prototypes-expected.txt:
      * fast/js/parser-syntax-check-expected.txt:
      * fast/js/preventExtensions-expected.txt:
      * fast/js/prototypes-expected.txt:
      * fast/js/script-tests/Object-getOwnPropertyNames.js:
      * fast/js/script-tests/cyclic-prototypes.js:
      * fast/js/script-tests/parser-syntax-check.js:
      * fast/js/script-tests/preventExtensions.js:
      * fast/js/script-tests/prototypes.js:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2441d33f
  16. 11 Feb, 2012 1 commit
    • barraclough@apple.com's avatar
      Move special __proto__ property to Object.prototype · 1b59d1e9
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=78409
      
      Reviewed by Oliver Hunt.
      
      Re-implement this as a regular accessor property.  This has three key benefits:
      1) It makes it possible for objects to be given properties named __proto__.
      2) Object.prototype.__proto__ can be deleted, preventing object prototypes from being changed.
      3) This largely removes the magic used the implement __proto__, it can just be made a regular accessor property.
      
      Source/JavaScriptCore: 
      
      * parser/Parser.cpp:
      (JSC::::parseFunctionInfo):
          - No need to prohibit functions named __proto__.
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
          - Add __proto__ accessor to Object.prototype.
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncProtoGetter):
      (JSC::globalFuncProtoSetter):
          - Definition of the __proto__ accessor functions.
      * runtime/JSGlobalObjectFunctions.h:
          - Declaration of the __proto__ accessor functions.
      * runtime/JSObject.cpp:
      (JSC::JSObject::put):
          - Remove the special handling for __proto__, there is still a check to allow for a fast guard for accessors excluding __proto__.
      (JSC::JSObject::putDirectAccessor):
          - Track on the structure whether an object contains accessors other than one for __proto__.
      (JSC::JSObject::defineOwnProperty):
          - No need to prohibit definition of own properties named __proto__.
      * runtime/JSObject.h:
      (JSC::JSObject::inlineGetOwnPropertySlot):
          - Remove the special handling for __proto__.
      (JSC::JSValue::get):
          - Remove the special handling for __proto__.
      * runtime/JSString.cpp:
      (JSC::JSString::getOwnPropertySlot):
          - Remove the special handling for __proto__.
      * runtime/JSValue.h:
      (JSValue):
          - Made synthesizePrototype public (this may be needed by the __proto__ getter).
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorGetPrototypeOf):
          - Perform the security check & call prototype() directly.
      * runtime/Structure.cpp:
      (JSC::Structure::Structure):
          - Added 'ExcludingProto' variant of the 'hasGetterSetterProperties' state.
      * runtime/Structure.h:
      (JSC::Structure::hasGetterSetterPropertiesExcludingProto):
      (JSC::Structure::setHasGetterSetterProperties):
      (Structure):
          - Added 'ExcludingProto' variant of the 'hasGetterSetterProperties' state.
      
      Source/WebCore: 
      
      * bindings/js/JSDOMWindowBase.cpp:
      (WebCore::JSDOMWindowBase::allowsAccessFrom):
      (WebCore):
          - expose allowsAccessFrom check to JSC.
      * bindings/js/JSDOMWindowBase.h:
      (JSDOMWindowBase):
          - expose allowsAccessFrom check to JSC.
      
      LayoutTests: 
      
      * fast/js/Object-getOwnPropertyNames-expected.txt:
      * fast/js/cyclic-prototypes-expected.txt:
      * fast/js/parser-syntax-check-expected.txt:
      * fast/js/preventExtensions-expected.txt:
      * fast/js/prototypes-expected.txt:
          - Update results
      * fast/js/script-tests/Object-getOwnPropertyNames.js:
          - __proto__ is now a property of Object Prototype.
      * fast/js/script-tests/cyclic-prototypes.js:
          - setting an object's prototype to null removes __proto__ setter, future usage won't set prototype.
      * fast/js/script-tests/parser-syntax-check.js:
          - Allow functions named __proto__
      * fast/js/script-tests/preventExtensions.js:
          - Setting __proto__ should not throw.
      * fast/js/script-tests/prototypes.js:
          - Objects may contained own properties named __proto__, add new test cases.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1b59d1e9
  17. 24 Jan, 2012 1 commit
    • ggaren@apple.com's avatar
      JSValue::toString() should return a JSString* instead of a UString · 64be5e90
      ggaren@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=76861
      
      ../JavaScriptCore: 
      
      Reviewed by Gavin Barraclough.
              
      This makes the common case -- toString() on a string -- faster and
      inline-able. (Not a measureable speedup, but we can now remove a bunch
      of duplicate hand-rolled code for this optimization.)
              
      This also clarifies the boundary between "C++ strings" and "JS strings".
              
      In all cases other than true, false, null, undefined, and multi-digit
      numbers, the JS runtime was just retrieving a UString from a JSString,
      so returning a JSString* is strictly better. In the other cases, we can
      optimize to avoid creating a new JSString if we care to, but it doesn't
      seem to be a big deal.
      
      * JavaScriptCore.exp: Export!
              
      * jsc.cpp:
      (functionPrint):
      (functionDebug):
      (functionRun):
      (functionLoad):
      (functionCheckSyntax):
      (runWithScripts):
      (runInteractive):
      * API/JSValueRef.cpp:
      (JSValueToStringCopy):
      * bytecode/CodeBlock.cpp:
      (JSC::valueToSourceString): Call value() after calling toString(), to
      convert from "JS string" (JSString*) to "C++ string" (UString), since
      toString() no longer returns a "C++ string".
      
      * dfg/DFGOperations.cpp:
      (JSC::DFG::operationValueAddNotNumber):
      * jit/JITStubs.cpp:
      (op_add): Updated for removal of toPrimitiveString():
      all '+' operands can use toString(), except for object operands, which
      need to take a slow path to call toPrimitive().
      
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncToString):
      (JSC::arrayProtoFuncToLocaleString):
      (JSC::arrayProtoFuncJoin):
      (JSC::arrayProtoFuncPush):
      * runtime/CommonSlowPaths.h:
      (JSC::CommonSlowPaths::opIn):
      * runtime/DateConstructor.cpp:
      (JSC::dateParse):
      * runtime/DatePrototype.cpp:
      (JSC::formatLocaleDate): Call value() after calling toString(), as above.
      
      * runtime/ErrorInstance.h:
      (JSC::ErrorInstance::create): Simplified down to one canonical create()
      function, to make string handling easier.
      
      * runtime/ErrorPrototype.cpp:
      (JSC::errorProtoFuncToString):
      * runtime/ExceptionHelpers.cpp:
      (JSC::createInvalidParamError):
      (JSC::createNotAConstructorError):
      (JSC::createNotAFunctionError):
      (JSC::createNotAnObjectError):
      * runtime/FunctionConstructor.cpp:
      (JSC::constructFunctionSkippingEvalEnabledCheck):
      * runtime/FunctionPrototype.cpp:
      (JSC::functionProtoFuncBind):
      * runtime/JSArray.cpp:
      (JSC::JSArray::sort): Call value() after calling toString(), as above.
      
      * runtime/JSCell.cpp:
      * runtime/JSCell.h: Removed JSCell::toString() because JSValue does this
      job now. Doing it in JSCell is slower (requires extra type checking), and
      creates the misimpression that language-defined toString() behavior is
      an implementation detail of JSCell.
              
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::encode):
      (JSC::decode):
      (JSC::globalFuncEval):
      (JSC::globalFuncParseInt):
      (JSC::globalFuncParseFloat):
      (JSC::globalFuncEscape):
      (JSC::globalFuncUnescape): Call value() after calling toString(), as above.
      
      * runtime/JSONObject.cpp:
      (JSC::unwrapBoxedPrimitive):
      (JSC::Stringifier::Stringifier):
      (JSC::JSONProtoFuncParse): Removed some manual optimization that toString()
      takes care of.
      
      * runtime/JSObject.cpp:
      (JSC::JSObject::toString):
      * runtime/JSObject.h: Updated to return JSString*.
      
      * runtime/JSString.cpp:
      * runtime/JSString.h:
      (JSC::JSValue::toString): Removed, since I removed JSCell::toString().
      
      * runtime/JSValue.cpp:
      (JSC::JSValue::toStringSlowCase): Removed toPrimitiveString(), and re-
      spawned toStringSlowCase() from its zombie corpse, since toPrimitiveString()
      basically did what we want all the time. (Note that the toPrimitive()
      preference changes from NoPreference to PreferString, because that's
      how ToString is defined in the language. op_add does not want this behavior.)
      
      * runtime/NumberPrototype.cpp:
      (JSC::numberProtoFuncToString):
      (JSC::numberProtoFuncToLocaleString): A little simpler, now that toString()
      returns a JSString*.
      
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorGetOwnPropertyDescriptor):
      (JSC::objectConstructorDefineProperty):
      * runtime/ObjectPrototype.cpp:
      (JSC::objectProtoFuncHasOwnProperty):
      (JSC::objectProtoFuncDefineGetter):
      (JSC::objectProtoFuncDefineSetter):
      (JSC::objectProtoFuncLookupGetter):
      (JSC::objectProtoFuncLookupSetter):
      (JSC::objectProtoFuncPropertyIsEnumerable): More calls to value(), as above.
      
      * runtime/Operations.cpp:
      (JSC::jsAddSlowCase): Need to check for object before taking the toString()
      fast path becuase adding an object to a string requires calling toPrimitive()
      on the object, not toString(). (They differ in their preferred conversion
      type.)
      
      * runtime/Operations.h:
      (JSC::jsString):
      (JSC::jsStringFromArguments): This code gets simpler, now that toString()
      does the right thing.
      
      (JSC::jsAdd): Now checks for object, just like jsAddSlowCase().
      
      * runtime/RegExpConstructor.cpp:
      (JSC::setRegExpConstructorInput):
      (JSC::constructRegExp):
      * runtime/RegExpObject.cpp:
      (JSC::RegExpObject::match):
      * runtime/RegExpPrototype.cpp:
      (JSC::regExpProtoFuncCompile):
      (JSC::regExpProtoFuncToString): More calls to value(), as above.
      
      * runtime/StringConstructor.cpp:
      (JSC::constructWithStringConstructor):
      (JSC::callStringConstructor): This code gets simpler, now that toString()
      does the right thing.
      
      * runtime/StringPrototype.cpp:
      (JSC::replaceUsingRegExpSearch):
      (JSC::replaceUsingStringSearch):
      (JSC::stringProtoFuncReplace):
      (JSC::stringProtoFuncCharAt):
      (JSC::stringProtoFuncCharCodeAt):
      (JSC::stringProtoFuncConcat):
      (JSC::stringProtoFuncIndexOf):
      (JSC::stringProtoFuncLastIndexOf):
      (JSC::stringProtoFuncMatch):
      (JSC::stringProtoFuncSearch):
      (JSC::stringProtoFuncSlice):
      (JSC::stringProtoFuncSplit):
      (JSC::stringProtoFuncSubstr):
      (JSC::stringProtoFuncSubstring):
      (JSC::stringProtoFuncToLowerCase):
      (JSC::stringProtoFuncToUpperCase):
      (JSC::stringProtoFuncLocaleCompare):
      (JSC::stringProtoFuncBig):
      (JSC::stringProtoFuncSmall):
      (JSC::stringProtoFuncBlink):
      (JSC::stringProtoFuncBold):
      (JSC::stringProtoFuncFixed):
      (JSC::stringProtoFuncItalics):
      (JSC::stringProtoFuncStrike):
      (JSC::stringProtoFuncSub):
      (JSC::stringProtoFuncSup):
      (JSC::stringProtoFuncFontcolor):
      (JSC::stringProtoFuncFontsize):
      (JSC::stringProtoFuncAnchor):
      (JSC::stringProtoFuncLink):
      (JSC::trimString): Some of this code gets simpler, now that toString()
      does the right thing. More calls to value(), as above.
      
      ../JavaScriptGlue: 
      
      Reviewed by Gavin Barraclough.
      
      * JSUtils.cpp:
      (KJSValueToCFTypeInternal):
      
      ../WebCore: 
      
      Reviewed by Gavin Barraclough.
      
      Mechanical changes to call value() after calling toString(), to
      convert from "JS string" (JSString*) to "C++ string" (UString), since
      toString() no longer returns a "C++ string".
      
      * bindings/js/IDBBindingUtilities.cpp:
      (WebCore::createIDBKeyFromValue):
      * bindings/js/JSCSSStyleDeclarationCustom.cpp:
      (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
      * bindings/js/JSClipboardCustom.cpp:
      (WebCore::JSClipboard::clearData):
      (WebCore::JSClipboard::getData):
      * bindings/js/JSCustomXPathNSResolver.cpp:
      (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
      * bindings/js/JSDOMBinding.cpp:
      (WebCore::valueToStringWithNullCheck):
      (WebCore::valueToStringWithUndefinedOrNullCheck):
      (WebCore::reportException):
      * bindings/js/JSDOMFormDataCustom.cpp:
      (WebCore::JSDOMFormData::append):
      * bindings/js/JSDOMStringMapCustom.cpp:
      (WebCore::JSDOMStringMap::putDelegate):
      * bindings/js/JSDOMWindowCustom.cpp:
      (WebCore::JSDOMWindow::setLocation):
      (WebCore::JSDOMWindow::open):
      (WebCore::JSDOMWindow::addEventListener):
      (WebCore::JSDOMWindow::removeEventListener):
      * bindings/js/JSDeviceMotionEventCustom.cpp:
      (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
      * bindings/js/JSDeviceOrientationEventCustom.cpp:
      (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent):
      * bindings/js/JSDictionary.cpp:
      (WebCore::JSDictionary::convertValue):
      * bindings/js/JSDocumentCustom.cpp:
      (WebCore::JSDocument::setLocation):
      * bindings/js/JSEventListener.cpp:
      (WebCore::JSEventListener::handleEvent):
      * bindings/js/JSHTMLAllCollectionCustom.cpp:
      (WebCore::callHTMLAllCollection):
      (WebCore::JSHTMLAllCollection::item):
      (WebCore::JSHTMLAllCollection::namedItem):
      * bindings/js/JSHTMLCanvasElementCustom.cpp:
      (WebCore::JSHTMLCanvasElement::getContext):
      * bindings/js/JSHTMLCollectionCustom.cpp:
      (WebCore::JSHTMLCollection::item):
      (WebCore::JSHTMLCollection::namedItem):
      * bindings/js/JSHTMLDocumentCustom.cpp:
      (WebCore::documentWrite):
      * bindings/js/JSHTMLInputElementCustom.cpp:
      (WebCore::JSHTMLInputElement::setSelectionDirection):
      (WebCore::JSHTMLInputElement::setSelectionRange):
      * bindings/js/JSInspectorFrontendHostCustom.cpp:
      (WebCore::JSInspectorFrontendHost::showContextMenu):
      * bindings/js/JSJavaScriptCallFrameCustom.cpp:
      (WebCore::JSJavaScriptCallFrame::evaluate):
      * bindings/js/JSLocationCustom.cpp:
      (WebCore::JSLocation::setHref):
      (WebCore::JSLocation::setProtocol):
      (WebCore::JSLocation::setHost):
      (WebCore::JSLocation::setHostname):
      (WebCore::JSLocation::setPort):
      (WebCore::JSLocation::setPathname):
      (WebCore::JSLocation::setSearch):
      (WebCore::JSLocation::setHash):
      (WebCore::JSLocation::replace):
      (WebCore::JSLocation::assign):
      * bindings/js/JSMessageEventCustom.cpp:
      (WebCore::handleInitMessageEvent):
      * bindings/js/JSSQLTransactionCustom.cpp:
      (WebCore::JSSQLTransaction::executeSql):
      * bindings/js/JSSQLTransactionSyncCustom.cpp:
      (WebCore::JSSQLTransactionSync::executeSql):
      * bindings/js/JSSharedWorkerCustom.cpp:
      (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
      * bindings/js/JSStorageCustom.cpp:
      (WebCore::JSStorage::putDelegate):
      * bindings/js/JSWebGLRenderingContextCustom.cpp:
      (WebCore::JSWebGLRenderingContext::getExtension):
      * bindings/js/JSWebSocketCustom.cpp:
      (WebCore::JSWebSocketConstructor::constructJSWebSocket):
      (WebCore::JSWebSocket::send):
      (WebCore::JSWebSocket::close):
      * bindings/js/JSWorkerContextCustom.cpp:
      (WebCore::JSWorkerContext::importScripts):
      * bindings/js/JSWorkerCustom.cpp:
      (WebCore::JSWorkerConstructor::constructJSWorker):
      * bindings/js/JSXMLHttpRequestCustom.cpp:
      (WebCore::JSXMLHttpRequest::open):
      (WebCore::JSXMLHttpRequest::send):
      * bindings/js/JSXSLTProcessorCustom.cpp:
      (WebCore::JSXSLTProcessor::setParameter):
      (WebCore::JSXSLTProcessor::getParameter):
      (WebCore::JSXSLTProcessor::removeParameter):
      * bindings/js/ScheduledAction.cpp:
      (WebCore::ScheduledAction::create):
      * bindings/js/ScriptEventListener.cpp:
      (WebCore::eventListenerHandlerBody):
      * bindings/js/ScriptValue.cpp:
      (WebCore::ScriptValue::toString):
      * bindings/scripts/CodeGeneratorJS.pm:
      (GenerateEventListenerCall):
      (JSValueToNative):
      (GenerateConstructorDefinition):
      * bridge/c/c_utility.cpp:
      (JSC::Bindings::convertValueToNPVariant):
      * bridge/jni/jni_jsobject.mm:
      (JavaJSObject::convertValueToJObject):
      * bridge/jni/jsc/JNIUtilityPrivate.cpp:
      (JSC::Bindings::convertArrayInstanceToJavaArray):
      (JSC::Bindings::convertValueToJValue):
      * bridge/jni/jsc/JavaFieldJSC.cpp:
      (JavaField::dispatchValueFromInstance):
      (JavaField::valueFromInstance):
      (JavaField::dispatchSetValueToInstance):
      (JavaField::setValueToInstance):
      * bridge/jni/jsc/JavaInstanceJSC.cpp:
      (JavaInstance::invokeMethod):
      * testing/js/JSInternalsCustom.cpp:
      (WebCore::JSInternals::setUserPreferredLanguages):
      
      ../WebKit/mac: 
      
      Reviewed by Gavin Barraclough.
      
      Mechanical changes to call value() after calling toString(), to
      convert from "JS string" (JSString*) to "C++ string" (UString), since
      toString() no longer returns a "C++ string".
      
      * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
      (WebKit::NetscapePluginInstanceProxy::addValueToArray):
      * WebView/WebFrame.mm:
      (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
      (-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):
      
      ../WebKit2: 
      
      Reviewed by Gavin Barraclough.
      
      Mechanical changes to call value() after calling toString(), to
      convert from "JS string" (JSString*) to "C++ string" (UString), since
      toString() no longer returns a "C++ string".
      
      * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
      (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      64be5e90
  18. 02 Jan, 2012 1 commit
  19. 06 Dec, 2011 2 commits
  20. 24 Nov, 2011 1 commit
  21. 09 Nov, 2011 1 commit
    • msaboff@apple.com's avatar
      Towards 8 Bit Strings: Templatize JSC::LiteralParser class by character type · ea1974bb
      msaboff@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=71862
      
      Changed LiteralParser to be templatized of character type.
      
      Moved five enums out of class definition to work around a clang compiler defect.
      
      Added lexIdentifier templated method to break out character specific versions.
      Added static setParserTokenString templated method to handle setting approriately
      sized string pointer.
      
      To keep code in LiteralParser.cpp and keep LiteralParser.h small, the two
      flavors of LiteralParser are explicitly instantiated at the end of
      LiteralParser.cpp.
      
      Reviewed by Oliver Hunt.
      
      * API/JSValueRef.cpp:
      (JSValueMakeFromJSONString):
      * JavaScriptCore.exp:
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::callEval):
      (JSC::Interpreter::execute):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
      * runtime/JSONObject.cpp:
      (JSC::JSONProtoFuncParse):
      * runtime/LiteralParser.cpp:
      (JSC::isJSONWhiteSpace):
      (JSC::::tryJSONPParse):
      (JSC::::makeIdentifier):
      (JSC::::Lexer::lex):
      (JSC::::Lexer::lexIdentifier):
      (JSC::::Lexer::next):
      (JSC::LChar):
      (JSC::UChar):
      (JSC::isSafeStringCharacter):
      (JSC::::Lexer::lexString):
      (JSC::::Lexer::lexNumber):
      (JSC::::parse):
      * runtime/LiteralParser.h:
      (JSC::LiteralParser::LiteralParser):
      (JSC::LiteralParser::getErrorMessage):
      (JSC::LiteralParser::tryLiteralParse):
      (JSC::LiteralParser::Lexer::Lexer):
      (JSC::LiteralParser::Lexer::currentToken):
      (JSC::LiteralParser::Lexer::getErrorMessage):
      * runtime/UString.h:
      (JSC::LChar):
      (JSC::UChar):
      * wtf/text/StringBuilder.cpp:
      (WTF::StringBuilder::append):
      * wtf/text/StringBuilder.h:
      (WTF::StringBuilder::append):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@99812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ea1974bb
  22. 07 Nov, 2011 1 commit
    • msaboff@apple.com's avatar
      Towards 8 Bit Strings: Templatize JSC::Lexer class by character type · 11c2e645
      msaboff@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=71331
      
      Source/JavaScriptCore: 
      
      Change the Lexer class to be a template class based on the character
      type of the source.  In the process updated the parseIdentifier()
      and parseString() methods to create 8 bit strings where possible.
      Also added some helper methods for accumulating temporary string
      data in the 8 and 16 bit vectors.
      
      Changed the SourceProvider::data() virtual method to return a
      StringImpl* instead of a UChar*.
      
      Updated the KeywordLookup generator to create code to match keywords
      for both 8 and 16 bit source strings.
      
      Due to a compiler bug (<rdar://problem/10194295>) moved enum
      definition outside of Lexer class declaration.  Remove second enum
      no longer needed.
      
      Reviewed by Darin Adler.
      
      * KeywordLookupGenerator.py:
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::callEval):
      * parser/Lexer.cpp:
      (JSC::::Lexer):
      (JSC::::~Lexer):
      (JSC::::getInvalidCharMessage):
      (JSC::::currentCharacter):
      (JSC::::setCode):
      (JSC::::internalShift):
      (JSC::::shift):
      (JSC::::peek):
      (JSC::::getUnicodeCharacter):
      (JSC::::shiftLineTerminator):
      (JSC::::lastTokenWasRestrKeyword):
      (JSC::::record8):
      (JSC::::append8):
      (JSC::::append16):
      (JSC::::record16):
      (JSC::::parseIdentifier):
      (JSC::::parseIdentifierSlowCase):
      (JSC::::parseString):
      (JSC::::parseStringSlowCase):
      (JSC::::parseHex):
      (JSC::::parseOctal):
      (JSC::::parseDecimal):
      (JSC::::parseNumberAfterDecimalPoint):
      (JSC::::parseNumberAfterExponentIndicator):
      (JSC::::parseMultilineComment):
      (JSC::::nextTokenIsColon):
      (JSC::::lex):
      (JSC::::scanRegExp):
      (JSC::::skipRegExp):
      (JSC::::clear):
      (JSC::::sourceCode):
      * parser/Lexer.h:
      (JSC::Lexer::append16):
      (JSC::Lexer::currentOffset):
      (JSC::Lexer::setOffsetFromCharOffset):
      (JSC::::isWhiteSpace):
      (JSC::::isLineTerminator):
      (JSC::::convertHex):
      (JSC::::convertUnicode):
      (JSC::::makeIdentifier):
      (JSC::::setCodeStart):
      (JSC::::makeIdentifierLCharFromUChar):
      (JSC::::lexExpectIdentifier):
      * parser/Parser.cpp:
      (JSC::Parser::Parser):
      (JSC::Parser::parseProperty):
      (JSC::Parser::parseMemberExpression):
      * parser/Parser.h:
      (JSC::Parser::next):
      (JSC::Parser::nextExpectIdentifier):
      * parser/ParserArena.h:
      (JSC::IdentifierArena::makeIdentifier):
      (JSC::IdentifierArena::makeIdentifierLCharFromUChar):
      * parser/SourceCode.h:
      (JSC::SourceCode::subExpression):
      * parser/SourceProvider.h:
      (JSC::UStringSourceProvider::stringData):
      * parser/SourceProviderCache.h:
      * parser/SyntaxChecker.h:
      * runtime/FunctionPrototype.cpp:
      (JSC::insertSemicolonIfNeeded):
      * runtime/Identifier.cpp:
      (JSC::IdentifierTable::add):
      (JSC::IdentifierLCharFromUCharTranslator::hash):
      (JSC::IdentifierLCharFromUCharTranslator::equal):
      (JSC::IdentifierLCharFromUCharTranslator::translate):
      (JSC::Identifier::add8):
      * runtime/Identifier.h:
      (JSC::Identifier::Identifier):
      (JSC::Identifier::createLCharFromUChar):
      (JSC::Identifier::canUseSingleCharacterString):
      (JSC::IdentifierCharBufferTranslator::hash):
      (JSC::IdentifierCharBufferTranslator::equal):
      (JSC::IdentifierCharBufferTranslator::translate):
      (JSC::Identifier::add):
      (JSC::Identifier::equal):
      (JSC::IdentifierTable::add):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::decode):
      (JSC::parseIntOverflow):
      (JSC::globalFuncUnescape):
      * runtime/JSGlobalObjectFunctions.h:
      (JSC::parseIntOverflow):
      * runtime/LiteralParser.cpp:
      (JSC::LiteralParser::tryJSONPParse):
      (JSC::LiteralParser::Lexer::lexString):
      * wtf/text/StringImpl.h:
      
      Source/WebCore: 
      
      Changed the SourceProvider::data() virtual method to return a
      StringImpl* instead of a UChar*.
      Changed Identifier() constructor to use JSGlobalData*.
      
      Reviewed by Darin Adler.
      
      No new tests - refactored SourceProvider class and sub-classes.
      
      * bindings/js/CachedScriptSourceProvider.h:
      (WebCore::CachedScriptSourceProvider::stringData):
      * bindings/js/StringSourceProvider.h:
      (WebCore::StringSourceProvider::stringData):
      * bridge/qt/qt_runtime.cpp:
      (JSC::Bindings::convertQVariantToValue):
      
      Source/WebKit/qt: 
      
      Changed Identifier() constructor to use JSGlobalData*.
      
      Reviewed by Darin Adler.
      
      * Api/qwebframe.cpp:
      (QWebFrame::addToJavaScriptWindowObject):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@99436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      11c2e645
  23. 19 Oct, 2011 1 commit
    • barraclough@apple.com's avatar
      Poisoning of strict caller,arguments inappropriately poisoning "in" · 69e904a8
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=63398
      
      Reviewed by Oliver Hunt.
      
      Source/JavaScriptCore: 
      
      This fixes the problem by correctly implementing the spec -
      the error should actually be being thrown from a standard JS getter/setter.
      This implements spec correct behaviour for strict mode JS functions & bound
      functions, I'll follow up with a patch to do the same for arguments.
      
      * runtime/JSBoundFunction.cpp:
      (JSC::JSBoundFunction::finishCreation):
          - Add the poisoned caller/arguments properties.
      * runtime/JSBoundFunction.h:
      * runtime/JSFunction.cpp:
      (JSC::JSFunction::finishCreation):
      (JSC::JSFunction::getOwnPropertySlot):
      (JSC::JSFunction::getOwnPropertyDescriptor):
      (JSC::JSFunction::put):
          - If the caller/arguments are accessed on a strict mode function, lazily add the ThrowTypeError getter.
      * runtime/JSFunction.h:
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::createThrowTypeError):
      (JSC::JSGlobalObject::visitChildren):
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::throwTypeErrorGetterSetter):
          - Add a ThrowTypeError type, per ES5 13.2.3.
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncThrowTypeError):
      * runtime/JSGlobalObjectFunctions.h:
          - Implementation of ThrowTypeError.
      * runtime/JSObject.cpp:
      (JSC::JSObject::initializeGetterSetterProperty):
      * runtime/JSObject.h:
          - This function adds a new property (must not exist already) that is an initialized getter/setter.
      
      LayoutTests: 
      
      * fast/js/basic-strict-mode-expected.txt:
      * fast/js/script-tests/basic-strict-mode.js:
          - Add tests.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      69e904a8
  24. 04 Oct, 2011 1 commit
    • ggaren@apple.com's avatar
      Some JSValue cleanup · 7831f0c3
      ggaren@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=69320
      
      ../JavaScriptCore: 
      
      Reviewed by Darin Adler.
              
      No measurable performance change.
      
      Removed some JSValue::get* functions. get* used to be an optimization
      when every value operation was a virtual function call: get* would combine
      two virtual calls into one. Now, with non-virtual, inlined functions, get*
      isn't faster, and may be slightly slower.
      
      Merged getBoolean(bool&) and getBoolean() into asBoolean().
      
      Merged uncheckedGetNumber(), getJSNumber() and getNumber() into
      asNumber().
      
      * runtime/JSValue.h:
      * runtime/JSValueInlineMethods.h:
      (JSC::JSValue::asNumber):
      (JSC::JSValue::asBoolean): As promised!
      
      * runtime/NumberPrototype.cpp:
      (JSC::toThisNumber):
      (JSC::numberProtoFuncToExponential):
      (JSC::numberProtoFuncToFixed):
      (JSC::numberProtoFuncToPrecision):
      (JSC::numberProtoFuncToString):
      (JSC::numberProtoFuncToLocaleString):
      (JSC::numberProtoFuncValueOf): Removed a bunch of uses of getJSNumber()
      by switching to toThisNumber().
      
      * API/JSCallbackObjectFunctions.h:
      (JSC::::toNumber):
      * dfg/DFGGraph.h:
      (JSC::DFG::Graph::valueOfNumberConstant):
      (JSC::DFG::Graph::valueOfBooleanConstant):
      * dfg/DFGOperations.cpp:
      (JSC::DFG::putByVal):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::privateExecute):
      * jit/JITStubs.cpp:
      (JSC::DEFINE_STUB_FUNCTION):
      * runtime/DateInstance.h:
      (JSC::DateInstance::internalNumber):
      * runtime/FunctionPrototype.cpp:
      (JSC::functionProtoFuncBind):
      * runtime/JSArray.cpp:
      (JSC::compareNumbersForQSort): Replaced getNumber() => isNumber() / asNumber().
      getBoolean() => isBoolean() / asBoolean(), uncheckedGetNumber() => asNumber().
      
      * runtime/JSCell.cpp:
      * runtime/JSCell.h: Nixed getJSNumber().
      
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncParseInt):
      * runtime/JSONObject.cpp:
      (JSC::gap):
      (JSC::Stringifier::Stringifier):
      (JSC::Stringifier::appendStringifiedValue):
      * runtime/NumberObject.cpp:
      * runtime/NumberObject.h:
      (JSC::NumberObject::createStructure):
      * runtime/Operations.h:
      (JSC::JSValue::equalSlowCaseInline):
      (JSC::JSValue::strictEqual):
      (JSC::jsLess):
      (JSC::jsLessEq):
      (JSC::jsAdd): Replaced getNumber() => isNumber() / asNumber().
      getBoolean() => isBoolean() / asBoolean(), uncheckedGetNumber() => asNumber().
      
      ../WebCore: 
      
      Reviewed by Darin Adler.
      
      * bindings/js/JSDOMBinding.cpp:
      (WebCore::valueToDate):
      * bindings/js/JSErrorHandler.cpp:
      (WebCore::JSErrorHandler::handleEvent):
      * bindings/js/JSEventListener.cpp:
      (WebCore::JSEventListener::handleEvent):
      * bindings/js/JSSQLTransactionCustom.cpp:
      (WebCore::JSSQLTransaction::executeSql):
      * bindings/js/JSSQLTransactionSyncCustom.cpp:
      (WebCore::JSSQLTransactionSync::executeSql):
      * bindings/js/ScriptValue.cpp:
      (WebCore::jsToInspectorValue):
      * bindings/js/SerializedScriptValue.cpp:
      (WebCore::CloneSerializer::dumpIfTerminal):
      * bindings/objc/WebScriptObject.mm:
      (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
      * bridge/jni/jsc/JNIUtilityPrivate.cpp:
      (JSC::Bindings::convertValueToJValue): Updated for JSC changes.
      
      ../WebKit/mac: 
      
      Reviewed by Darin Adler.
      
      * WebView/WebView.mm:
      (aeDescFromJSValue): Updated for JSC changes.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96673 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7831f0c3
  25. 01 Sep, 2011 1 commit
    • msaboff@apple.com's avatar
      Remove simple usage of UString::characters() from JavaScriptCore · aeb7a4af
      msaboff@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=67340
      
      In preparation to allowing StringImpl to be backed by 8 bit 
      characters when appropriate, we need to eliminate or change the
      usage of StringImpl::characters().  Most of the changes below
      change s->characters()[0] to s[0].
      
      Reviewed by Geoffrey Garen.
      
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::keyForCharacterSwitch):
      * bytecompiler/NodesCodegen.cpp:
      (JSC::processClauseList):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::privateExecute):
      * jit/JITStubs.cpp:
      (JSC::DEFINE_STUB_FUNCTION):
      * runtime/Identifier.cpp:
      (JSC::Identifier::addSlowCase):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::jsToNumber):
      (JSC::parseFloat):
      * runtime/JSString.cpp:
      (JSC::JSString::substringFromRope):
      * runtime/JSString.h:
      (JSC::jsSingleCharacterSubstring):
      (JSC::jsString):
      (JSC::jsSubstring):
      (JSC::jsOwnedString):
      * runtime/RegExp.cpp:
      (JSC::regExpFlags):
      * wtf/text/StringBuilder.h:
      (WTF::StringBuilder::operator[]):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      aeb7a4af
  26. 28 Jul, 2011 2 commits
  27. 19 Jun, 2011 1 commit
    • oliver@apple.com's avatar
      2011-06-17 Oliver Hunt <oliver@apple.com> · cef0b132
      oliver@apple.com authored
              Reviewed by Gavin Barraclough.
      
              JSONP is unnecessarily slow
              https://bugs.webkit.org/show_bug.cgi?id=62920
      
              JSONP has unfortunately become a fairly common idiom online, yet
              it triggers very poor performance in JSC as we end up doing codegen
              for a large number of property accesses that will
                 * only be run once, so the vast amount of logic we dump to handle
                   caching of accesses is unnecessary.
                 * We are doing codegen that is directly proportional to just
                   creating the object in the first place.
      
              This patch extends the use of the literal parser to JSONP-like structures
              in global code, handling a number of different forms I have seen online.
              In an extreme case this improves performance of JSONP by more than 2x
              due to removal of code generation and execution time, and a few optimisations
              that I made to the parser itself.
      
              * API/JSValueRef.cpp:
              (JSValueMakeFromJSONString):
              * interpreter/Interpreter.cpp:
              (JSC::Interpreter::callEval):
              (JSC::Interpreter::execute):
              * parser/Lexer.cpp:
              (JSC::Lexer::isKeyword):
              * parser/Lexer.h:
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::globalFuncEval):
              * runtime/JSONObject.cpp:
              (JSC::JSONProtoFuncParse):
              * runtime/LiteralParser.cpp:
              (JSC::LiteralParser::tryJSONPParse):
              (JSC::LiteralParser::makeIdentifier):
              (JSC::LiteralParser::Lexer::lex):
              (JSC::LiteralParser::Lexer::next):
              (JSC::isSafeStringCharacter):
              (JSC::LiteralParser::Lexer::lexString):
              (JSC::LiteralParser::Lexer::lexNumber):
              (JSC::LiteralParser::parse):
              * runtime/LiteralParser.h:
              (JSC::LiteralParser::LiteralParser):
              (JSC::LiteralParser::tryLiteralParse):
              (JSC::LiteralParser::Lexer::Lexer):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      cef0b132
  28. 18 Jun, 2011 1 commit
    • commit-queue@webkit.org's avatar
      2011-06-18 Sheriff Bot <webkit.review.bot@gmail.com> · 2e0b9707
      commit-queue@webkit.org authored
              Unreviewed, rolling out r89184.
              http://trac.webkit.org/changeset/89184
              https://bugs.webkit.org/show_bug.cgi?id=62927
      
              It broke 22 tests on all bot (Requested by Ossy_weekend on
              #webkit).
      
              * API/JSValueRef.cpp:
              (JSValueMakeFromJSONString):
              * interpreter/Interpreter.cpp:
              (JSC::Interpreter::callEval):
              (JSC::Interpreter::execute):
              * parser/Lexer.cpp:
              * parser/Lexer.h:
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::globalFuncEval):
              * runtime/JSONObject.cpp:
              (JSC::JSONProtoFuncParse):
              * runtime/LiteralParser.cpp:
              (JSC::LiteralParser::Lexer::lex):
              (JSC::isSafeStringCharacter):
              (JSC::LiteralParser::Lexer::lexString):
              (JSC::LiteralParser::Lexer::lexNumber):
              (JSC::LiteralParser::parse):
              * runtime/LiteralParser.h:
              (JSC::LiteralParser::LiteralParser):
              (JSC::LiteralParser::tryLiteralParse):
              (JSC::LiteralParser::Lexer::Lexer):
              (JSC::LiteralParser::Lexer::next):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2e0b9707
  29. 17 Jun, 2011 1 commit
    • oliver@apple.com's avatar
      2011-06-17 Oliver Hunt <oliver@apple.com> · 0cd29253
      oliver@apple.com authored
              Reviewed by Gavin Barraclough.
      
              JSONP is unnecessarily slow
              https://bugs.webkit.org/show_bug.cgi?id=62920
      
              JSONP has unfortunately become a fairly common idiom online, yet
              it triggers very poor performance in JSC as we end up doing codegen
              for a large number of property accesses that will
                 * only be run once, so the vast amount of logic we dump to handle
                   caching of accesses is unnecessary.
                 * We are doing codegen that is directly proportional to just
                   creating the object in the first place.
      
              This patch extends the use of the literal parser to JSONP-like structures
              in global code, handling a number of different forms I have seen online.
              In an extreme case this improves performance of JSONP by more than 2x
              due to removal of code generation and execution time, and a few optimisations
              that I made to the parser itself.
      
              * API/JSValueRef.cpp:
              (JSValueMakeFromJSONString):
              * interpreter/Interpreter.cpp:
              (JSC::Interpreter::callEval):
              (JSC::Interpreter::execute):
              * parser/Lexer.cpp:
              (JSC::Lexer::isKeyword):
              * parser/Lexer.h:
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::globalFuncEval):
              * runtime/JSONObject.cpp:
              (JSC::JSONProtoFuncParse):
              * runtime/LiteralParser.cpp:
              (JSC::LiteralParser::tryJSONPParse):
              (JSC::LiteralParser::makeIdentifier):
              (JSC::LiteralParser::Lexer::lex):
              (JSC::LiteralParser::Lexer::next):
              (JSC::isSafeStringCharacter):
              (JSC::LiteralParser::Lexer::lexString):
              (JSC::LiteralParser::Lexer::lexNumber):
              (JSC::LiteralParser::parse):
              * runtime/LiteralParser.h:
              (JSC::LiteralParser::LiteralParser):
              (JSC::LiteralParser::tryLiteralParse):
              (JSC::LiteralParser::Lexer::Lexer):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0cd29253
  30. 11 Jun, 2011 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=16777 · b1fefbeb
      barraclough@apple.com authored
      Reviewed by Darin Adler.
      
      Remove #define NaN per Darin's comments.
      
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::parseIntOverflow):
      (JSC::parseInt):
      (JSC::jsStrDecimalLiteral):
      (JSC::jsToNumber):
      (JSC::parseFloat):
      * wtf/DateMath.cpp:
      (WTF::equivalentYearForDST):
      (WTF::parseES5DateFromNullTerminatedCharacters):
      (WTF::parseDateFromNullTerminatedCharacters):
      (WTF::timeClip):
      (JSC::parseDateFromNullTerminatedCharacters):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b1fefbeb
  31. 10 Jun, 2011 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=16777 · f1fa579d
      barraclough@apple.com authored
      Eliminate JSC::NaN and JSC::Inf
      
      Reviewed by Sam Weinig.
      
      There's no good reason for -K-J-S- JSC to have its own NAN and infinity constants.
      The ones in std::numeric_limits are perfectly good.
      Remove JSC::Inf, JSC::NaN, switch some cases of (isnan || isinf) to !isfinite.
      
      Source/JavaScriptCore: 
      
      * API/JSCallbackObjectFunctions.h:
      (JSC::::toNumber):
      * API/JSValueRef.cpp:
      (JSValueMakeNumber):
      (JSValueToNumber):
      * JavaScriptCore.exp:
      * runtime/CachedTranscendentalFunction.h:
      (JSC::CachedTranscendentalFunction::initialize):
      * runtime/DateConstructor.cpp:
      (JSC::constructDate):
      * runtime/DateInstanceCache.h:
      (JSC::DateInstanceData::DateInstanceData):
      (JSC::DateInstanceCache::reset):
      * runtime/JSCell.cpp:
      * runtime/JSCell.h:
      (JSC::JSCell::JSValue::getPrimitiveNumber):
      (JSC::JSCell::JSValue::toNumber):
      * runtime/JSGlobalData.cpp:
      (JSC::JSGlobalData::JSGlobalData):
      (JSC::JSGlobalData::resetDateCache):
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncParseInt):
      (JSC::globalFuncIsFinite):
      * runtime/JSNotAnObject.cpp:
      (JSC::JSNotAnObject::toNumber):
      * runtime/JSValue.cpp:
      * runtime/JSValue.h:
      * runtime/JSValueInlineMethods.h:
      (JSC::jsNaN):
      * runtime/MathObject.cpp:
      (JSC::mathProtoFuncMax):
      (JSC::mathProtoFuncMin):
      * runtime/NumberConstructor.cpp:
      (JSC::numberConstructorNegInfinity):
      (JSC::numberConstructorPosInfinity):
      * runtime/NumberPrototype.cpp:
      (JSC::numberProtoFuncToExponential):
      (JSC::numberProtoFuncToFixed):
      (JSC::numberProtoFuncToPrecision):
      (JSC::numberProtoFuncToString):
      * runtime/UString.cpp:
      * wtf/DecimalNumber.h:
      (WTF::DecimalNumber::DecimalNumber):
      * wtf/dtoa.cpp:
      (WTF::dtoa):
      
      Source/WebCore: 
      
      * bindings/js/JSDataViewCustom.cpp:
      (WebCore::getDataViewMember):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f1fa579d
  32. 17 May, 2011 2 commits
    • ggaren@apple.com's avatar
      Source/JavaScriptCore: Rolling back in r86653 with build fixed. · 19fe5092
      ggaren@apple.com authored
      Reviewed by Gavin Barraclough and Oliver Hunt.
      
      Global object initialization is expensive
      https://bugs.webkit.org/show_bug.cgi?id=60933
              
      Changed a bunch of globals to allocate their properties lazily, and changed
      the global object to allocate a bunch of its globals lazily.
              
      This reduces the footprint of a global object from 287 objects with 58
      functions for 24K to 173 objects with 20 functions for 15K.
      
      Large patch, but it's all mechanical.
      
      * DerivedSources.make:
      * JavaScriptCore.exp: Build!
      
      * create_hash_table: Added a special case for fromCharCode, since it uses
      a custom "thunk generator".
      
      * heap/Heap.cpp:
      (JSC::TypeCounter::operator()): Fixed a bug where the type counter would
      overcount objects that were owned through more than one mechanism because
      it was getting in the way of counting the results for this patch.
      
      * interpreter/CallFrame.h:
      (JSC::ExecState::arrayConstructorTable):
      (JSC::ExecState::arrayPrototypeTable):
      (JSC::ExecState::booleanPrototypeTable):
      (JSC::ExecState::dateConstructorTable):
      (JSC::ExecState::errorPrototypeTable):
      (JSC::ExecState::globalObjectTable):
      (JSC::ExecState::numberConstructorTable):
      (JSC::ExecState::numberPrototypeTable):
      (JSC::ExecState::objectPrototypeTable):
      (JSC::ExecState::regExpPrototypeTable):
      (JSC::ExecState::stringConstructorTable): Added new tables.
      
      * runtime/ArrayConstructor.cpp:
      (JSC::ArrayConstructor::ArrayConstructor):
      (JSC::ArrayConstructor::getOwnPropertySlot):
      (JSC::ArrayConstructor::getOwnPropertyDescriptor):
      * runtime/ArrayConstructor.h:
      (JSC::ArrayConstructor::createStructure):
      * runtime/ArrayPrototype.cpp:
      (JSC::ArrayPrototype::getOwnPropertySlot):
      (JSC::ArrayPrototype::getOwnPropertyDescriptor):
      * runtime/ArrayPrototype.h:
      * runtime/BooleanPrototype.cpp:
      (JSC::BooleanPrototype::BooleanPrototype):
      (JSC::BooleanPrototype::getOwnPropertySlot):
      (JSC::BooleanPrototype::getOwnPropertyDescriptor):
      * runtime/BooleanPrototype.h:
      (JSC::BooleanPrototype::createStructure):
      * runtime/DateConstructor.cpp:
      (JSC::DateConstructor::DateConstructor):
      (JSC::DateConstructor::getOwnPropertySlot):
      (JSC::DateConstructor::getOwnPropertyDescriptor):
      * runtime/DateConstructor.h:
      (JSC::DateConstructor::createStructure):
      * runtime/ErrorPrototype.cpp:
      (JSC::ErrorPrototype::ErrorPrototype):
      (JSC::ErrorPrototype::getOwnPropertySlot):
      (JSC::ErrorPrototype::getOwnPropertyDescriptor):
      * runtime/ErrorPrototype.h:
      (JSC::ErrorPrototype::createStructure): Standardized these objects
      to use static tables for function properties.
      
      * runtime/JSGlobalData.cpp:
      (JSC::JSGlobalData::JSGlobalData):
      (JSC::JSGlobalData::~JSGlobalData):
      * runtime/JSGlobalData.h: Added new tables.
      
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      (JSC::JSGlobalObject::addStaticGlobals):
      (JSC::JSGlobalObject::getOwnPropertySlot):
      (JSC::JSGlobalObject::getOwnPropertyDescriptor):
      * runtime/JSGlobalObject.h:
      * runtime/JSGlobalObjectFunctions.cpp:
      * runtime/JSGlobalObjectFunctions.h: Changed JSGlobalObject to use a
      static table for its global functions. This required uninlining some
      things to avoid a circular header dependency. However, those things
      probably shouldn't have been inlined in the first place.
              
      Even more global object properties can be made lazy, but that requires
      more in-depth changes.
      
      * runtime/MathObject.cpp:
      * runtime/NumberConstructor.cpp:
      (JSC::NumberConstructor::getOwnPropertySlot):
      (JSC::NumberConstructor::getOwnPropertyDescriptor):
      * runtime/NumberPrototype.cpp:
      (JSC::NumberPrototype::NumberPrototype):
      (JSC::NumberPrototype::getOwnPropertySlot):
      (JSC::NumberPrototype::getOwnPropertyDescriptor):
      * runtime/NumberPrototype.h:
      (JSC::NumberPrototype::createStructure):
      * runtime/ObjectPrototype.cpp:
      (JSC::ObjectPrototype::ObjectPrototype):
      (JSC::ObjectPrototype::put):
      (JSC::ObjectPrototype::getOwnPropertySlot):
      (JSC::ObjectPrototype::getOwnPropertyDescriptor):
      * runtime/ObjectPrototype.h:
      (JSC::ObjectPrototype::createStructure):
      * runtime/RegExpPrototype.cpp:
      (JSC::RegExpPrototype::RegExpPrototype):
      (JSC::RegExpPrototype::getOwnPropertySlot):
      (JSC::RegExpPrototype::getOwnPropertyDescriptor):
      * runtime/RegExpPrototype.h:
      (JSC::RegExpPrototype::createStructure):
      * runtime/StringConstructor.cpp:
      (JSC::StringConstructor::StringConstructor):
      (JSC::StringConstructor::getOwnPropertySlot):
      (JSC::StringConstructor::getOwnPropertyDescriptor):
      * runtime/StringConstructor.h:
      (JSC::StringConstructor::createStructure): Standardized these objects
      to use static tables for function properties.
      
      LayoutTests: Global object initialization is expensive
      https://bugs.webkit.org/show_bug.cgi?id=60933
              
      Reviewed by Gavin Barraclough.
      
      Added a few more expected failures, now that more code uses static hash
      tables.
              
      The fact that built-ins are not deletable, but should be, is covered by
      https://bugs.webkit.org/show_bug.cgi?id=61014
      
      * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.2/S15.6.2.1_A4-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.3/15.6.3.1_Boolean.prototype/S15.6.3.1_A1-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.6_Boolean/15.6.4/S15.6.4_A1-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.2/S15.7.2.1_A4-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.3/15.7.3.1_Number.prototype/S15.7.3.1_A2_T1-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.7_Number/15.7.4/S15.7.4_A1-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.2_Date.parse/S15.9.4.2_A1_T2-expected.txt:
      * sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.4/15.9.4.3_Date.UTC/S15.9.4.3_A1_T2-expected.txt:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      19fe5092
    • commit-queue@webkit.org's avatar
      2011-05-16 Sheriff Bot <webkit.review.bot@gmail.com> · 5a39502a
      commit-queue@webkit.org authored
              Unreviewed, rolling out r86653.
              http://trac.webkit.org/changeset/86653
              https://bugs.webkit.org/show_bug.cgi?id=60944
      
              "Caused regressions on Windows, OSX and EFL" (Requested by
              yutak on #webkit).
      
              * DerivedSources.make:
              * DerivedSources.pro:
              * GNUmakefile.am:
              * GNUmakefile.list.am:
              * JavaScriptCore.exp:
              * JavaScriptCore.gypi:
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
              * create_hash_table:
              * heap/Heap.cpp:
              (JSC::TypeCounter::operator()):
              * interpreter/CallFrame.h:
              (JSC::ExecState::arrayTable):
              (JSC::ExecState::numberTable):
              * runtime/ArrayConstructor.cpp:
              (JSC::ArrayConstructor::ArrayConstructor):
              * runtime/ArrayConstructor.h:
              * runtime/ArrayPrototype.cpp:
              (JSC::ArrayPrototype::getOwnPropertySlot):
              (JSC::ArrayPrototype::getOwnPropertyDescriptor):
              * runtime/ArrayPrototype.h:
              * runtime/BooleanPrototype.cpp:
              (JSC::BooleanPrototype::BooleanPrototype):
              * runtime/BooleanPrototype.h:
              * runtime/DateConstructor.cpp:
              (JSC::DateConstructor::DateConstructor):
              * runtime/DateConstructor.h:
              * runtime/ErrorPrototype.cpp:
              (JSC::ErrorPrototype::ErrorPrototype):
              * runtime/ErrorPrototype.h:
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::JSGlobalData):
              (JSC::JSGlobalData::~JSGlobalData):
              * runtime/JSGlobalData.h:
              * runtime/JSGlobalObject.cpp:
              (JSC::JSGlobalObject::reset):
              * runtime/JSGlobalObject.h:
              (JSC::JSGlobalObject::addStaticGlobals):
              (JSC::JSGlobalObject::getOwnPropertySlot):
              (JSC::JSGlobalObject::getOwnPropertyDescriptor):
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::globalFuncJSCPrint):
              * runtime/JSGlobalObjectFunctions.h:
              * runtime/MathObject.cpp:
              * runtime/NumberConstructor.cpp:
              (JSC::NumberConstructor::getOwnPropertySlot):
              (JSC::NumberConstructor::getOwnPropertyDescriptor):
              * runtime/NumberPrototype.cpp:
              (JSC::NumberPrototype::NumberPrototype):
              * runtime/NumberPrototype.h:
              * runtime/ObjectPrototype.cpp:
              (JSC::ObjectPrototype::ObjectPrototype):
              (JSC::ObjectPrototype::put):
              (JSC::ObjectPrototype::getOwnPropertySlot):
              * runtime/ObjectPrototype.h:
              * runtime/RegExpPrototype.cpp:
              (JSC::RegExpPrototype::RegExpPrototype):
              * runtime/RegExpPrototype.h:
              * runtime/StringConstructor.cpp:
              (JSC::StringConstructor::StringConstructor):
              * runtime/StringConstructor.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5a39502a
  33. 16 May, 2011 1 commit
    • ggaren@apple.com's avatar
      2011-05-16 Geoffrey Garen <ggaren@apple.com> · 836c5d91
      ggaren@apple.com authored
              Reviewed by Geoffrey Garen.
      
              Global object initialization is expensive
              https://bugs.webkit.org/show_bug.cgi?id=60933
              
              Changed a bunch of globals to allocate their properties lazily, and changed
              the global object to allocate a bunch of its globals lazily.
              
              This reduces the footprint of a global object from 287 objects with 58
              functions for 24K to 173 objects with 20 functions for 15K.
      
              Large patch, but it's all mechanical.
      
              * DerivedSources.make:
              * JavaScriptCore.exp: Build!
      
              * create_hash_table: Added a special case for fromCharCode, since it uses
              a custom "thunk generator".
      
              * heap/Heap.cpp:
              (JSC::TypeCounter::operator()): Fixed a bug where the type counter would
              overcount objects that were owned through more than one mechanism because
              it was getting in the way of counting the results for this patch.
      
              * interpreter/CallFrame.h:
              (JSC::ExecState::arrayConstructorTable):
              (JSC::ExecState::arrayPrototypeTable):
              (JSC::ExecState::booleanPrototypeTable):
              (JSC::ExecState::dateConstructorTable):
              (JSC::ExecState::errorPrototypeTable):
              (JSC::ExecState::globalObjectTable):
              (JSC::ExecState::numberConstructorTable):
              (JSC::ExecState::numberPrototypeTable):
              (JSC::ExecState::objectPrototypeTable):
              (JSC::ExecState::regExpPrototypeTable):
              (JSC::ExecState::stringConstructorTable): Added new tables.
      
              * runtime/ArrayConstructor.cpp:
              (JSC::ArrayConstructor::ArrayConstructor):
              (JSC::ArrayConstructor::getOwnPropertySlot):
              (JSC::ArrayConstructor::getOwnPropertyDescriptor):
              * runtime/ArrayConstructor.h:
              (JSC::ArrayConstructor::createStructure):
              * runtime/ArrayPrototype.cpp:
              (JSC::ArrayPrototype::getOwnPropertySlot):
              (JSC::ArrayPrototype::getOwnPropertyDescriptor):
              * runtime/ArrayPrototype.h:
              * runtime/BooleanPrototype.cpp:
              (JSC::BooleanPrototype::BooleanPrototype):
              (JSC::BooleanPrototype::getOwnPropertySlot):
              (JSC::BooleanPrototype::getOwnPropertyDescriptor):
              * runtime/BooleanPrototype.h:
              (JSC::BooleanPrototype::createStructure):
              * runtime/DateConstructor.cpp:
              (JSC::DateConstructor::DateConstructor):
              (JSC::DateConstructor::getOwnPropertySlot):
              (JSC::DateConstructor::getOwnPropertyDescriptor):
              * runtime/DateConstructor.h:
              (JSC::DateConstructor::createStructure):
              * runtime/ErrorPrototype.cpp:
              (JSC::ErrorPrototype::ErrorPrototype):
              (JSC::ErrorPrototype::getOwnPropertySlot):
              (JSC::ErrorPrototype::getOwnPropertyDescriptor):
              * runtime/ErrorPrototype.h:
              (JSC::ErrorPrototype::createStructure): Standardized these objects
              to use static tables for function properties.
      
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::JSGlobalData):
              (JSC::JSGlobalData::~JSGlobalData):
              * runtime/JSGlobalData.h: Added new tables.
      
              * runtime/JSGlobalObject.cpp:
              (JSC::JSGlobalObject::reset):
              (JSC::JSGlobalObject::addStaticGlobals):
              (JSC::JSGlobalObject::getOwnPropertySlot):
              (JSC::JSGlobalObject::getOwnPropertyDescriptor):
              * runtime/JSGlobalObject.h:
              * runtime/JSGlobalObjectFunctions.cpp:
              * runtime/JSGlobalObjectFunctions.h: Changed JSGlobalObject to use a
              static table for its global functions. This required uninlining some
              things to avoid a circular header dependency. However, those things
              probably shouldn't have been inlined in the first place.
              
              Even more global object properties can be made lazy, but that requires
              more in-depth changes.
      
              * runtime/MathObject.cpp:
              * runtime/NumberConstructor.cpp:
              (JSC::NumberConstructor::getOwnPropertySlot):
              (JSC::NumberConstructor::getOwnPropertyDescriptor):
              * runtime/NumberPrototype.cpp:
              (JSC::NumberPrototype::NumberPrototype):
              (JSC::NumberPrototype::getOwnPropertySlot):
              (JSC::NumberPrototype::getOwnPropertyDescriptor):
              * runtime/NumberPrototype.h:
              (JSC::NumberPrototype::createStructure):
              * runtime/ObjectPrototype.cpp:
              (JSC::ObjectPrototype::ObjectPrototype):
              (JSC::ObjectPrototype::put):
              (JSC::ObjectPrototype::getOwnPropertySlot):
              (JSC::ObjectPrototype::getOwnPropertyDescriptor):
              * runtime/ObjectPrototype.h:
              (JSC::ObjectPrototype::createStructure):
              * runtime/RegExpPrototype.cpp:
              (JSC::RegExpPrototype::RegExpPrototype):
              (JSC::RegExpPrototype::getOwnPropertySlot):
              (JSC::RegExpPrototype::getOwnPropertyDescriptor):
              * runtime/RegExpPrototype.h:
              (JSC::RegExpPrototype::createStructure):
              * runtime/StringConstructor.cpp:
              (JSC::StringConstructor::StringConstructor):
              (JSC::StringConstructor::getOwnPropertySlot):
              (JSC::StringConstructor::getOwnPropertyDescriptor):
              * runtime/StringConstructor.h:
              (JSC::StringConstructor::createStructure): Standardized these objects
              to use static tables for function properties.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86653 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      836c5d91
  34. 08 Mar, 2011 1 commit
    • oliver@apple.com's avatar
      2011-03-07 Oliver Hunt <oliver@apple.com> · ba10bec9
      oliver@apple.com authored
              Reviewed by Gavin Barraclough.
      
              Make CodeBlock GC write barrier safe
              https://bugs.webkit.org/show_bug.cgi?id=55910
      
              In order to make CodeBlock WriteBarrier safe it was necessary
              to make it have a single GC owner, and for that reason I have
              made ExecutableBase a GC allocated object.  This required
              updating their creation routines as well as all sites that hold
              a reference to them.  GC objects that held Executable's have been
              converted to WriteBarriers, and all other sites now use Global<>.
      
              As an added benefit this gets rid of JSGlobalData's list of
              GlobalCodeBlocks.
      
              Perf testing shows a 0.5% progression on v8, vs. a 0.3% regression
              on SunSpider.  Given none of the tests that show regressions
              demonstrate a regression on their own, and sampling shows up nothing.
              I suspect we're just getting one or two additional gc passes at
              the end of the run.
      
              * bytecode/CodeBlock.cpp:
              (JSC::CodeBlock::dump):
              (JSC::CodeBlock::CodeBlock):
              (JSC::EvalCodeCache::markAggregate):
              (JSC::CodeBlock::markAggregate):
              * bytecode/CodeBlock.h:
              (JSC::CodeBlock::ownerExecutable):
              (JSC::CodeBlock::addConstant):
              (JSC::CodeBlock::constantRegister):
              (JSC::CodeBlock::getConstant):
              (JSC::CodeBlock::addFunctionDecl):
              (JSC::CodeBlock::addFunctionExpr):
              (JSC::GlobalCodeBlock::GlobalCodeBlock):
              (JSC::ExecState::r):
              * bytecode/EvalCodeCache.h:
              (JSC::EvalCodeCache::get):
              * bytecode/SamplingTool.h:
              (JSC::ScriptSampleRecord::ScriptSampleRecord):
              * bytecompiler/BytecodeGenerator.cpp:
              (JSC::BytecodeGenerator::addConstantValue):
              (JSC::BytecodeGenerator::emitEqualityOp):
              * bytecompiler/BytecodeGenerator.h:
              (JSC::BytecodeGenerator::makeFunction):
              * debugger/Debugger.cpp:
              (JSC::evaluateInGlobalCallFrame):
              * debugger/DebuggerCallFrame.cpp:
              (JSC::DebuggerCallFrame::evaluate):
              * interpreter/Interpreter.cpp:
              (JSC::Interpreter::callEval):
              * jit/JITInlineMethods.h:
              (JSC::JIT::emitLoadDouble):
              (JSC::JIT::emitLoadInt32ToDouble):
              * jit/JITStubs.cpp:
              (JSC::JITThunks::JITThunks):
              (JSC::JITThunks::hostFunctionStub):
              (JSC::JITThunks::clearHostFunctionStubs):
              * jit/JITStubs.h:
              * runtime/Completion.cpp:
              (JSC::checkSyntax):
              (JSC::evaluate):
              * runtime/Executable.cpp:
              (JSC::EvalExecutable::EvalExecutable):
              (JSC::ProgramExecutable::ProgramExecutable):
              (JSC::FunctionExecutable::FunctionExecutable):
              (JSC::FunctionExecutable::~FunctionExecutable):
              (JSC::EvalExecutable::markChildren):
              (JSC::ProgramExecutable::markChildren):
              (JSC::FunctionExecutable::markChildren):
              (JSC::FunctionExecutable::fromGlobalCode):
              * runtime/Executable.h:
              (JSC::ExecutableBase::ExecutableBase):
              (JSC::ExecutableBase::createStructure):
              (JSC::NativeExecutable::create):
              (JSC::NativeExecutable::NativeExecutable):
              (JSC::VPtrHackExecutable::VPtrHackExecutable):
              (JSC::ScriptExecutable::ScriptExecutable):
              (JSC::EvalExecutable::create):
              (JSC::EvalExecutable::createStructure):
              (JSC::ProgramExecutable::create):
              (JSC::ProgramExecutable::createStructure):
              (JSC::FunctionExecutable::create):
              (JSC::FunctionExecutable::createStructure):
              * runtime/FunctionConstructor.cpp:
              (JSC::constructFunction):
              * runtime/Heap.cpp:
              (JSC::Heap::destroy):
              (JSC::Heap::markRoots):
              * runtime/Heap.h:
              * runtime/JSActivation.cpp:
              (JSC::JSActivation::JSActivation):
              (JSC::JSActivation::markChildren):
              * runtime/JSActivation.h:
              (JSC::JSActivation::JSActivationData::JSActivationData):
              * runtime/JSCell.h:
              * runtime/JSFunction.cpp:
              (JSC::JSFunction::JSFunction):
              (JSC::JSFunction::~JSFunction):
              (JSC::JSFunction::markChildren):
              * runtime/JSFunction.h:
              * runtime/JSGlobalData.cpp:
              (JSC::JSGlobalData::storeVPtrs):
              (JSC::JSGlobalData::JSGlobalData):
              (JSC::JSGlobalData::getHostFunction):
              * runtime/JSGlobalData.h:
              * runtime/JSGlobalObjectFunctions.cpp:
              (JSC::globalFuncEval):
              * runtime/JSObject.cpp:
              * runtime/JSStaticScopeObject.cpp:
              (JSC::JSStaticScopeObject::markChildren):
              * runtime/JSStaticScopeObject.h:
              (JSC::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData):
              (JSC::JSStaticScopeObject::JSStaticScopeObject):
              * runtime/JSZombie.cpp:
              (JSC::JSZombie::leakedZombieStructure):
              * runtime/JSZombie.h:
              (JSC::JSZombie::createStructure):
              * runtime/MarkedSpace.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ba10bec9