1. 30 Aug, 2013 1 commit
    • oliver@apple.com's avatar
      Make JSValue bool conversion less dangerous · 02fe0141
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120505
      
      Reviewed by Darin Adler.
      
      Source/JavaScriptCore:
      
      Replaces JSValue::operator bool() with a operator UnspecifiedBoolType* as
      we do elsewhere.  Then fix the places where terrible type coercion was
      happening.  All of the changes made had no fundamental behavioural impact
      as they were coercion results that were ignored (returning undefined
      after an exception).
      
      * dfg/DFGOperations.cpp:
      * interpreter/CallFrame.h:
      (JSC::ExecState::hadException):
      * runtime/JSCJSValue.h:
      * runtime/JSCJSValueInlines.h:
      (JSC::JSValue::operator UnspecifiedBoolType*):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncEval):
      * runtime/PropertyDescriptor.cpp:
      (JSC::PropertyDescriptor::equalTo)
      
      Source/WTF:
      
      Make LIKELY and UNLIKELY macros coerce to bool before
      passing to expect.
      
      * wtf/Compiler.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      02fe0141
  2. 26 Aug, 2013 1 commit
    • mhahnenberg@apple.com's avatar
      Object.defineProperty should be able to create a PropertyDescriptor where m_attributes == 0 · 6441bf1f
      mhahnenberg@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=120314
      
      Reviewed by Darin Adler.
      
      Currently with the way that defineProperty works, we leave a stray low bit set in 
      PropertyDescriptor::m_attributes in the following code:
      
      var o = {};
      Object.defineProperty(o, 100, {writable:true, enumerable:true, configurable:true, value:"foo"});
              
      This is due to the fact that the lowest non-zero attribute (ReadOnly) is represented as 1 << 1 
      instead of 1 << 0. We then calculate the default attributes as (DontDelete << 1) - 1, which is 0xF, 
      but only the top three bits mean anything. Even in the case above, the top three bits are set 
      to 0 but the bottom bit remains set, which causes us to think m_attributes is non-zero.
      
      Since some of these attributes and their corresponding values are exposed in the JavaScriptCore 
      framework's public C API, it's safer to just change how we calculate the default value, which is
      where the weirdness was originating from in the first place.
      
      * runtime/PropertyDescriptor.cpp:
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6441bf1f
  3. 13 Feb, 2013 1 commit
    • zandobersek@gmail.com's avatar
      The 'global isinf/isnan' compiler quirk required when using clang with libstdc++ · 9182d475
      zandobersek@gmail.com authored
      https://bugs.webkit.org/show_bug.cgi?id=109325
      
      Reviewed by Anders Carlsson.
      
      Prefix calls to the isinf and isnan methods with std::, declaring we want to use the
      two methods as they're provided by the C++ standard library being used.
      
      Source/JavaScriptCore: 
      
      * API/JSValueRef.cpp:
      (JSValueMakeNumber):
      * JSCTypedArrayStubs.h:
      (JSC):
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::BytecodeGenerator::emitLoad):
      * dfg/DFGByteCodeParser.cpp:
      (JSC::DFG::ByteCodeParser::constantNaN):
      * offlineasm/cloop.rb:
      * runtime/DateConstructor.cpp:
      (JSC::dateUTC): Also include an opportunistic style fix.
      * runtime/DateInstance.cpp:
      (JSC::DateInstance::calculateGregorianDateTime):
      (JSC::DateInstance::calculateGregorianDateTimeUTC):
      * runtime/DatePrototype.cpp:
      (JSC::dateProtoFuncGetMilliSeconds):
      (JSC::dateProtoFuncGetUTCMilliseconds):
      (JSC::setNewValueFromTimeArgs):
      (JSC::setNewValueFromDateArgs):
      (JSC::dateProtoFuncSetYear):
      * runtime/JSCJSValue.cpp:
      (JSC::JSValue::toInteger):
      * runtime/JSDateMath.cpp:
      (JSC::getUTCOffset):
      (JSC::parseDateFromNullTerminatedCharacters):
      (JSC::parseDate):
      * runtime/JSGlobalObjectFunctions.cpp:
      (JSC::globalFuncIsNaN):
      * runtime/MathObject.cpp:
      (JSC::mathProtoFuncMax):
      (JSC::mathProtoFuncMin):
      (JSC::mathProtoFuncPow):
      * runtime/PropertyDescriptor.cpp:
      (JSC::sameValue):
      
      Source/WebCore: 
      
      No new tests as there's no change in functionality.
      
      * Modules/mediasource/MediaSource.cpp:
      (WebCore::MediaSource::setDuration):
      * Modules/webaudio/AudioBufferSourceNode.cpp:
      (WebCore::AudioBufferSourceNode::totalPitchRate):
      * Modules/webaudio/AudioParam.cpp:
      (WebCore::AudioParam::setValue):
      * Modules/webaudio/AudioParamTimeline.cpp:
      (WebCore::isValidNumber):
      * Modules/webaudio/PannerNode.cpp:
      (WebCore::fixNANs):
      * bindings/js/IDBBindingUtilities.cpp:
      (WebCore::createIDBKeyFromValue):
      * bindings/js/JSDataViewCustom.cpp:
      (WebCore::getDataViewMember):
      * bindings/js/JSGeolocationCustom.cpp:
      (WebCore::setTimeout):
      (WebCore::setMaximumAge):
      * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
      (WebCore::JSHTMLOptionsCollection::setLength):
      * bindings/js/JSWebKitPointCustom.cpp:
      (WebCore::JSWebKitPointConstructor::constructJSWebKitPoint):
      * bindings/scripts/CodeGeneratorJS.pm:
      (GenerateImplementation):
      (GenerateParametersCheck):
      * bindings/scripts/CodeGeneratorV8.pm:
      (GenerateParametersCheck):
      * bindings/scripts/test/JS/JSFloat64Array.cpp:
      (WebCore::JSFloat64Array::getByIndex):
      * bindings/scripts/test/JS/JSTestObj.cpp:
      (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
      * bindings/scripts/test/V8/V8TestObj.cpp:
      (WebCore::TestObjV8Internal::classMethodWithClampCallback):
      * bindings/v8/IDBBindingUtilities.cpp:
      (WebCore::createIDBKeyFromValue):
      * bindings/v8/V8Binding.cpp:
      (WebCore::toInt32):
      (WebCore::toUInt32):
      * bindings/v8/custom/V8GeolocationCustom.cpp:
      (WebCore::createPositionOptions):
      * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
      (WebCore::V8HTMLOptionsCollection::lengthAccessorSetter):
      * bindings/v8/custom/V8WebKitPointCustom.cpp:
      (WebCore::V8WebKitPoint::constructorCallbackCustom):
      * bridge/qt/qt_runtime.cpp:
      (JSC::Bindings::convertValueToQVariant):
      * css/WebKitCSSMatrix.cpp:
      (WebCore::WebKitCSSMatrix::translate):
      (WebCore::WebKitCSSMatrix::scale):
      (WebCore::WebKitCSSMatrix::rotate):
      (WebCore::WebKitCSSMatrix::rotateAxisAngle):
      (WebCore::WebKitCSSMatrix::skewX):
      (WebCore::WebKitCSSMatrix::skewY):
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::percentLoaded):
      (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
      (WebCore::HTMLMediaElement::endedPlayback):
      * html/MediaController.cpp:
      (MediaController::duration):
      * html/canvas/WebGLRenderingContext.cpp:
      (WebCore):
      (WebCore::WebGLRenderingContext::clearColor):
      * html/track/TextTrack.cpp:
      (WebCore::TextTrack::addCue):
      * html/track/TextTrackCue.cpp:
      (WebCore::TextTrackCue::setStartTime):
      (WebCore::TextTrackCue::setEndTime):
      * page/DOMWindow.cpp:
      (WebCore::DOMWindow::adjustWindowRect):
      * page/WindowFeatures.cpp:
      (WebCore::WindowFeatures::floatFeature): Also include an opportunistic style fix.
      * platform/CalculationValue.cpp:
      (WebCore::CalculationValue::evaluate):
      * platform/Decimal.cpp:
      (WebCore::Decimal::fromDouble):
      * platform/Length.cpp:
      (WebCore::Length::nonNanCalculatedValue):
      * platform/audio/AudioResampler.cpp:
      (WebCore::AudioResampler::setRate):
      * platform/audio/DynamicsCompressorKernel.cpp:
      (WebCore::DynamicsCompressorKernel::process):
      * platform/audio/Reverb.cpp:
      (WebCore::calculateNormalizationScale):
      * platform/graphics/Font.cpp:
      (WebCore::Font::width):
      * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
      (WebCore::MediaPlayerPrivateAVFoundation::isLiveStream):
      * platform/graphics/gpu/LoopBlinnMathUtils.cpp:
      (LoopBlinnMathUtils):
      * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
      (WebCore::MediaPlayerPrivateGStreamer::buffered):
      (WebCore::MediaPlayerPrivateGStreamer::maxTimeSeekable):
      * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
      (WebCore::MediaPlayerPrivateQTKit::maxTimeSeekable):
      * platform/graphics/opentype/OpenTypeVerticalData.cpp:
      (WebCore::OpenTypeVerticalData::getVerticalTranslationsForGlyphs):
      * platform/graphics/transforms/TransformationMatrix.cpp:
      (WebCore::clampEdgeValue):
      (WebCore::TransformationMatrix::clampedBoundsOfProjectedQuad):
      * platform/network/ResourceResponseBase.cpp:
      (WebCore::ResourceResponseBase::parseCacheControlDirectives):
      * rendering/RenderMediaControlsChromium.cpp:
      (WebCore::paintMediaSlider):
      (WebCore::paintMediaVolumeSlider):
      * rendering/RenderThemeMac.mm:
      (WebCore::RenderThemeMac::paintMediaSliderTrack):
      * svg/SVGAnimationElement.cpp:
      (WebCore::SVGAnimationElement::beginElementAt):
      (WebCore::SVGAnimationElement::endElementAt):
      * svg/SVGSVGElement.cpp:
      (WebCore::SVGSVGElement::setCurrentTime):
      * svg/animation/SMILTime.h:
      (WebCore::SMILTime::SMILTime):
      * svg/animation/SVGSMILElement.cpp:
      (WebCore::SVGSMILElement::addBeginTime):
      (WebCore::SVGSMILElement::addEndTime):
      * xml/XPathFunctions.cpp:
      (WebCore::XPath::FunSubstring::evaluate):
      (WebCore::XPath::FunRound::round):
      * xml/XPathValue.cpp:
      (WebCore::XPath::Value::toBoolean): Also include an opportunistic style fix.
      (WebCore::XPath::Value::toString):
      
      Source/WebKit/chromium: 
      
      * tests/DecimalTest.cpp:
      (TEST_F):
      
      Source/WebKit/mac: 
      
      * tests/DecimalTest.cpp:
      (TEST_F):
      
      Source/WTF: 
      
      * wtf/Compiler.h: Remove the global isinf/isnan compiler quirk definitions. They're not required anymore.
      * wtf/DateMath.cpp: Move the workaround for isinf on Solaris into the std namespace. Ditto for isinf and isnan
      when using MSVC. Stop bringing the isinf and isnan methods into the global scope when using other configurations.
      (WTF::parseDateFromNullTerminatedCharacters):
      * wtf/IntegralTypedArrayBase.h:
      (WTF::IntegralTypedArrayBase::set):
      * wtf/MathExtras.h:
      (std):
      (std::isinf):
      (wtf_fmod):
      (wtf_pow):
      (doubleToInteger):
      * wtf/MediaTime.cpp:
      (WTF::MediaTime::createWithFloat):
      (WTF::MediaTime::createWithDouble):
      * wtf/Uint8ClampedArray.h:
      (WTF::Uint8ClampedArray::set):
      
      Tools: 
      
      * DumpRenderTree/TestRunner.cpp:
      (setAppCacheMaximumSizeCallback):
      (setApplicationCacheOriginQuotaCallback):
      (setDatabaseQuotaCallback):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9182d475
  4. 29 Feb, 2012 1 commit
  5. 16 Feb, 2012 1 commit
  6. 12 Jan, 2012 1 commit
    • barraclough@apple.com's avatar
      Allow accessor get/set property to be set to undefined · c709a123
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=76148
      
      Reviewed by Oliver Hunt.
      
      Source/JavaScriptCore: 
      
      AccessorDescriptor properties may have their get & set properties defined to reference a function
      (Callable object) or be set to undefined. Valid PropertyDescriptors created by toPropertyDescriptor
      (defined from JS code via Object.defineProperty, etc) have get and set properties that are in one of
      three states (1) nonexistent, (2) set to undefined, or (3) a function (any Callable object).
      
      On the PropertyDescriptor object these three states are represneted by JSValue(), jsUndefined(), and
      any JSObject* (with a constraint that this must be callable).
      
      Logically the get/set property of an accessor descriptor on an object might be in any of the three
      states above, but in practice there is no way to distinguish between the first two states. As such
      we stor the get/set values in property storage in a JSObject* field, with 0 indicating absent or
      undefined. When unboxing to a PropertyDescriptor, map this back to a JS undefined value.
      
      * runtime/GetterSetter.h:
      (JSC::GetterSetter::setGetter):
      (JSC::GetterSetter::setSetter):
          - Allow the getter/setter to be cleared.
      * runtime/JSArray.cpp:
      (JSC::JSArray::putDescriptor):
          - Changed to call getterObject/setterObject.
      (JSC::JSArray::defineOwnNumericProperty):
          - Added ASSERT.
      * runtime/JSObject.cpp:
      (JSC::putDescriptor):
      (JSC::JSObject::defineOwnProperty):
          - Changed to call getterObject/setterObject.
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorGetOwnPropertyDescriptor):
          - getter/setter values read from properties on object are never missing, they will now be set as undefined by 'setDescriptor'.
      (JSC::toPropertyDescriptor):
          - Do not translate undefined->empty, this loses an important distinction between a get/set property being absent, or being explicitly set to undefined.
      * runtime/PropertyDescriptor.cpp:
      (JSC::PropertyDescriptor::getterObject):
      (JSC::PropertyDescriptor::setterObject):
          - Accessors to convert the get/set property to an object pointer, converting undefined to 0.
      (JSC::PropertyDescriptor::setDescriptor):
      (JSC::PropertyDescriptor::setAccessorDescriptor):
          - Translate a getter/setter internally represented at 0 to undefined, indicating that it is present.
      * runtime/PropertyDescriptor.h:
          - Declare getterObject/setterObject.
      
      LayoutTests: 
      
      * fast/js/Object-defineProperty-expected.txt:
      * fast/js/script-tests/Object-defineProperty.js:
          - Update a couple of inaccurate tests (it is invalid for a property to have
            both a get: and value: field; AccessorDescritor properties do not have a
            writable property). Add more test cases.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c709a123
  7. 11 Jan, 2012 1 commit
    • barraclough@apple.com's avatar
      Merge 'Getter'/'Setter' attributes into 'Accessor' · bebfe4db
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=76141
      
      Reviewed by Filip Pizlo.
      
      These are currently ambiguous (and used inconsistently). It would logically appear
      that either being bit set implies that the corresponding type of accessor is present
      but (a) we don't correctly enforce this, and (b) this means the attributes would not
      be able to distinguish between a data descriptor and an accessor descriptor with
      neither a getter nor setter defined (which is a descriptor permissible under the spec).
      This ambiguity would lead to unsafe property caching behavior (though this does not
      represent an actual current bug, since we are currently unable to create descriptors
      that have neither a getter nor setter, it just prevents us from doing so).
      
      * runtime/Arguments.cpp:
      (JSC::Arguments::createStrictModeCallerIfNecessary):
      (JSC::Arguments::createStrictModeCalleeIfNecessary):
      * runtime/JSArray.cpp:
      (JSC::SparseArrayValueMap::put):
      (JSC::JSArray::putDescriptor):
      * runtime/JSBoundFunction.cpp:
      (JSC::JSBoundFunction::finishCreation):
      * runtime/JSFunction.cpp:
      (JSC::JSFunction::getOwnPropertySlot):
      (JSC::JSFunction::getOwnPropertyDescriptor):
      * runtime/JSObject.cpp:
      (JSC::JSObject::defineGetter):
      (JSC::JSObject::initializeGetterSetterProperty):
      (JSC::JSObject::defineSetter):
      (JSC::putDescriptor):
      (JSC::JSObject::defineOwnProperty):
      * runtime/JSObject.h:
      * runtime/ObjectConstructor.cpp:
      (JSC::objectConstructorDefineProperty):
      * runtime/PropertyDescriptor.cpp:
      (JSC::PropertyDescriptor::setDescriptor):
      (JSC::PropertyDescriptor::setAccessorDescriptor):
      (JSC::PropertyDescriptor::setSetter):
      (JSC::PropertyDescriptor::setGetter):
      (JSC::PropertyDescriptor::attributesOverridingCurrent):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      bebfe4db
  8. 10 Jan, 2012 1 commit
    • barraclough@apple.com's avatar
      Use SameValue to compare property descriptor values · beb7f228
      barraclough@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=75975
      
      Reviewed by Sam Weinig.
      
      Source/JavaScriptCore: 
      
      Rather than strictEqual.
      
      * runtime/JSArray.cpp:
      (JSC::JSArray::defineOwnNumericProperty):
          - Missing configurablePresent() check.
      * runtime/JSObject.cpp:
      (JSC::JSObject::defineOwnProperty):
          - call sameValue.
      * runtime/PropertyDescriptor.cpp:
      (JSC::sameValue):
          - Moved from JSArray.cpp, fix NaN comparison.
      (JSC::PropertyDescriptor::equalTo):
          - call sameValue.
      * runtime/PropertyDescriptor.h:
          - Added declaration for sameValue.
      
      LayoutTests: 
      
      * fast/js/array-defineOwnProperty-expected.txt:
      * fast/js/script-tests/array-defineOwnProperty.js:
          - Add new test cases.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      beb7f228
  9. 09 Jan, 2012 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=75789 · 166c9077
      barraclough@apple.com authored
      defineOwnProperty not implemented for Array objects
      
      Reviewed by Sam Weinig.
      
      Source/JavaScriptCore: 
      
      Implements support for getter/setter & non-default attribute properties on arrays,
      by forcing them into a dictionary-like 'SparseMode'. This fixes ~300 test-262
      test failures.
      
      * JavaScriptCore.exp:
          - Updated exports.
      * dfg/DFGOperations.cpp:
          - JSArray::pop now requires an exec state.
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncPop):
          - JSArray::pop now requires an exec state.
      * runtime/JSArray.cpp:
      (JSC::SparseArrayValueMap::add):
          - Add a potentially empty entry into the map.
      (JSC::SparseArrayValueMap::put):
          - Changed to call setter.
      (JSC::SparseArrayEntry::get):
          - calls getters.
      (JSC::SparseArrayEntry::getNonSparseMode):
          - does not call getters.
      (JSC::JSArray::enterSparseMode):
          - Convert into 'SparseMode' - removes the vectors, don't allow it to be recreated.
      (JSC::JSArray::putDescriptor):
          - Create a numeric property based on a descriptor.
      (JSC::sameValue):
          - See ES5.1 9.12.
      (JSC::reject):
          - Helper for the [[DefineOwnProperty]] algorithm.
      (JSC::JSArray::defineOwnNumericProperty):
          - Define an indexed property on an array object.
      (JSC::JSArray::setLengthWritable):
          - Marks the length read-only, enters SparseMode as necessary.
      (JSC::JSArray::defineOwnProperty):
          - Defines either an indexed property or 'length' on an array object.
      (JSC::JSArray::getOwnPropertySlotByIndex):
          - Updated to correctly handle accessor descriptors & attributes.
      (JSC::JSArray::getOwnPropertyDescriptor):
          - Updated to correctly handle accessor descriptors & attributes.
      (JSC::JSArray::put):
          - Pass strict mode flag to setLength.
      (JSC::JSArray::putByIndex):
          - putByIndexBeyondVectorLength requires an ExecState* rather than a JSGloablData&.
      (JSC::JSArray::putByIndexBeyondVectorLength):
          - Pass exec to SparseArrayValueMap::put.
      (JSC::JSArray::deletePropertyByIndex):
          - Do not allow deletion of non-configurable properties.
      (JSC::compareKeysForQSort):
          - used in implementation of getOwnPropertyNames.
      (JSC::JSArray::getOwnPropertyNames):
          - Properties in the sparse map should be iterated in order.
      (JSC::JSArray::setLength):
          - Updated to take a 'shouldThrow' flag, return a result indicating error.
      (JSC::JSArray::pop):
          - pop should throw an error if length is not writable, even if the array is empty.
      (JSC::JSArray::push):
          - putByIndexBeyondVectorLength requires an ExecState* rather than a JSGloablData&.
      (JSC::JSArray::sort):
          - Changed 'get' to 'getNonSparseMode' (can't be getters to call).
      (JSC::JSArray::compactForSorting):
          - Changed 'get' to 'getNonSparseMode' (can't be getters to call).
      * runtime/JSArray.h:
      (JSC::SparseArrayValueMap::lengthIsReadOnly):
          - Check if the length is read only.
      (JSC::SparseArrayValueMap::setLengthIsReadOnly):
          - Mark the length as read only.
      (JSC::SparseArrayValueMap::find):
          - Moved into header.
      (JSC::JSArray::isLengthWritable):
          - Wraps SparseArrayValueMap::lengthIsReadOnly.
      * runtime/JSObject.cpp:
      (JSC::JSObject::defineOwnProperty):
          - Should be returning the result of putDescriptor.
      * runtime/PropertyDescriptor.cpp:
      (JSC::PropertyDescriptor::attributesOverridingCurrent):
          - Added attributesOverridingCurrent - this should probably be merged with attributesWithOverride.
      * runtime/PropertyDescriptor.h:
          - Added attributesOverridingCurrent.
      
      LayoutTests: 
      
      * fast/js/array-defineOwnProperty-expected.txt: Added.
      * fast/js/array-defineOwnProperty.html: Added.
      * fast/js/script-tests/array-defineOwnProperty.js: Added.
          - Added tests for array properties with accessors & non-defulat attributes.
      * fast/js/mozilla/strict/15.4.4.6-expected.txt:
      * fast/js/mozilla/strict/8.12.5-expected.txt:
      * ietestcenter/Javascript/15.4.4.14-9-a-12-expected.txt:
      * ietestcenter/Javascript/15.4.4.15-8-a-12-expected.txt:
          - Check in passing results.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      166c9077
  10. 03 Jan, 2012 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=75429 · bfdffec8
      barraclough@apple.com authored
      ThrowTypeError should be a singleton object
      
      Reviewed by Sam Weinig.
      
      Source/JavaScriptCore: 
      
      Per section 13.2.3 of the spec.
      We could change setAccessorDescriptor to be able to share the global
      GetterSetter object, rather than storing the accessor functions and
      creating a new GetterSetter in defineProperty - but this won't be a
      small change to PropertyDescriptors (and would probably mean making
      GetterSetter objects immutable?) - so I'll leave that for another
      patch.
      
      * JavaScriptCore.exp:
          - don't export setAccessorDescriptor
      * runtime/Arguments.cpp:
      (JSC::Arguments::createStrictModeCallerIfNecessary):
      (JSC::Arguments::createStrictModeCalleeIfNecessary):
          - call throwTypeErrorGetterSetter instead of createTypeErrorFunction
      * runtime/Error.cpp:
      * runtime/Error.h:
          - remove createTypeErrorFunction
      * runtime/JSFunction.cpp:
      * runtime/JSFunction.h:
          - remove unused createDescriptorForThrowingProperty
      * runtime/JSGlobalObject.cpp:
      (JSC::JSGlobalObject::reset):
      (JSC::JSGlobalObject::visitChildren):
          - removed m_strictModeTypeErrorFunctionStructure.
      * runtime/JSGlobalObject.h:
      (JSC::JSGlobalObject::internalFunctionStructure):
          - removed m_strictModeTypeErrorFunctionStructure.
      * runtime/PropertyDescriptor.cpp:
      (JSC::PropertyDescriptor::setAccessorDescriptor):
          - changed to take a GetterSetter
      * runtime/PropertyDescriptor.h:
          - changed to take a GetterSetter
      
      LayoutTests: 
      
      Per section 13.2.3 of the spec.
      
      * fast/js/basic-strict-mode-expected.txt:
          - ThrowTypeError is a singleton, so cannot generate
            property-specific error messages.
      * fast/js/script-tests/strict-throw-type-error.js: Added.
      * fast/js/strict-throw-type-error-expected.txt: Added.
      * fast/js/strict-throw-type-error.html: Added.
          - added test case that ThrowTypeError is a singleton
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103958 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      bfdffec8
  11. 02 Nov, 2011 1 commit
  12. 01 Jan, 2011 1 commit
    • abarth@webkit.org's avatar
      Move JavaScriptCore to Source · 76da8fc1
      abarth@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=51604
      
      Reviewed by Eric Seidel.
      
      Update references to JavaScriptCore to point to the new location.
      
      * Android.mk:
      * CMakeLists.txt:
      * DerivedSources.pro:
      * GNUmakefile.am:
      * Makefile:
      * WebKit.pri:
      * WebKit.pro:
      * wscript:
      
      Tools: 
      
      Update references to JavaScriptCore to point to the new location.
      
      * BuildSlaveSupport/build.webkit.org-config/master.cfg:
      * DumpRenderTree/qt/DumpRenderTree.pro:
      * DumpRenderTree/qt/ImageDiff.pro:
      * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
      * DumpRenderTree/wscript:
      * Scripts/build-jsc:
      * Scripts/build-webkit:
      * Scripts/do-file-rename:
      * Scripts/do-webcore-rename:
      * Scripts/run-javascriptcore-tests:
      * Scripts/update-javascriptcore-test-results:
      * Scripts/webkitdirs.pm:
      * Scripts/webkitpy/common/config/build_unittest.py:
      * Scripts/webkitpy/style/checker.py:
      * Scripts/webkitpy/style/checker_unittest.py:
      * Scripts/webkitpy/style/checkers/cpp_unittest.py:
      * WebKitTestRunner/InjectedBundle/qt/InjectedBundle.pro:
      * WebKitTestRunner/qt/WebKitTestRunner.pro:
      * wx/build/settings.py:
      
      WebCore: 
      
      Update references to JavaScriptCore.
      
      * Android.derived.jscbindings.mk:
      * Android.v8bindings.mk:
      * CMakeLists.txt:
      * WebCore.gyp/WebCore.gyp:
      * WebCore.pro:
        - These changes are subtle and might not be 100% correct.
      * move-js-headers.sh:
      
      WebKit/chromium: 
      
      * WebKit.gyp:
        - Point to JavaScriptCore in its new location.
      
      WebKit/gtk: 
      
      * GNUmakefile.am:
      * docs/GNUmakefile.am:
        - Point to JavaScriptCore in its new location.
      
      WebKit/qt: 
      
      * WebKit_pch.h:
      * docs/qtwebkit.qdocconf:
        - Point to JavaScriptCore in its new location.
      
      WebKit/win: 
      
      * WebKit.vcproj/WebKit.sln:
        - Point to JavaScriptCore in its new location.
      
      WebKit/wx: 
      
      * bindings/python/wscript:
      * wscript:
        - Point to JavaScriptCore in its new location.
      
      WebKit2: 
      
      * WebKit2.pro:
        - Point to JavaScriptCore in its new location.
      
      Websites/bugs.webkit.org: 
      
      * PrettyPatch/PrettyPatch.rb:
        - Remove reference to JavaScriptCore as a source directory.
      
      Websites/webkit.org: 
      
      * coding/assertion-guidelines.html:
        - Update documentation to point to the new location of
          JavaScriptCore.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74855 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      76da8fc1
  13. 07 Dec, 2009 1 commit
    • barraclough@apple.com's avatar
      https://bugs.webkit.org/show_bug.cgi?id=32184 · b749f0bb
      barraclough@apple.com authored
      Handle out-of-memory conditions with JSC Ropes with a JS exception, rather than crashing.
      Switch from using fastMalloc to tryFastMalloc, pass an ExecState to record the exception on.
      
      Reviewed by Oliver Hunt.
      
      JavaScriptCore: 
      
      * API/JSCallbackObjectFunctions.h:
      (JSC::::toString):
      * API/JSValueRef.cpp:
      (JSValueIsStrictEqual):
      * JavaScriptCore.exp:
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::BytecodeGenerator::emitEqualityOp):
      * debugger/DebuggerCallFrame.cpp:
      (JSC::DebuggerCallFrame::functionName):
      (JSC::DebuggerCallFrame::calculatedFunctionName):
      * interpreter/Interpreter.cpp:
      (JSC::Interpreter::callEval):
      (JSC::Interpreter::privateExecute):
      * jit/JITStubs.cpp:
      (JSC::DEFINE_STUB_FUNCTION):
      * profiler/ProfileGenerator.cpp:
      (JSC::ProfileGenerator::addParentForConsoleStart):
      * profiler/Profiler.cpp:
      (JSC::Profiler::willExecute):
      (JSC::Profiler::didExecute):
      (JSC::Profiler::createCallIdentifier):
      (JSC::createCallIdentifierFromFunctionImp):
      * profiler/Profiler.h:
      * runtime/ArrayPrototype.cpp:
      (JSC::arrayProtoFuncIndexOf):
      (JSC::arrayProtoFuncLastIndexOf):
      * runtime/DateConstructor.cpp:
      (JSC::constructDate):
      * runtime/FunctionPrototype.cpp:
      (JSC::functionProtoFuncToString):
      * runtime/InternalFunction.cpp:
      (JSC::InternalFunction::name):
      (JSC::InternalFunction::displayName):
      (JSC::InternalFunction::calculatedDisplayName):
      * runtime/InternalFunction.h:
      * runtime/JSCell.cpp:
      (JSC::JSCell::getString):
      * runtime/JSCell.h:
      (JSC::JSValue::getString):
      * runtime/JSONObject.cpp:
      (JSC::gap):
      (JSC::Stringifier::Stringifier):
      (JSC::Stringifier::appendStringifiedValue):
      * runtime/JSObject.cpp:
      (JSC::JSObject::putDirectFunction):
      (JSC::JSObject::putDirectFunctionWithoutTransition):
      (JSC::JSObject::defineOwnProperty):
      * runtime/JSObject.h:
      * runtime/JSPropertyNameIterator.cpp:
      (JSC::JSPropertyNameIterator::get):
      * runtime/JSString.cpp:
      (JSC::JSString::Rope::~Rope):
      (JSC::JSString::resolveRope):
      (JSC::JSString::getPrimitiveNumber):
      (JSC::JSString::toNumber):
      (JSC::JSString::toString):
      (JSC::JSString::toThisString):
      (JSC::JSString::getStringPropertyDescriptor):
      * runtime/JSString.h:
      (JSC::JSString::Rope::createOrNull):
      (JSC::JSString::Rope::operator new):
      (JSC::JSString::value):
      (JSC::JSString::tryGetValue):
      (JSC::JSString::getIndex):
      (JSC::JSString::getStringPropertySlot):
      (JSC::JSValue::toString):
      * runtime/JSValue.h:
      * runtime/NativeErrorConstructor.cpp:
      (JSC::NativeErrorConstructor::NativeErrorConstructor):
      * runtime/Operations.cpp:
      (JSC::JSValue::strictEqualSlowCase):
      * runtime/Operations.h:
      (JSC::JSValue::equalSlowCaseInline):
      (JSC::JSValue::strictEqualSlowCaseInline):
      (JSC::JSValue::strictEqual):
      (JSC::jsLess):
      (JSC::jsLessEq):
      (JSC::jsAdd):
      (JSC::concatenateStrings):
      * runtime/PropertyDescriptor.cpp:
      (JSC::PropertyDescriptor::equalTo):
      * runtime/PropertyDescriptor.h:
      * runtime/StringPrototype.cpp:
      (JSC::stringProtoFuncReplace):
      (JSC::stringProtoFuncToLowerCase):
      (JSC::stringProtoFuncToUpperCase):
      
      WebCore: 
      
      * bindings/ScriptControllerBase.cpp:
      (WebCore::ScriptController::executeIfJavaScriptURL):
      * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
      (WebCore::toHTMLCanvasStyle):
      (WebCore::JSCanvasRenderingContext2D::setFillColor):
      (WebCore::JSCanvasRenderingContext2D::setStrokeColor):
      (WebCore::JSCanvasRenderingContext2D::setShadow):
      * bindings/js/ScriptCallStack.cpp:
      (WebCore::ScriptCallStack::ScriptCallStack):
      (WebCore::ScriptCallStack::initialize):
      * bindings/js/ScriptValue.cpp:
      (WebCore::ScriptValue::getString):
      * bindings/js/ScriptValue.h:
      * bindings/js/SerializedScriptValue.cpp:
      (WebCore::SerializingTreeWalker::convertIfTerminal):
      * bindings/objc/WebScriptObject.mm:
      (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
      * page/Console.cpp:
      (WebCore::Console::addMessage):
      
      WebKit/mac: 
      
      * WebView/WebView.mm:
      (aeDescFromJSValue):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b749f0bb
  14. 18 Sep, 2009 1 commit
  15. 26 Aug, 2009 1 commit
    • oliver@apple.com's avatar
      [ES5] Implement getOwnPropertyDescriptor · 4b4f785d
      oliver@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=28724
      
      Reviewed by Gavin Barraclough.
      
      JavaScriptCore:
      Implement the core runtime support for getOwnPropertyDescriptor.
      This adds a virtual getOwnPropertyDescriptor method to every class
      that implements getOwnPropertySlot that shadows the behaviour of
      getOwnPropertySlot.  The alternative would be to make getOwnPropertySlot
      (or PropertySlots in general) provide property attribute information,
      but quick testing showed this to be a regression.
      
      WebCore:
      Implement the WebCore side of getOwnPropertyDescriptor.  This
      requires a custom implementation of getOwnPropertyDescriptor
      for every class with a custom implementation of getOwnPropertySlot.
      
      The bindings generator has been updated to generate appropriate
      versions of getOwnPropertyDescriptor for the general case where
      a custom getOwnPropertyDescriptor is not needed.  ES5 is vague
      about how getOwnPropertyDescriptor should work in the context of
      "host" functions with polymorphic [[GetOwnProperty]], so it seems
      okay that occasionally we "guess" what attributes -- eg. determining
      whether a property is writable.
      
      Test: fast/js/getOwnPropertyDescriptor.html
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      4b4f785d