Changeset 160133 in webkit


Ignore:
Timestamp:
Dec 4, 2013 3:20:48 PM (10 years ago)
Author:
oliver@apple.com
Message:

Refactor static getter function prototype to include thisValue in addition to the base object
https://bugs.webkit.org/show_bug.cgi?id=124461

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Add thisValue parameter to static getter prototype, and switch
from JSValue to EncodedJSValue for parameters and return value.

Currently none of the static getters use the thisValue, but
separating out the refactoring will prevent future changes
from getting lost in the noise of refactoring. This means
that this patch does not result in any change in behaviour.

  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:

(JSC::::asCallbackObject):
(JSC::::staticFunctionGetter):
(JSC::::callbackGetter):

  • jit/JITOperations.cpp:
  • runtime/JSActivation.cpp:

(JSC::JSActivation::argumentsGetter):

  • runtime/JSActivation.h:
  • runtime/JSFunction.cpp:

(JSC::JSFunction::argumentsGetter):
(JSC::JSFunction::callerGetter):
(JSC::JSFunction::lengthGetter):
(JSC::JSFunction::nameGetter):

  • runtime/JSFunction.h:
  • runtime/JSObject.h:

(JSC::PropertySlot::getValue):

  • runtime/NumberConstructor.cpp:

(JSC::numberConstructorNaNValue):
(JSC::numberConstructorNegInfinity):
(JSC::numberConstructorPosInfinity):
(JSC::numberConstructorMaxValue):
(JSC::numberConstructorMinValue):

  • runtime/PropertySlot.h:
  • runtime/RegExpConstructor.cpp:

(JSC::asRegExpConstructor):
(JSC::regExpConstructorDollar1):
(JSC::regExpConstructorDollar2):
(JSC::regExpConstructorDollar3):
(JSC::regExpConstructorDollar4):
(JSC::regExpConstructorDollar5):
(JSC::regExpConstructorDollar6):
(JSC::regExpConstructorDollar7):
(JSC::regExpConstructorDollar8):
(JSC::regExpConstructorDollar9):
(JSC::regExpConstructorInput):
(JSC::regExpConstructorMultiline):
(JSC::regExpConstructorLastMatch):
(JSC::regExpConstructorLastParen):
(JSC::regExpConstructorLeftContext):
(JSC::regExpConstructorRightContext):

  • runtime/RegExpObject.cpp:

(JSC::asRegExpObject):
(JSC::regExpObjectGlobal):
(JSC::regExpObjectIgnoreCase):
(JSC::regExpObjectMultiline):
(JSC::regExpObjectSource):

Source/WebCore:

Change bindings codegen to produce static getter functions
with the correct types. Also update the many custom implementations
to the new type.

No change in behaviour.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::cssPropertyGetterPixelOrPosPrefixCallback):
(WebCore::cssPropertyGetterCallback):

  • bindings/js/JSDOMBinding.cpp:

(WebCore::objectToStringFunctionGetter):

  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMMimeTypeArrayCustom.cpp:

(WebCore::JSDOMMimeTypeArray::nameGetter):

  • bindings/js/JSDOMPluginArrayCustom.cpp:

(WebCore::JSDOMPluginArray::nameGetter):

  • bindings/js/JSDOMPluginCustom.cpp:

(WebCore::JSDOMPlugin::nameGetter):

  • bindings/js/JSDOMStringMapCustom.cpp:

(WebCore::JSDOMStringMap::nameGetter):

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::nonCachingStaticFunctionGetter):
(WebCore::childFrameGetter):
(WebCore::indexGetter):
(WebCore::namedItemGetter):

  • bindings/js/JSHTMLAllCollectionCustom.cpp:

(WebCore::JSHTMLAllCollection::nameGetter):

  • bindings/js/JSHTMLCollectionCustom.cpp:

(WebCore::JSHTMLCollection::nameGetter):

  • bindings/js/JSHTMLDocumentCustom.cpp:

(WebCore::JSHTMLDocument::nameGetter):

  • bindings/js/JSHTMLFormControlsCollectionCustom.cpp:

(WebCore::JSHTMLFormControlsCollection::nameGetter):

  • bindings/js/JSHTMLFormElementCustom.cpp:

(WebCore::JSHTMLFormElement::nameGetter):

  • bindings/js/JSHTMLFrameSetElementCustom.cpp:

(WebCore::JSHTMLFrameSetElement::nameGetter):

  • bindings/js/JSHistoryCustom.cpp:

(WebCore::nonCachingStaticBackFunctionGetter):
(WebCore::nonCachingStaticForwardFunctionGetter):
(WebCore::nonCachingStaticGoFunctionGetter):

  • bindings/js/JSJavaScriptCallFrameCustom.cpp:

(WebCore::JSJavaScriptCallFrame::scopeType):

  • bindings/js/JSLocationCustom.cpp:

(WebCore::nonCachingStaticReplaceFunctionGetter):
(WebCore::nonCachingStaticReloadFunctionGetter):
(WebCore::nonCachingStaticAssignFunctionGetter):

  • bindings/js/JSNamedNodeMapCustom.cpp:

(WebCore::JSNamedNodeMap::nameGetter):

  • bindings/js/JSNodeListCustom.cpp:

(WebCore::JSNodeList::nameGetter):

  • bindings/js/JSPluginElementFunctions.cpp:

(WebCore::pluginElementPropertyGetter):

  • bindings/js/JSPluginElementFunctions.h:
  • bindings/js/JSRTCStatsResponseCustom.cpp:

(WebCore::JSRTCStatsResponse::nameGetter):

  • bindings/js/JSStorageCustom.cpp:

(WebCore::JSStorage::nameGetter):

  • bindings/js/JSStyleSheetListCustom.cpp:

(WebCore::JSStyleSheetList::nameGetter):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateImplementation):
(GenerateParametersCheck):

  • bridge/runtime_array.cpp:

(JSC::RuntimeArray::lengthGetter):
(JSC::RuntimeArray::indexGetter):

  • bridge/runtime_array.h:
  • bridge/runtime_method.cpp:

(JSC::RuntimeMethod::lengthGetter):

  • bridge/runtime_method.h:
  • bridge/runtime_object.cpp:

(JSC::Bindings::RuntimeObject::fallbackObjectGetter):
(JSC::Bindings::RuntimeObject::fieldGetter):
(JSC::Bindings::RuntimeObject::methodGetter):

  • bridge/runtime_object.h:

Source/WebKit2:

Update the WK2 JSC usage to the new static getter API

  • WebProcess/Plugins/Netscape/JSNPMethod.cpp:

(WebKit::callMethod):

  • WebProcess/Plugins/Netscape/JSNPObject.cpp:

(WebKit::callNPJSObject):
(WebKit::constructWithConstructor):
(WebKit::JSNPObject::propertyGetter):
(WebKit::JSNPObject::methodGetter):

  • WebProcess/Plugins/Netscape/JSNPObject.h:
  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::getOrCreateNPObject):
(WebKit::NPRuntimeObjectMap::finalize):

  • WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::frameForContext):
(WebKit::WebFrame::counterValue):

Location:
trunk/Source
Files:
51 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.h

    r157044 r160133  
    206206 
    207207    static JSCallbackObject* asCallbackObject(JSValue);
     208    static JSCallbackObject* asCallbackObject(EncodedJSValue);
    208209 
    209210    static EncodedJSValue JSC_HOST_CALL call(ExecState*);
     
    211212   
    212213    JSValue getStaticValue(ExecState*, PropertyName);
    213     static JSValue staticFunctionGetter(ExecState*, JSValue, PropertyName);
    214     static JSValue callbackGetter(ExecState*, JSValue, PropertyName);
     214    static EncodedJSValue staticFunctionGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     215    static EncodedJSValue callbackGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    215216
    216217    OwnPtr<JSCallbackObjectData> m_callbackObjectData;
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r156964 r160133  
    5151
    5252template <class Parent>
     53inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(EncodedJSValue value)
     54{
     55    ASSERT(asObject(JSValue::decode(value))->inherits(info()));
     56    return jsCast<JSCallbackObject*>(asObject(JSValue::decode(value)));
     57}
     58
     59template <class Parent>
    5360JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, Structure* structure, JSClassRef jsClass, void* data)
    5461    : Parent(exec->vm(), structure)
     
    585592
    586593template <class Parent>
    587 JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName)
     594EncodedJSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, EncodedJSValue slotParent, EncodedJSValue, PropertyName propertyName)
    588595{
    589596    JSCallbackObject* thisObj = asCallbackObject(slotParent);
     
    592599    PropertySlot slot2(thisObj);
    593600    if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2))
    594         return slot2.getValue(exec, propertyName);
     601        return JSValue::encode(slot2.getValue(exec, propertyName));
    595602
    596603    if (StringImpl* name = propertyName.publicName()) {
     
    602609                        JSObject* o = JSCallbackFunction::create(vm, thisObj->globalObject(), callAsFunction, name);
    603610                        thisObj->putDirect(vm, propertyName, o, entry->attributes);
    604                         return o;
     611                        return JSValue::encode(o);
    605612                    }
    606613                }
     
    609616    }
    610617
    611     return exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("Static function property defined with NULL callAsFunction callback.")));
    612 }
    613 
    614 template <class Parent>
    615 JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName)
     618    return JSValue::encode(exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("Static function property defined with NULL callAsFunction callback."))));
     619}
     620
     621template <class Parent>
     622EncodedJSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, EncodedJSValue slotParent, EncodedJSValue, PropertyName propertyName)
    616623{
    617624    JSCallbackObject* thisObj = asCallbackObject(slotParent);
     
    633640                if (exception) {
    634641                    exec->vm().throwException(exec, toJS(exec, exception));
    635                     return jsUndefined();
     642                    return JSValue::encode(jsUndefined());
    636643                }
    637644                if (value)
    638                     return toJS(exec, value);
    639             }
    640         }
    641     }
    642 
    643     return exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("hasProperty callback returned true for a property that doesn't exist.")));
     645                    return JSValue::encode(toJS(exec, value));
     646            }
     647        }
     648    }
     649
     650    return JSValue::encode(exec->vm().throwException(exec, createReferenceError(exec, ASCIILiteral("hasProperty callback returned true for a property that doesn't exist."))));
    644651}
    645652
  • trunk/Source/JavaScriptCore/ChangeLog

    r160131 r160133  
     12013-12-04  Oliver Hunt  <oliver@apple.com>
     2
     3        Refactor static getter function prototype to include thisValue in addition to the base object
     4        https://bugs.webkit.org/show_bug.cgi?id=124461
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add thisValue parameter to static getter prototype, and switch
     9        from JSValue to EncodedJSValue for parameters and return value.
     10
     11        Currently none of the static getters use the thisValue, but
     12        separating out the refactoring will prevent future changes
     13        from getting lost in the noise of refactoring.  This means
     14        that this patch does not result in any change in behaviour.
     15
     16        * API/JSCallbackObject.h:
     17        * API/JSCallbackObjectFunctions.h:
     18        (JSC::::asCallbackObject):
     19        (JSC::::staticFunctionGetter):
     20        (JSC::::callbackGetter):
     21        * jit/JITOperations.cpp:
     22        * runtime/JSActivation.cpp:
     23        (JSC::JSActivation::argumentsGetter):
     24        * runtime/JSActivation.h:
     25        * runtime/JSFunction.cpp:
     26        (JSC::JSFunction::argumentsGetter):
     27        (JSC::JSFunction::callerGetter):
     28        (JSC::JSFunction::lengthGetter):
     29        (JSC::JSFunction::nameGetter):
     30        * runtime/JSFunction.h:
     31        * runtime/JSObject.h:
     32        (JSC::PropertySlot::getValue):
     33        * runtime/NumberConstructor.cpp:
     34        (JSC::numberConstructorNaNValue):
     35        (JSC::numberConstructorNegInfinity):
     36        (JSC::numberConstructorPosInfinity):
     37        (JSC::numberConstructorMaxValue):
     38        (JSC::numberConstructorMinValue):
     39        * runtime/PropertySlot.h:
     40        * runtime/RegExpConstructor.cpp:
     41        (JSC::asRegExpConstructor):
     42        (JSC::regExpConstructorDollar1):
     43        (JSC::regExpConstructorDollar2):
     44        (JSC::regExpConstructorDollar3):
     45        (JSC::regExpConstructorDollar4):
     46        (JSC::regExpConstructorDollar5):
     47        (JSC::regExpConstructorDollar6):
     48        (JSC::regExpConstructorDollar7):
     49        (JSC::regExpConstructorDollar8):
     50        (JSC::regExpConstructorDollar9):
     51        (JSC::regExpConstructorInput):
     52        (JSC::regExpConstructorMultiline):
     53        (JSC::regExpConstructorLastMatch):
     54        (JSC::regExpConstructorLastParen):
     55        (JSC::regExpConstructorLeftContext):
     56        (JSC::regExpConstructorRightContext):
     57        * runtime/RegExpObject.cpp:
     58        (JSC::asRegExpObject):
     59        (JSC::regExpObjectGlobal):
     60        (JSC::regExpObjectIgnoreCase):
     61        (JSC::regExpObjectMultiline):
     62        (JSC::regExpObjectSource):
     63
    1642013-12-04  Daniel Bates  <dabates@apple.com>
    265
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r160094 r160133  
    223223    Identifier ident(vm, uid);
    224224   
    225     return JSValue::encode(function(exec, asObject(base), ident));
     225    return function(exec, JSValue::encode(base), JSValue::encode(base), ident);
    226226}
    227227
  • trunk/Source/JavaScriptCore/runtime/JSActivation.cpp

    r156511 r160133  
    211211}
    212212
    213 JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, PropertyName)
    214 {
    215     JSActivation* activation = jsCast<JSActivation*>(slotBase);
     213EncodedJSValue JSActivation::argumentsGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     214{
     215    JSActivation* activation = jsCast<JSActivation*>(JSValue::decode(slotBase));
    216216    CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(activation->m_registers));
    217217    ASSERT(!activation->isTornOff() && (callFrame->codeBlock()->usesArguments() || callFrame->codeBlock()->usesEval()));
    218218    if (activation->isTornOff() || !(callFrame->codeBlock()->usesArguments() || callFrame->codeBlock()->usesEval()))
    219         return jsUndefined();
     219        return JSValue::encode(jsUndefined());
    220220
    221221    VirtualRegister argumentsRegister = callFrame->codeBlock()->argumentsRegister();
    222222    if (JSValue arguments = callFrame->uncheckedR(argumentsRegister.offset()).jsValue())
    223         return arguments;
     223        return JSValue::encode(arguments);
    224224    int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister).offset();
    225225
     
    229229   
    230230    ASSERT(callFrame->uncheckedR(realArgumentsRegister).jsValue().inherits(Arguments::info()));
    231     return callFrame->uncheckedR(realArgumentsRegister).jsValue();
     231    return JSValue::encode(callFrame->uncheckedR(realArgumentsRegister).jsValue());
    232232}
    233233
  • trunk/Source/JavaScriptCore/runtime/JSActivation.h

    r159942 r160133  
    101101    bool symbolTablePutWithAttributes(VM&, PropertyName, JSValue, unsigned attributes);
    102102
    103     static JSValue argumentsGetter(ExecState*, JSValue, PropertyName);
     103    static EncodedJSValue argumentsGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    104104
    105105    static size_t allocationSize(SymbolTable*);
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r159528 r160133  
    213213}
    214214
    215 JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, PropertyName)
    216 {
    217     JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
     215EncodedJSValue JSFunction::argumentsGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     216{
     217    JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
    218218    ASSERT(!thisObj->isHostFunction());
    219219
    220     return retrieveArguments(exec, thisObj);
     220    return JSValue::encode(retrieveArguments(exec, thisObj));
    221221}
    222222
     
    268268}
    269269
    270 JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, PropertyName)
    271 {
    272     JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
     270EncodedJSValue JSFunction::callerGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     271{
     272    JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
    273273    ASSERT(!thisObj->isHostFunction());
    274274    JSValue caller = retrieveCallerFunction(exec, thisObj);
     
    276276    // See ES5.1 15.3.5.4 - Function.caller may not be used to retrieve a strict caller.
    277277    if (!caller.isObject() || !asObject(caller)->inherits(JSFunction::info()))
    278         return caller;
     278        return JSValue::encode(caller);
    279279    JSFunction* function = jsCast<JSFunction*>(caller);
    280280    if (function->isHostFunction() || !function->jsExecutable()->isStrictMode())
    281         return caller;
    282     return throwTypeError(exec, ASCIILiteral("Function.caller used to retrieve strict caller"));
    283 }
    284 
    285 JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, PropertyName)
    286 {
    287     JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
     281        return JSValue::encode(caller);
     282    return JSValue::encode(throwTypeError(exec, ASCIILiteral("Function.caller used to retrieve strict caller")));
     283}
     284
     285EncodedJSValue JSFunction::lengthGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     286{
     287    JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
    288288    ASSERT(!thisObj->isHostFunction());
    289     return jsNumber(thisObj->jsExecutable()->parameterCount());
    290 }
    291 
    292 JSValue JSFunction::nameGetter(ExecState*, JSValue slotBase, PropertyName)
    293 {
    294     JSFunction* thisObj = jsCast<JSFunction*>(slotBase);
     289    return JSValue::encode(jsNumber(thisObj->jsExecutable()->parameterCount()));
     290}
     291
     292EncodedJSValue JSFunction::nameGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     293{
     294    JSFunction* thisObj = jsCast<JSFunction*>(JSValue::decode(slotBase));
    295295    ASSERT(!thisObj->isHostFunction());
    296     return thisObj->jsExecutable()->nameValue();
     296    return JSValue::encode(thisObj->jsExecutable()->nameValue());
    297297}
    298298
  • trunk/Source/JavaScriptCore/runtime/JSFunction.h

    r160038 r160133  
    172172        JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const;
    173173
    174         static JSValue argumentsGetter(ExecState*, JSValue, PropertyName);
    175         static JSValue callerGetter(ExecState*, JSValue, PropertyName);
    176         static JSValue lengthGetter(ExecState*, JSValue, PropertyName);
    177         static JSValue nameGetter(ExecState*, JSValue, PropertyName);
     174        static EncodedJSValue argumentsGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     175        static EncodedJSValue callerGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     176        static EncodedJSValue lengthGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     177        static EncodedJSValue nameGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    178178
    179179        WriteBarrier<ExecutableBase> m_executable;
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r157150 r160133  
    15361536        return JSValue::decode(m_data.value);
    15371537    if (m_propertyType == TypeCustomIndex)
    1538         return m_data.customIndex.getIndexValue(exec, slotBase(), m_data.customIndex.index);
     1538        return JSValue::decode(m_data.customIndex.getIndexValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), m_data.customIndex.index));
    15391539    if (m_propertyType == TypeGetter)
    15401540        return functionGetter(exec);
    1541     return m_data.custom.getValue(exec, slotBase(), propertyName);
     1541    return JSValue::decode(m_data.custom.getValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), propertyName));
    15421542}
    15431543
     
    15471547        return JSValue::decode(m_data.value);
    15481548    if (m_propertyType == TypeCustomIndex)
    1549         return m_data.customIndex.getIndexValue(exec, slotBase(), m_data.customIndex.index);
     1549        return JSValue::decode(m_data.customIndex.getIndexValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), m_data.customIndex.index));
    15501550    if (m_propertyType == TypeGetter)
    15511551        return functionGetter(exec);
    1552     return m_data.custom.getValue(exec, slotBase(), Identifier::from(exec, propertyName));
     1552    return JSValue::decode(m_data.custom.getValue(exec, JSValue::encode(slotBase()), JSValue::encode(m_thisValue), Identifier::from(exec, propertyName)));
    15531553}
    15541554
  • trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp

    r156624 r160133  
    3030namespace JSC {
    3131
    32 static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName);
    33 static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName);
    34 static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName);
    35 static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName);
    36 static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName);
     32static EncodedJSValue numberConstructorNaNValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     33static EncodedJSValue numberConstructorNegInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     34static EncodedJSValue numberConstructorPosInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     35static EncodedJSValue numberConstructorMaxValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     36static EncodedJSValue numberConstructorMinValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    3737
    3838} // namespace JSC
     
    8383}
    8484
    85 static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName)
     85static EncodedJSValue numberConstructorNaNValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
    8686{
    87     return jsNaN();
     87    return JSValue::encode(jsNaN());
    8888}
    8989
    90 static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName)
     90static EncodedJSValue numberConstructorNegInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
    9191{
    92     return jsNumber(-std::numeric_limits<double>::infinity());
     92    return JSValue::encode(jsNumber(-std::numeric_limits<double>::infinity()));
    9393}
    9494
    95 static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName)
     95static EncodedJSValue numberConstructorPosInfinity(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
    9696{
    97     return jsNumber(std::numeric_limits<double>::infinity());
     97    return JSValue::encode(jsNumber(std::numeric_limits<double>::infinity()));
    9898}
    9999
    100 static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName)
     100static EncodedJSValue numberConstructorMaxValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
    101101{
    102     return jsNumber(1.7976931348623157E+308);
     102    return JSValue::encode(jsNumber(1.7976931348623157E+308));
    103103}
    104104
    105 static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName)
     105static EncodedJSValue numberConstructorMinValue(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName)
    106106{
    107     return jsNumber(5E-324);
     107    return JSValue::encode(jsNumber(5E-324));
    108108}
    109109
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r155308 r160133  
    6161    }
    6262
    63     typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, PropertyName);
    64     typedef JSValue (*GetIndexValueFunc)(ExecState*, JSValue slotBase, unsigned);
     63    typedef EncodedJSValue (*GetValueFunc)(ExecState*, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName);
     64    typedef EncodedJSValue (*GetIndexValueFunc)(ExecState*, EncodedJSValue slotBase, EncodedJSValue thisValue, unsigned);
    6565
    6666    JSValue getValue(ExecState*, PropertyName) const;
     
    227227    PropertyType m_propertyType;
    228228    PropertyOffset m_offset;
    229     JSValue m_thisValue;
     229    const JSValue m_thisValue;
    230230    JSObject* m_slotBase;
    231231};
  • trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp

    r156668 r160133  
    3030namespace JSC {
    3131
    32 static JSValue regExpConstructorInput(ExecState*, JSValue, PropertyName);
    33 static JSValue regExpConstructorMultiline(ExecState*, JSValue, PropertyName);
    34 static JSValue regExpConstructorLastMatch(ExecState*, JSValue, PropertyName);
    35 static JSValue regExpConstructorLastParen(ExecState*, JSValue, PropertyName);
    36 static JSValue regExpConstructorLeftContext(ExecState*, JSValue, PropertyName);
    37 static JSValue regExpConstructorRightContext(ExecState*, JSValue, PropertyName);
    38 static JSValue regExpConstructorDollar1(ExecState*, JSValue, PropertyName);
    39 static JSValue regExpConstructorDollar2(ExecState*, JSValue, PropertyName);
    40 static JSValue regExpConstructorDollar3(ExecState*, JSValue, PropertyName);
    41 static JSValue regExpConstructorDollar4(ExecState*, JSValue, PropertyName);
    42 static JSValue regExpConstructorDollar5(ExecState*, JSValue, PropertyName);
    43 static JSValue regExpConstructorDollar6(ExecState*, JSValue, PropertyName);
    44 static JSValue regExpConstructorDollar7(ExecState*, JSValue, PropertyName);
    45 static JSValue regExpConstructorDollar8(ExecState*, JSValue, PropertyName);
    46 static JSValue regExpConstructorDollar9(ExecState*, JSValue, PropertyName);
     32static EncodedJSValue regExpConstructorInput(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     33static EncodedJSValue regExpConstructorMultiline(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     34static EncodedJSValue regExpConstructorLastMatch(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     35static EncodedJSValue regExpConstructorLastParen(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     36static EncodedJSValue regExpConstructorLeftContext(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     37static EncodedJSValue regExpConstructorRightContext(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     38static EncodedJSValue regExpConstructorDollar1(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     39static EncodedJSValue regExpConstructorDollar2(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     40static EncodedJSValue regExpConstructorDollar3(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     41static EncodedJSValue regExpConstructorDollar4(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     42static EncodedJSValue regExpConstructorDollar5(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     43static EncodedJSValue regExpConstructorDollar6(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     44static EncodedJSValue regExpConstructorDollar7(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     45static EncodedJSValue regExpConstructorDollar8(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     46static EncodedJSValue regExpConstructorDollar9(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    4747
    4848static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue);
     
    159159}
    160160
    161 JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, PropertyName)
    162 {
    163     return asRegExpConstructor(slotBase)->getBackref(exec, 1);
    164 }
    165 
    166 JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, PropertyName)
    167 {
    168     return asRegExpConstructor(slotBase)->getBackref(exec, 2);
    169 }
    170 
    171 JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, PropertyName)
    172 {
    173     return asRegExpConstructor(slotBase)->getBackref(exec, 3);
    174 }
    175 
    176 JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, PropertyName)
    177 {
    178     return asRegExpConstructor(slotBase)->getBackref(exec, 4);
    179 }
    180 
    181 JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, PropertyName)
    182 {
    183     return asRegExpConstructor(slotBase)->getBackref(exec, 5);
    184 }
    185 
    186 JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, PropertyName)
    187 {
    188     return asRegExpConstructor(slotBase)->getBackref(exec, 6);
    189 }
    190 
    191 JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, PropertyName)
    192 {
    193     return asRegExpConstructor(slotBase)->getBackref(exec, 7);
    194 }
    195 
    196 JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, PropertyName)
    197 {
    198     return asRegExpConstructor(slotBase)->getBackref(exec, 8);
    199 }
    200 
    201 JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, PropertyName)
    202 {
    203     return asRegExpConstructor(slotBase)->getBackref(exec, 9);
    204 }
    205 
    206 JSValue regExpConstructorInput(ExecState*, JSValue slotBase, PropertyName)
    207 {
    208     return asRegExpConstructor(slotBase)->input();
    209 }
    210 
    211 JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, PropertyName)
    212 {
    213     return jsBoolean(asRegExpConstructor(slotBase)->multiline());
    214 }
    215 
    216 JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, PropertyName)
    217 {
    218     return asRegExpConstructor(slotBase)->getBackref(exec, 0);
    219 }
    220 
    221 JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, PropertyName)
    222 {
    223     return asRegExpConstructor(slotBase)->getLastParen(exec);
    224 }
    225 
    226 JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, PropertyName)
    227 {
    228     return asRegExpConstructor(slotBase)->getLeftContext(exec);
    229 }
    230 
    231 JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, PropertyName)
    232 {
    233     return asRegExpConstructor(slotBase)->getRightContext(exec);
     161static inline RegExpConstructor* asRegExpConstructor(EncodedJSValue value)
     162{
     163    return jsCast<RegExpConstructor*>(JSValue::decode(value));
     164}
     165   
     166EncodedJSValue regExpConstructorDollar1(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     167{
     168    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 1));
     169}
     170
     171EncodedJSValue regExpConstructorDollar2(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     172{
     173    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 2));
     174}
     175
     176EncodedJSValue regExpConstructorDollar3(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     177{
     178    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 3));
     179}
     180
     181EncodedJSValue regExpConstructorDollar4(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     182{
     183    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 4));
     184}
     185
     186EncodedJSValue regExpConstructorDollar5(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     187{
     188    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 5));
     189}
     190
     191EncodedJSValue regExpConstructorDollar6(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     192{
     193    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 6));
     194}
     195
     196EncodedJSValue regExpConstructorDollar7(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     197{
     198    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 7));
     199}
     200
     201EncodedJSValue regExpConstructorDollar8(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     202{
     203    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 8));
     204}
     205
     206EncodedJSValue regExpConstructorDollar9(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     207{
     208    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 9));
     209}
     210
     211EncodedJSValue regExpConstructorInput(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     212{
     213    return JSValue::encode(asRegExpConstructor(slotBase)->input());
     214}
     215
     216EncodedJSValue regExpConstructorMultiline(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     217{
     218    return JSValue::encode(jsBoolean(asRegExpConstructor(slotBase)->multiline()));
     219}
     220
     221EncodedJSValue regExpConstructorLastMatch(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     222{
     223    return JSValue::encode(asRegExpConstructor(slotBase)->getBackref(exec, 0));
     224}
     225
     226EncodedJSValue regExpConstructorLastParen(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     227{
     228    return JSValue::encode(asRegExpConstructor(slotBase)->getLastParen(exec));
     229}
     230
     231EncodedJSValue regExpConstructorLeftContext(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     232{
     233    return JSValue::encode(asRegExpConstructor(slotBase)->getLeftContext(exec));
     234}
     235
     236EncodedJSValue regExpConstructorRightContext(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     237{
     238    return JSValue::encode(asRegExpConstructor(slotBase)->getRightContext(exec));
    234239}
    235240
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp

    r156668 r160133  
    4040namespace JSC {
    4141
    42 static JSValue regExpObjectGlobal(ExecState*, JSValue, PropertyName);
    43 static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, PropertyName);
    44 static JSValue regExpObjectMultiline(ExecState*, JSValue, PropertyName);
    45 static JSValue regExpObjectSource(ExecState*, JSValue, PropertyName);
     42static EncodedJSValue regExpObjectGlobal(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     43static EncodedJSValue regExpObjectIgnoreCase(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     44static EncodedJSValue regExpObjectMultiline(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     45static EncodedJSValue regExpObjectSource(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    4646
    4747} // namespace JSC
     
    156156}
    157157
    158 JSValue regExpObjectGlobal(ExecState*, JSValue slotBase, PropertyName)
    159 {
    160     return jsBoolean(asRegExpObject(slotBase)->regExp()->global());
    161 }
    162 
    163 JSValue regExpObjectIgnoreCase(ExecState*, JSValue slotBase, PropertyName)
    164 {
    165     return jsBoolean(asRegExpObject(slotBase)->regExp()->ignoreCase());
     158static inline RegExpObject* asRegExpObject(EncodedJSValue value)
     159{
     160    return jsCast<RegExpObject*>(JSValue::decode(value));
     161}
     162
     163EncodedJSValue regExpObjectGlobal(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     164{
     165    return JSValue::encode(jsBoolean(asRegExpObject(slotBase)->regExp()->global()));
     166}
     167
     168EncodedJSValue regExpObjectIgnoreCase(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
     169{
     170    return JSValue::encode(jsBoolean(asRegExpObject(slotBase)->regExp()->ignoreCase()));
    166171}
    167172 
    168 JSValue regExpObjectMultiline(ExecState*, JSValue slotBase, PropertyName)
     173EncodedJSValue regExpObjectMultiline(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
    169174{           
    170     return jsBoolean(asRegExpObject(slotBase)->regExp()->multiline());
     175    return JSValue::encode(jsBoolean(asRegExpObject(slotBase)->regExp()->multiline()));
    171176}
    172177
     
    277282}
    278283
    279 JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, PropertyName)
     284   
     285   
     286EncodedJSValue regExpObjectSource(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
    280287{
    281288    String pattern = asRegExpObject(slotBase)->regExp()->pattern();
    282289    if (pattern.is8Bit())
    283         return regExpObjectSourceInternal(exec, pattern, pattern.characters8(), pattern.length());
    284     return regExpObjectSourceInternal(exec, pattern, pattern.characters16(), pattern.length());
     290        return JSValue::encode(regExpObjectSourceInternal(exec, pattern, pattern.characters8(), pattern.length()));
     291    return JSValue::encode(regExpObjectSourceInternal(exec, pattern, pattern.characters16(), pattern.length()));
    285292}
    286293
  • trunk/Source/WebCore/ChangeLog

    r160130 r160133  
     12013-12-04  Oliver Hunt  <oliver@apple.com>
     2
     3        Refactor static getter function prototype to include thisValue in addition to the base object
     4        https://bugs.webkit.org/show_bug.cgi?id=124461
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Change bindings codegen to produce static getter functions
     9        with the correct types.  Also update the many custom implementations
     10        to the new type.
     11
     12        No change in behaviour.
     13
     14        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
     15        (WebCore::cssPropertyGetterPixelOrPosPrefixCallback):
     16        (WebCore::cssPropertyGetterCallback):
     17        * bindings/js/JSDOMBinding.cpp:
     18        (WebCore::objectToStringFunctionGetter):
     19        * bindings/js/JSDOMBinding.h:
     20        * bindings/js/JSDOMMimeTypeArrayCustom.cpp:
     21        (WebCore::JSDOMMimeTypeArray::nameGetter):
     22        * bindings/js/JSDOMPluginArrayCustom.cpp:
     23        (WebCore::JSDOMPluginArray::nameGetter):
     24        * bindings/js/JSDOMPluginCustom.cpp:
     25        (WebCore::JSDOMPlugin::nameGetter):
     26        * bindings/js/JSDOMStringMapCustom.cpp:
     27        (WebCore::JSDOMStringMap::nameGetter):
     28        * bindings/js/JSDOMWindowCustom.cpp:
     29        (WebCore::nonCachingStaticFunctionGetter):
     30        (WebCore::childFrameGetter):
     31        (WebCore::indexGetter):
     32        (WebCore::namedItemGetter):
     33        * bindings/js/JSHTMLAllCollectionCustom.cpp:
     34        (WebCore::JSHTMLAllCollection::nameGetter):
     35        * bindings/js/JSHTMLCollectionCustom.cpp:
     36        (WebCore::JSHTMLCollection::nameGetter):
     37        * bindings/js/JSHTMLDocumentCustom.cpp:
     38        (WebCore::JSHTMLDocument::nameGetter):
     39        * bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
     40        (WebCore::JSHTMLFormControlsCollection::nameGetter):
     41        * bindings/js/JSHTMLFormElementCustom.cpp:
     42        (WebCore::JSHTMLFormElement::nameGetter):
     43        * bindings/js/JSHTMLFrameSetElementCustom.cpp:
     44        (WebCore::JSHTMLFrameSetElement::nameGetter):
     45        * bindings/js/JSHistoryCustom.cpp:
     46        (WebCore::nonCachingStaticBackFunctionGetter):
     47        (WebCore::nonCachingStaticForwardFunctionGetter):
     48        (WebCore::nonCachingStaticGoFunctionGetter):
     49        * bindings/js/JSJavaScriptCallFrameCustom.cpp:
     50        (WebCore::JSJavaScriptCallFrame::scopeType):
     51        * bindings/js/JSLocationCustom.cpp:
     52        (WebCore::nonCachingStaticReplaceFunctionGetter):
     53        (WebCore::nonCachingStaticReloadFunctionGetter):
     54        (WebCore::nonCachingStaticAssignFunctionGetter):
     55        * bindings/js/JSNamedNodeMapCustom.cpp:
     56        (WebCore::JSNamedNodeMap::nameGetter):
     57        * bindings/js/JSNodeListCustom.cpp:
     58        (WebCore::JSNodeList::nameGetter):
     59        * bindings/js/JSPluginElementFunctions.cpp:
     60        (WebCore::pluginElementPropertyGetter):
     61        * bindings/js/JSPluginElementFunctions.h:
     62        * bindings/js/JSRTCStatsResponseCustom.cpp:
     63        (WebCore::JSRTCStatsResponse::nameGetter):
     64        * bindings/js/JSStorageCustom.cpp:
     65        (WebCore::JSStorage::nameGetter):
     66        * bindings/js/JSStyleSheetListCustom.cpp:
     67        (WebCore::JSStyleSheetList::nameGetter):
     68        * bindings/scripts/CodeGeneratorJS.pm:
     69        (GenerateHeader):
     70        (GenerateImplementation):
     71        (GenerateParametersCheck):
     72        * bridge/runtime_array.cpp:
     73        (JSC::RuntimeArray::lengthGetter):
     74        (JSC::RuntimeArray::indexGetter):
     75        * bridge/runtime_array.h:
     76        * bridge/runtime_method.cpp:
     77        (JSC::RuntimeMethod::lengthGetter):
     78        * bridge/runtime_method.h:
     79        * bridge/runtime_object.cpp:
     80        (JSC::Bindings::RuntimeObject::fallbackObjectGetter):
     81        (JSC::Bindings::RuntimeObject::fieldGetter):
     82        (JSC::Bindings::RuntimeObject::methodGetter):
     83        * bridge/runtime_object.h:
     84
    1852013-12-04  Zoltan Horvath  <zoltan@webkit.org>
    286
  • trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp

    r159856 r160133  
    304304}
    305305
    306 static JSValue cssPropertyGetterPixelOrPosPrefixCallback(ExecState* exec, JSValue slotBase, unsigned propertyID)
    307 {
    308     return cssPropertyGetterPixelOrPosPrefix(exec, jsCast<JSCSSStyleDeclaration*>(asObject(slotBase)), propertyID);
     306static EncodedJSValue cssPropertyGetterPixelOrPosPrefixCallback(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned propertyID)
     307{
     308    return JSValue::encode(cssPropertyGetterPixelOrPosPrefix(exec, jsCast<JSCSSStyleDeclaration*>(JSValue::decode(slotBase)), propertyID));
    309309}
    310310
     
    318318}
    319319
    320 static JSValue cssPropertyGetterCallback(ExecState* exec, JSValue slotBase, unsigned propertyID)
    321 {
    322     return cssPropertyGetter(exec, jsCast<JSCSSStyleDeclaration*>(asObject(slotBase)), propertyID);
     320static EncodedJSValue cssPropertyGetterCallback(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned propertyID)
     321{
     322    return JSValue::encode(cssPropertyGetter(exec, jsCast<JSCSSStyleDeclaration*>(JSValue::decode(slotBase)), propertyID));
    323323}
    324324
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp

    r159605 r160133  
    272272}
    273273
    274 JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    275 {
    276     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), objectProtoFuncToString);
     274EncodedJSValue objectToStringFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
     275{
     276    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), objectProtoFuncToString));
    277277}
    278278
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.h

    r159827 r160133  
    573573
    574574void printErrorMessageForFrame(Frame*, const String& message);
    575 JSC::JSValue objectToStringFunctionGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
     575JSC::EncodedJSValue objectToStringFunctionGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);
    576576
    577577inline JSC::JSValue jsStringWithCache(JSC::ExecState* exec, const String& s)
  • trunk/Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp

    r157215 r160133  
    3434}
    3535
    36 JSValue JSDOMMimeTypeArray::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     36EncodedJSValue JSDOMMimeTypeArray::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    3737{
    38     JSDOMMimeTypeArray* thisObj = jsCast<JSDOMMimeTypeArray*>(asObject(slotBase));
    39     return toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)));
     38    JSDOMMimeTypeArray* thisObj = jsDynamicCast<JSDOMMimeTypeArray*>(JSValue::decode(slotBase));
     39    if (!thisObj)
     40        return throwVMTypeError(exec);
     41    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));
    4042}
    4143
  • trunk/Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp

    r157215 r160133  
    3434}
    3535
    36 JSValue JSDOMPluginArray::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     36EncodedJSValue JSDOMPluginArray::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    3737{
    38     JSDOMPluginArray* thisObj = jsCast<JSDOMPluginArray*>(asObject(slotBase));
    39     return toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)));
     38    JSDOMPluginArray* thisObj = jsCast<JSDOMPluginArray*>(JSValue::decode(slotBase));
     39    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));
    4040}
    4141
  • trunk/Source/WebCore/bindings/js/JSDOMPluginCustom.cpp

    r157215 r160133  
    3333}
    3434
    35 JSValue JSDOMPlugin::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     35EncodedJSValue JSDOMPlugin::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    3636{
    37     JSDOMPlugin* thisObj = jsCast<JSDOMPlugin*>(asObject(slotBase));
    38     return toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)));
     37    JSDOMPlugin* thisObj = jsCast<JSDOMPlugin*>(JSValue::decode(slotBase));
     38    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));
    3939}
    4040
  • trunk/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp

    r157215 r160133  
    4141}
    4242
    43 JSValue JSDOMStringMap::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     43EncodedJSValue JSDOMStringMap::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4444{
    45     JSDOMStringMap* thisObj = jsCast<JSDOMStringMap*>(asObject(slotBase));
    46     return jsStringWithCache(exec, thisObj->impl().item(propertyNameToAtomicString(propertyName)));
     45    JSDOMStringMap* thisObj = jsCast<JSDOMStringMap*>(JSValue::decode(slotBase));
     46    return JSValue::encode(jsStringWithCache(exec, thisObj->impl().item(propertyNameToAtomicString(propertyName))));
    4747}
    4848
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r159679 r160133  
    6868
    6969template<NativeFunction nativeFunction, int length>
    70 JSValue nonCachingStaticFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    71 {
    72     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), length, propertyName.publicName(), nativeFunction);
    73 }
    74 
    75 static JSValue childFrameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
    76 {
    77     return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl().frame()->tree().scopedChild(propertyNameToAtomicString(propertyName))->document()->domWindow());
    78 }
    79 
    80 static JSValue indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
    81 {
    82     return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl().frame()->tree().scopedChild(index)->document()->domWindow());
    83 }
    84 
    85 static JSValue namedItemGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
    86 {
    87     JSDOMWindowBase* thisObj = jsCast<JSDOMWindow*>(asObject(slotBase));
     70EncodedJSValue nonCachingStaticFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
     71{
     72    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), length, propertyName.publicName(), nativeFunction));
     73}
     74
     75static EncodedJSValue childFrameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
     76{
     77    return JSValue::encode(toJS(exec, jsCast<JSDOMWindow*>(JSValue::decode(slotBase))->impl().frame()->tree().scopedChild(propertyNameToAtomicString(propertyName))->document()->domWindow()));
     78}
     79
     80static EncodedJSValue indexGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned index)
     81{
     82    return JSValue::encode(toJS(exec, jsCast<JSDOMWindow*>(JSValue::decode(slotBase))->impl().frame()->tree().scopedChild(index)->document()->domWindow()));
     83}
     84
     85static EncodedJSValue namedItemGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
     86{
     87    JSDOMWindowBase* thisObj = jsCast<JSDOMWindow*>(JSValue::decode(slotBase));
    8888    Document* document = thisObj->impl().frame()->document();
    8989
     
    9494    AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
    9595    if (!atomicPropertyName || !toHTMLDocument(document)->hasWindowNamedItem(*atomicPropertyName))
    96         return jsUndefined();
     96        return JSValue::encode(jsUndefined());
    9797
    9898    if (UNLIKELY(toHTMLDocument(document)->windowNamedItemContainsMultipleElements(*atomicPropertyName))) {
    9999        RefPtr<HTMLCollection> collection = document->windowNamedItems(atomicPropertyName);
    100100        ASSERT(collection->length() > 1);
    101         return toJS(exec, thisObj->globalObject(), WTF::getPtr(collection));
    102     }
    103 
    104     return toJS(exec, thisObj->globalObject(), toHTMLDocument(document)->windowNamedItem(*atomicPropertyName));
     101        return JSValue::encode(toJS(exec, thisObj->globalObject(), WTF::getPtr(collection)));
     102    }
     103
     104    return JSValue::encode(toJS(exec, thisObj->globalObject(), toHTMLDocument(document)->windowNamedItem(*atomicPropertyName)));
    105105}
    106106
  • trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp

    r157215 r160133  
    101101}
    102102
    103 JSValue JSHTMLAllCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     103EncodedJSValue JSHTMLAllCollection::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    104104{
    105     JSHTMLAllCollection* thisObj = jsCast<JSHTMLAllCollection*>(asObject(slotBase));
    106     return getNamedItems(exec, thisObj, propertyName);
     105    JSHTMLAllCollection* thisObj = jsCast<JSHTMLAllCollection*>(JSValue::decode(slotBase));
     106    return JSValue::encode(getNamedItems(exec, thisObj, propertyName));
    107107}
    108108
  • trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp

    r157215 r160133  
    4646}
    4747
    48 JSValue JSHTMLCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     48EncodedJSValue JSHTMLCollection::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4949{
    50     JSHTMLCollection* collection = jsCast<JSHTMLCollection*>(asObject(slotBase));
     50    JSHTMLCollection* collection = jsCast<JSHTMLCollection*>(JSValue::decode(slotBase));
    5151    const AtomicString& name = propertyNameToAtomicString(propertyName);
    52     return toJS(exec, collection->globalObject(), collection->impl().namedItem(name));
     52    return JSValue::encode(toJS(exec, collection->globalObject(), collection->impl().namedItem(name)));
    5353}
    5454
  • trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp

    r158774 r160133  
    5858}
    5959
    60 JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     60EncodedJSValue JSHTMLDocument::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    6161{
    62     JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(asObject(slotBase));
     62    JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(JSValue::decode(slotBase));
    6363    HTMLDocument& document = thisObj->impl();
    6464
    6565    AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
    6666    if (!atomicPropertyName || !document.hasDocumentNamedItem(*atomicPropertyName))
    67         return jsUndefined();
     67        return JSValue::encode(jsUndefined());
    6868
    6969    if (UNLIKELY(document.documentNamedItemContainsMultipleElements(*atomicPropertyName))) {
    7070        RefPtr<HTMLCollection> collection = document.documentNamedItems(atomicPropertyName);
    7171        ASSERT(collection->length() > 1);
    72         return toJS(exec, thisObj->globalObject(), WTF::getPtr(collection));
     72        return JSValue::encode(toJS(exec, thisObj->globalObject(), WTF::getPtr(collection)));
    7373    }
    7474
     
    7676    if (UNLIKELY(element->hasTagName(iframeTag))) {
    7777        if (Frame* frame = toHTMLIFrameElement(element)->contentFrame())
    78             return toJS(exec, frame);
     78            return JSValue::encode(toJS(exec, frame));
    7979    }
    8080
    81     return toJS(exec, thisObj->globalObject(), element);
     81    return JSValue::encode(toJS(exec, thisObj->globalObject(), element));
    8282}
    8383
  • trunk/Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp

    r157215 r160133  
    5858}
    5959
    60 JSValue JSHTMLFormControlsCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     60EncodedJSValue JSHTMLFormControlsCollection::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    6161{
    62     JSHTMLFormControlsCollection* thisObj = jsCast<JSHTMLFormControlsCollection*>(asObject(slotBase));
    63     return getNamedItems(exec, thisObj, propertyName);
     62    JSHTMLFormControlsCollection* thisObj = jsCast<JSHTMLFormControlsCollection*>(JSValue::decode(slotBase));
     63    return JSValue::encode(getNamedItems(exec, thisObj, propertyName));
    6464}
    6565
  • trunk/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp

    r157215 r160133  
    4343}
    4444
    45 JSValue JSHTMLFormElement::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     45EncodedJSValue JSHTMLFormElement::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4646{
    47     JSHTMLFormElement* jsForm = jsCast<JSHTMLFormElement*>(asObject(slotBase));
     47    JSHTMLFormElement* jsForm = jsCast<JSHTMLFormElement*>(JSValue::decode(slotBase));
    4848    HTMLFormElement& form = jsForm->impl();
    4949
     
    5252   
    5353    if (namedItems.isEmpty())
    54         return jsUndefined();
     54        return JSValue::encode(jsUndefined());
    5555    if (namedItems.size() == 1)
    56         return toJS(exec, jsForm->globalObject(), &namedItems[0].get());
     56        return JSValue::encode(toJS(exec, jsForm->globalObject(), &namedItems[0].get()));
    5757
    5858    // FIXME: HTML5 specifies that this should be a RadioNodeList.
    59     return toJS(exec, jsForm->globalObject(), StaticElementList::adopt(namedItems).get());
     59    return JSValue::encode(toJS(exec, jsForm->globalObject(), StaticElementList::adopt(namedItems).get()));
    6060}
    6161
  • trunk/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp

    r159416 r160133  
    4848}
    4949
    50 JSValue JSHTMLFrameSetElement::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     50EncodedJSValue JSHTMLFrameSetElement::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    5151{
    52     HTMLElement& element = jsCast<JSHTMLElement*>(asObject(slotBase))->impl();
     52    HTMLElement& element = jsCast<JSHTMLElement*>(JSValue::decode(slotBase))->impl();
    5353    Node* frameElement = element.children()->namedItem(propertyNameToAtomicString(propertyName));
    5454    if (Document* document = toHTMLFrameElement(frameElement)->contentDocument()) {
    5555        if (JSDOMWindowShell* window = toJSDOMWindowShell(document->frame(), currentWorld(exec)))
    56             return window;
     56            return JSValue::encode(window);
    5757    }
    58     return jsUndefined();
     58    return JSValue::encode(jsUndefined());
    5959}
    6060
  • trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp

    r157215 r160133  
    3939namespace WebCore {
    4040
    41 static JSValue nonCachingStaticBackFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
     41static EncodedJSValue nonCachingStaticBackFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
    4242{
    43     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionBack);
     43    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionBack));
    4444}
    4545
    46 static JSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
     46static EncodedJSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
    4747{
    48     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionForward);
     48    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionForward));
    4949}
    5050
    51 static JSValue nonCachingStaticGoFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
     51static EncodedJSValue nonCachingStaticGoFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
    5252{
    53     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsHistoryPrototypeFunctionGo);
     53    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsHistoryPrototypeFunctionGo));
    5454}
    5555
  • trunk/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp

    r157215 r160133  
    107107                // First activation object is local scope, each successive activation object is closure.
    108108                if (!index)
    109                     return jsJavaScriptCallFrameLOCAL_SCOPE(exec, JSValue(), Identifier());
     109                    return JSValue::decode(jsJavaScriptCallFrameLOCAL_SCOPE(exec, EncodedJSValue(), EncodedJSValue(), Identifier()));
    110110                foundLocalScope = true;
    111111            } else if (!index)
    112                 return jsJavaScriptCallFrameCLOSURE_SCOPE(exec, JSValue(), Identifier());
     112                return JSValue::decode(jsJavaScriptCallFrameCLOSURE_SCOPE(exec, EncodedJSValue(), EncodedJSValue(), Identifier()));
    113113        }
    114114
     
    116116            // Last in the chain is global scope.
    117117            if (++iter == end)
    118                 return jsJavaScriptCallFrameGLOBAL_SCOPE(exec, JSValue(), Identifier());
    119             return jsJavaScriptCallFrameWITH_SCOPE(exec, JSValue(), Identifier());
     118                return JSValue::decode(jsJavaScriptCallFrameGLOBAL_SCOPE(exec, EncodedJSValue(), EncodedJSValue(), Identifier()));
     119            return JSValue::decode(jsJavaScriptCallFrameWITH_SCOPE(exec, EncodedJSValue(), EncodedJSValue(), Identifier()));
    120120        }
    121121
  • trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp

    r157215 r160133  
    3131namespace WebCore {
    3232
    33 static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    34 {
    35     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionReplace);
    36 }
    37 
    38 static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    39 {
    40     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsLocationPrototypeFunctionReload);
    41 }
    42 
    43 static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    44 {
    45     return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionAssign);
     33static EncodedJSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
     34{
     35    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionReplace));
     36}
     37
     38static EncodedJSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
     39{
     40    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsLocationPrototypeFunctionReload));
     41}
     42
     43static EncodedJSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName propertyName)
     44{
     45    return JSValue::encode(JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionAssign));
    4646}
    4747
  • trunk/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp

    r157215 r160133  
    4141}
    4242
    43 JSValue JSNamedNodeMap::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     43EncodedJSValue JSNamedNodeMap::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4444{
    45     JSNamedNodeMap* thisObj = jsCast<JSNamedNodeMap*>(asObject(slotBase));
    46     return toJS(exec, thisObj->globalObject(), thisObj->impl().getNamedItem(propertyNameToAtomicString(propertyName)));
     45    JSNamedNodeMap* thisObj = jsCast<JSNamedNodeMap*>(JSValue::decode(slotBase));
     46    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().getNamedItem(propertyNameToAtomicString(propertyName))));
    4747}
    4848
  • trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp

    r158536 r160133  
    5757}
    5858
    59 JSValue JSNodeList::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     59EncodedJSValue JSNodeList::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    6060{
    61     JSNodeList* thisObj = jsCast<JSNodeList*>(asObject(slotBase));
    62     return toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)));
     61    JSNodeList* thisObj = jsCast<JSNodeList*>(JSValue::decode(slotBase));
     62    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));
    6363}
    6464
  • trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp

    r159827 r160133  
    101101}
    102102   
    103 JSValue pluginElementPropertyGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     103EncodedJSValue pluginElementPropertyGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    104104{
    105     JSHTMLElement* element = jsCast<JSHTMLElement*>(asObject(slotBase));
     105    JSHTMLElement* element = jsCast<JSHTMLElement*>(JSValue::decode(slotBase));
    106106    JSObject* scriptObject = pluginScriptObject(exec, element);
    107107    if (!scriptObject)
    108         return jsUndefined();
     108        return JSValue::encode(jsUndefined());
    109109   
    110     return scriptObject->get(exec, propertyName);
     110    return JSValue::encode(scriptObject->get(exec, propertyName));
    111111}
    112112
  • trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.h

    r156769 r160133  
    3939    JSC::JSObject* pluginScriptObject(JSC::ExecState*, JSHTMLElement*);
    4040
    41     JSC::JSValue pluginElementPropertyGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
     41    JSC::EncodedJSValue pluginElementPropertyGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);
    4242    bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&, JSHTMLElement*);
    4343    bool pluginElementCustomPut(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSHTMLElement*, JSC::PutPropertySlot&);
  • trunk/Source/WebCore/bindings/js/JSRTCStatsResponseCustom.cpp

    r157215 r160133  
    4141}
    4242
    43 JSValue JSRTCStatsResponse::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     43EncodedJSValue JSRTCStatsResponse::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4444{
    45     JSRTCStatsResponse* thisObj = jsCast<JSRTCStatsResponse*>(asObject(slotBase));
    46     return toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)));
     45    JSRTCStatsResponse* thisObj = jsCast<JSRTCStatsResponse*>(JSValue::decode(slotBase));
     46    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));
    4747}
    4848
  • trunk/Source/WebCore/bindings/js/JSStorageCustom.cpp

    r157215 r160133  
    4343}
    4444
    45 JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     45EncodedJSValue JSStorage::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4646{
    47     JSStorage* thisObj = jsCast<JSStorage*>(asObject(slotBase));
     47    JSStorage* thisObj = jsCast<JSStorage*>(JSValue::decode(slotBase));
    4848       
    49     JSValue prototype = asObject(slotBase)->prototype();
     49    JSValue prototype = asObject(JSValue::decode(slotBase))->prototype();
    5050    if (prototype.isObject() && asObject(prototype)->hasProperty(exec, propertyName))
    51         return asObject(prototype)->get(exec, propertyName);
     51        return JSValue::encode(asObject(prototype)->get(exec, propertyName));
    5252 
    5353    ExceptionCode ec = 0;
    5454    JSValue result = jsStringOrNull(exec, thisObj->impl().getItem(propertyNameToString(propertyName), ec));
    5555    setDOMException(exec, ec);
    56     return result;
     56    return JSValue::encode(result);
    5757}
    5858
  • trunk/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp

    r157215 r160133  
    4141}
    4242
    43 JSValue JSStyleSheetList::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     43EncodedJSValue JSStyleSheetList::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    4444{
    45     JSStyleSheetList* thisObj = jsCast<JSStyleSheetList*>(asObject(slotBase));
     45    JSStyleSheetList* thisObj = jsCast<JSStyleSheetList*>(JSValue::decode(slotBase));
    4646    HTMLStyleElement* element = thisObj->impl().getNamedItem(propertyNameToString(propertyName));
    4747    ASSERT(element);
    48     return toJS(exec, thisObj->globalObject(), element->sheet());
     48    return JSValue::encode(toJS(exec, thisObj->globalObject(), element->sheet()));
    4949}
    5050
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r159856 r160133  
    894894            push(@headerContent, "    JSC::JSValue getByIndex(JSC::ExecState*, unsigned index);\n");
    895895        } else {
    896             push(@headerContent, "    static JSC::JSValue indexGetter(JSC::ExecState*, JSC::JSValue, unsigned);\n");
     896            push(@headerContent, "    static JSC::EncodedJSValue indexGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, unsigned);\n");
    897897        }
    898898    }
     
    906906        push(@headerContent, "private:\n");
    907907        push(@headerContent, "    static bool canGetItemsForName(JSC::ExecState*, $interfaceName*, JSC::PropertyName);\n");
    908         push(@headerContent, "    static JSC::JSValue nameGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);\n");
     908        push(@headerContent, "    static JSC::EncodedJSValue nameGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);\n");
    909909    }
    910910
     
    10421042            push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
    10431043            my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
    1044             push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);\n");
     1044            push(@headerContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);\n");
    10451045            if (!IsReadonly($attribute)) {
    10461046                my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
     
    10521052        if (!$interface->extendedAttributes->{"NoInterfaceObject"}) {
    10531053            my $getter = "js" . $interfaceName . "Constructor";
    1054             push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);\n");
     1054            push(@headerContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);\n");
    10551055        }
    10561056
     
    10671067            push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
    10681068            my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
    1069             push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);\n");
     1069            push(@headerContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);\n");
    10701070            push(@headerContent, "#endif\n") if $conditionalString;
    10711071        }
     
    18761876                push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString;
    18771877
    1878                 push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue slotBase, PropertyName)\n");
     1878                push(@implContent, "EncodedJSValue ${getFunctionName}(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)\n");
    18791879                push(@implContent, "{\n");
    18801880
    18811881                if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) {
    1882                     push(@implContent, "    ${className}* castedThis = jsCast<$className*>(asObject(slotBase));\n");
     1882                    push(@implContent, "    ${className}* castedThis = jsDynamicCast<$className*>(JSValue::decode(slotBase));\n");
    18831883                } else {
    18841884                    push(@implContent, "    UNUSED_PARAM(slotBase);\n");
     
    18911891                        my $enable_function = GetRuntimeEnableFunctionName($attribute->signature);
    18921892                        push(@implContent, "    if (!${enable_function}())\n");
    1893                         push(@implContent, "        return jsUndefined();\n");
     1893                        push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    18941894                    } elsif ($attribute->signature->extendedAttributes->{"EnabledBySetting"}) {
    18951895                        AddToImplIncludes("Frame.h");
     
    18971897                        my $enable_function = ToMethodName($attribute->signature->extendedAttributes->{"EnabledBySetting"}) . "Enabled";
    18981898                        push(@implContent, "    if (!castedThis->impl().frame())\n");
    1899                         push(@implContent, "        return jsUndefined();\n");
     1899                        push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    19001900                        push(@implContent, "    Settings& settings = castedThis->impl().frame()->settings();\n");
    19011901                        push(@implContent, "    if (!settings.$enable_function())\n");
    1902                         push(@implContent, "        return jsUndefined();\n");
     1902                        push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    19031903                    }
    19041904                }
     
    19121912                    !$attribute->signature->extendedAttributes->{"DoNotCheckSecurityOnGetter"}) {
    19131913                    push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis->impl()))\n");
    1914                     push(@implContent, "        return jsUndefined();\n");
     1914                    push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    19151915                }
    19161916
    19171917                if (HasCustomGetter($attribute->signature->extendedAttributes)) {
    1918                     push(@implContent, "    return castedThis->$implGetterFunctionName(exec);\n");
     1918                    push(@implContent, "    return JSValue::encode(castedThis->$implGetterFunctionName(exec));\n");
    19191919                } elsif ($attribute->signature->extendedAttributes->{"CheckSecurityForNode"}) {
    19201920                    $implIncludes{"JSDOMBinding.h"} = 1;
    19211921                    push(@implContent, "    $interfaceName& impl = castedThis->impl();\n");
    1922                     push(@implContent, "    return shouldAllowAccessToNode(exec, impl." . $attribute->signature->name . "()) ? " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName()", "castedThis") . " : jsNull();\n");
     1922                    push(@implContent, "    return JSValue::encode(shouldAllowAccessToNode(exec, impl." . $attribute->signature->name . "()) ? " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName()", "castedThis") . " : jsNull());\n");
    19231923                } elsif ($type eq "EventListener") {
    19241924                    $implIncludes{"EventListener.h"} = 1;
     
    19321932                        push(@implContent, "            if (JSObject* jsFunction = jsListener->jsFunction(impl.scriptExecutionContext()))\n");
    19331933                    }
    1934                     push(@implContent, "                return jsFunction;\n");
     1934                    push(@implContent, "                return JSValue::encode(jsFunction);\n");
    19351935                    push(@implContent, "        }\n");
    19361936                    push(@implContent, "    }\n");
    1937                     push(@implContent, "    return jsNull();\n");
     1937                    push(@implContent, "    return JSValue::encode(jsNull());\n");
    19381938                } elsif ($attribute->signature->type =~ /Constructor$/) {
    19391939                    my $constructorType = $attribute->signature->type;
     
    19441944                        my $named = ($constructorType =~ /Named$/) ? "Named" : "";
    19451945                        $constructorType =~ s/Named$//;
    1946                         push(@implContent, "    return JS" . $constructorType . "::get${named}Constructor(exec->vm(), castedThis);\n");
     1946                        push(@implContent, "    return JSValue::encode(JS" . $constructorType . "::get${named}Constructor(exec->vm(), castedThis));\n");
    19471947                    } else {
    19481948                       AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"});
    1949                        push(@implContent, "    return JS" . $constructorType . "::getConstructor(exec->vm(), castedThis->globalObject());\n");
     1949                       push(@implContent, "    return JSValue::encode(JS" . $constructorType . "::getConstructor(exec->vm(), castedThis->globalObject()));\n");
    19501950                    }
    19511951                } elsif (!$attribute->signature->extendedAttributes->{"GetterRaisesException"}) {
     
    19581958                        $currentCachedAttribute++;
    19591959                        push(@implContent, "    if (JSValue cachedValue = castedThis->m_" . $attribute->signature->name . ".get())\n");
    1960                         push(@implContent, "        return cachedValue;\n");
     1960                        push(@implContent, "        return JSValue::encode(cachedValue);\n");
    19611961                    }
    19621962
    1963                     my @callWithArgs = GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContent, "jsUndefined()");
     1963                    my @callWithArgs = GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContent, "JSValue::encode(jsUndefined())");
    19641964
    19651965                    if ($svgListPropertyType) {
     
    19991999                        if ($isNullable) {
    20002000                            push(@implContent, "    if (isNull)\n");
    2001                             push(@implContent, "        return jsNull();\n");
     2001                            push(@implContent, "        return JSValue::encode(jsNull());\n");
    20022002                        }
    20032003                    }
    20042004
    20052005                    push(@implContent, "    castedThis->m_" . $attribute->signature->name . ".set(exec->vm(), castedThis, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"});
    2006                     push(@implContent, "    return result;\n");
     2006                    push(@implContent, "    return JSValue::encode(result);\n");
    20072007
    20082008                } else {
     
    20152015                    }
    20162016
    2017                     unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContent, "jsUndefined()"));
     2017                    unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContent, "JSValue::encode(jsUndefined())"));
    20182018
    20192019                    if ($svgPropertyOrListPropertyType) {
     
    20272027                    if ($isNullable) {
    20282028                        push(@implContent, "    if (isNull)\n");
    2029                         push(@implContent, "        return jsNull();\n");
     2029                        push(@implContent, "        return JSValue::encode(jsNull());\n");
    20302030                    }
    20312031
    20322032                    push(@implContent, "    setDOMException(exec, ec);\n");
    2033                     push(@implContent, "    return result;\n");
     2033                    push(@implContent, "    return JSValue::encode(result);\n");
    20342034                }
    20352035
     
    20442044                my $constructorFunctionName = "js" . $interfaceName . "Constructor";
    20452045
    2046                 push(@implContent, "JSValue ${constructorFunctionName}(ExecState* exec, JSValue slotBase, PropertyName)\n");
     2046                push(@implContent, "EncodedJSValue ${constructorFunctionName}(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)\n");
    20472047                push(@implContent, "{\n");
    2048                 push(@implContent, "    ${className}* domObject = jsCast<$className*>(asObject(slotBase));\n");
     2048                push(@implContent, "    ${className}* domObject = jsDynamicCast<$className*>(JSValue::decode(slotBase));\n");
    20492049
    20502050                if ($interface->extendedAttributes->{"CheckSecurity"}) {
    20512051                    push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, domObject->impl()))\n");
    2052                     push(@implContent, "        return jsUndefined();\n");
     2052                    push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    20532053                }
    20542054
    2055                 push(@implContent, "    return ${className}::getConstructor(exec->vm(), domObject->globalObject());\n");
     2055                push(@implContent, "    return JSValue::encode(${className}::getConstructor(exec->vm(), domObject->globalObject()));\n");
    20562056                push(@implContent, "}\n\n");
    20572057            }
     
    23852385                } else {
    23862386                    push(@implContent, "    JSValue thisValue = exec->hostThisValue();\n");
    2387                     push(@implContent, "    if (!thisValue.inherits(${className}::info()))\n");
     2387                    push(@implContent, "    $className* castedThis = jsDynamicCast<$className*>(thisValue);\n");
     2388                    push(@implContent, "    if (!castedThis)\n");
    23882389                    push(@implContent, "        return throwVMTypeError(exec);\n");
    2389                     push(@implContent, "    $className* castedThis = jsCast<$className*>(asObject(thisValue));\n");
    23902390                }
    23912391
     
    24852485
    24862486            # FIXME: this casts into int to match our previous behavior which turned 0xFFFFFFFF in -1 for NodeFilter.SHOW_ALL
    2487             push(@implContent, "JSValue ${getter}(ExecState* exec, JSValue, PropertyName)\n");
     2487            push(@implContent, "EncodedJSValue ${getter}(ExecState* exec, EncodedJSValue, EncodedJSValue, PropertyName)\n");
    24882488            push(@implContent, "{\n");
    24892489            if ($constant->type eq "DOMString") {
    2490                 push(@implContent, "    return jsStringOrNull(exec, String(" . $constant->value . "));\n");
     2490                push(@implContent, "    return JSValue::encode(jsStringOrNull(exec, String(" . $constant->value . ")));\n");
    24912491            } else {
    24922492                push(@implContent, "    UNUSED_PARAM(exec);\n");
    2493                 push(@implContent, "    return jsNumber(static_cast<int>(" . $constant->value . "));\n");
     2493                push(@implContent, "    return JSValue::encode(jsNumber(static_cast<int>(" . $constant->value . ")));\n");
    24942494            }
    24952495            push(@implContent, "}\n\n");
     
    24992499
    25002500    if ($indexedGetterFunction && !$hasNumericIndexedGetter) {
    2501         push(@implContent, "\nJSValue ${className}::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)\n");
     2501        push(@implContent, "\nEncodedJSValue ${className}::indexGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned index)\n");
    25022502        push(@implContent, "{\n");
    2503         push(@implContent, "    ${className}* thisObj = jsCast<$className*>(asObject(slotBase));\n");
     2503        push(@implContent, "    ${className}* thisObj = jsCast<$className*>(JSValue::decode(slotBase));\n");
    25042504        push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObj, info());\n");
    25052505        if ($indexedGetterFunction->signature->type eq "DOMString") {
    25062506            $implIncludes{"URL.h"} = 1;
    2507             push(@implContent, "    return jsStringOrUndefined(exec, thisObj->impl().item(index));\n");
     2507            push(@implContent, "    return JSValue::encode(jsStringOrUndefined(exec, thisObj->impl().item(index)));\n");
    25082508        } else {
    2509             push(@implContent, "    return toJS(exec, thisObj->globalObject(), thisObj->impl().item(index));\n");
     2509            push(@implContent, "    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().item(index)));\n");
    25102510        }
    25112511        push(@implContent, "}\n\n");
     
    25382538            push(@implContent, "    return collection->hasNamedItem(propertyNameToAtomicString(propertyName));\n");
    25392539            push(@implContent, "}\n\n");
    2540             push(@implContent, "JSValue ${className}::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)\n");
     2540            push(@implContent, "EncodedJSValue ${className}::nameGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)\n");
    25412541            push(@implContent, "{\n");
    2542             push(@implContent, "    ${className}* thisObj = jsCast<$className*>(asObject(slotBase));\n");
    2543             push(@implContent, "    return toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName)));\n");
     2542            push(@implContent, "    ${className}* thisObj = jsCast<$className*>(JSValue::decode(slotBase));\n");
     2543            push(@implContent, "    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));\n");
    25442544            push(@implContent, "}\n\n");
    25452545        }
     
    27322732        push(@implContent, "$implType* to${interfaceName}(JSC::JSValue value)\n");
    27332733        push(@implContent, "{\n");
    2734         push(@implContent, "    return value.inherits(${className}::info()) ? &jsCast<$className*>(asObject(value))->impl() : 0");
     2734        push(@implContent, "    return value.inherits(${className}::info()) ? &jsCast<$className*>(value)->impl() : 0");
    27352735        push(@implContent, ";\n}\n");
    27362736    }
     
    28722872                if ($function->isStatic) {
    28732873                    AddToImplIncludes("CallbackFunction.h");
    2874                     push(@$outputArray, "        $name = createFunctionOnlyCallback<${callbackClassName}>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument($argsIndex));\n");
     2874                    push(@$outputArray, "        $name = createFunctionOnlyCallback<${callbackClassName}>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument($argsIndex));\n");
    28752875                } else {
    28762876                    push(@$outputArray, "        $name = ${callbackClassName}::create(asObject(exec->uncheckedArgument($argsIndex)), castedThis->globalObject());\n");
     
    28822882                if ($function->isStatic) {
    28832883                    AddToImplIncludes("CallbackFunction.h");
    2884                     push(@$outputArray, "    RefPtr<$argType> $name = createFunctionOnlyCallback<${callbackClassName}>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument($argsIndex));\n");
     2884                    push(@$outputArray, "    RefPtr<$argType> $name = createFunctionOnlyCallback<${callbackClassName}>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument($argsIndex));\n");
    28852885                } else {
    28862886                    push(@$outputArray, "    RefPtr<$argType> $name = ${callbackClassName}::create(asObject(exec->uncheckedArgument($argsIndex)), castedThis->globalObject());\n");
  • trunk/Source/WebCore/bridge/runtime_array.cpp

    r154797 r160133  
    6161}
    6262
    63 JSValue RuntimeArray::lengthGetter(ExecState*, JSValue slotBase, PropertyName)
     63EncodedJSValue RuntimeArray::lengthGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
    6464{
    65     RuntimeArray* thisObj = static_cast<RuntimeArray*>(asObject(slotBase));
    66     return jsNumber(thisObj->getLength());
     65    RuntimeArray* thisObj = jsCast<RuntimeArray*>(JSValue::decode(slotBase));
     66    return JSValue::encode(jsNumber(thisObj->getLength()));
    6767}
    6868
    69 JSValue RuntimeArray::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
     69EncodedJSValue RuntimeArray::indexGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, unsigned index)
    7070{
    71     RuntimeArray* thisObj = static_cast<RuntimeArray*>(asObject(slotBase));
    72     return thisObj->getConcreteArray()->valueAt(exec, index);
     71    RuntimeArray* thisObj = jsCast<RuntimeArray*>(JSValue::decode(slotBase));
     72    return JSValue::encode(thisObj->getConcreteArray()->valueAt(exec, index));
    7373}
    7474
  • trunk/Source/WebCore/bridge/runtime_array.h

    r156485 r160133  
    8585private:
    8686    RuntimeArray(ExecState*, Structure*);
    87     static JSValue lengthGetter(ExecState*, JSValue, PropertyName);
    88     static JSValue indexGetter(ExecState*, JSValue, unsigned);
     87    static EncodedJSValue lengthGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     88    static EncodedJSValue indexGetter(ExecState*, EncodedJSValue, EncodedJSValue, unsigned);
    8989
    9090    BindingsArray* m_array;
  • trunk/Source/WebCore/bridge/runtime_method.cpp

    r157215 r160133  
    5555}
    5656
    57 JSValue RuntimeMethod::lengthGetter(ExecState*, JSValue slotBase, PropertyName)
     57EncodedJSValue RuntimeMethod::lengthGetter(ExecState*, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
    5858{
    59     RuntimeMethod* thisObj = static_cast<RuntimeMethod*>(asObject(slotBase));
     59    RuntimeMethod* thisObj = jsCast<RuntimeMethod*>(JSValue::decode(slotBase));
    6060
    61     return jsNumber(thisObj->m_method->numParameters());
     61    return JSValue::encode(jsNumber(thisObj->m_method->numParameters()));
    6262}
    6363
  • trunk/Source/WebCore/bridge/runtime_method.h

    r156485 r160133  
    6868
    6969private:
    70     static JSValue lengthGetter(ExecState*, JSValue, PropertyName);
     70    static EncodedJSValue lengthGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    7171
    7272    Bindings::Method* m_method;
  • trunk/Source/WebCore/bridge/runtime_object.cpp

    r156485 r160133  
    6363}
    6464
    65 JSValue RuntimeObject::fallbackObjectGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
    66 {
    67     RuntimeObject* thisObj = static_cast<RuntimeObject*>(asObject(slotBase));
     65EncodedJSValue RuntimeObject::fallbackObjectGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
     66{
     67    RuntimeObject* thisObj = jsCast<RuntimeObject*>(JSValue::decode(slotBase));
    6868    RefPtr<Instance> instance = thisObj->m_instance;
    6969
    7070    if (!instance)
    71         return throwInvalidAccessError(exec);
     71        return JSValue::encode(throwInvalidAccessError(exec));
    7272   
    7373    instance->begin();
     
    7878    instance->end();
    7979           
    80     return result;
    81 }
    82 
    83 JSValue RuntimeObject::fieldGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
     80    return JSValue::encode(result);
     81}
     82
     83EncodedJSValue RuntimeObject::fieldGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
    8484{   
    85     RuntimeObject* thisObj = static_cast<RuntimeObject*>(asObject(slotBase));
     85    RuntimeObject* thisObj = jsCast<RuntimeObject*>(JSValue::decode(slotBase));
    8686    RefPtr<Instance> instance = thisObj->m_instance;
    8787
    8888    if (!instance)
    89         return throwInvalidAccessError(exec);
     89        return JSValue::encode(throwInvalidAccessError(exec));
    9090   
    9191    instance->begin();
     
    9797    instance->end();
    9898           
    99     return result;
    100 }
    101 
    102 JSValue RuntimeObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
    103 {
    104     RuntimeObject* thisObj = static_cast<RuntimeObject*>(asObject(slotBase));
     99    return JSValue::encode(result);
     100}
     101
     102EncodedJSValue RuntimeObject::methodGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
     103{
     104    RuntimeObject* thisObj = jsCast<RuntimeObject*>(JSValue::decode(slotBase));
    105105    RefPtr<Instance> instance = thisObj->m_instance;
    106106
    107107    if (!instance)
    108         return throwInvalidAccessError(exec);
     108        return JSValue::encode(throwInvalidAccessError(exec));
    109109   
    110110    instance->begin();
     
    114114    instance->end();
    115115           
    116     return method;
     116    return JSValue::encode(method);
    117117}
    118118
  • trunk/Source/WebCore/bridge/runtime_object.h

    r156485 r160133  
    7979
    8080private:
    81     static JSValue fallbackObjectGetter(ExecState*, JSValue, PropertyName);
    82     static JSValue fieldGetter(ExecState*, JSValue, PropertyName);
    83     static JSValue methodGetter(ExecState*, JSValue, PropertyName);
     81    static EncodedJSValue fallbackObjectGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     82    static EncodedJSValue fieldGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
     83    static EncodedJSValue methodGetter(ExecState*, EncodedJSValue, EncodedJSValue, PropertyName);
    8484
    8585    RefPtr<Instance> m_instance;
  • trunk/Source/WebKit2/ChangeLog

    r160129 r160133  
     12013-12-04  Oliver Hunt  <oliver@apple.com>
     2
     3        Refactor static getter function prototype to include thisValue in addition to the base object
     4        https://bugs.webkit.org/show_bug.cgi?id=124461
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Update the WK2 JSC usage to the new static getter API
     9
     10        * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
     11        (WebKit::callMethod):
     12        * WebProcess/Plugins/Netscape/JSNPObject.cpp:
     13        (WebKit::callNPJSObject):
     14        (WebKit::constructWithConstructor):
     15        (WebKit::JSNPObject::propertyGetter):
     16        (WebKit::JSNPObject::methodGetter):
     17        * WebProcess/Plugins/Netscape/JSNPObject.h:
     18        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
     19        (WebKit::NPRuntimeObjectMap::getOrCreateNPObject):
     20        (WebKit::NPRuntimeObjectMap::finalize):
     21        * WebProcess/WebPage/WebFrame.cpp:
     22        (WebKit::WebFrame::frameForContext):
     23        (WebKit::WebFrame::counterValue):
     24
    1252013-12-04  Anders Carlsson  <andersca@apple.com>
    226
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp

    r156624 r160133  
    6060static EncodedJSValue JSC_HOST_CALL callMethod(ExecState* exec)
    6161{
    62     JSNPMethod* jsNPMethod = static_cast<JSNPMethod*>(exec->callee());
     62    JSNPMethod* jsNPMethod = jsCast<JSNPMethod*>(exec->callee());
    6363
    6464    JSValue thisValue = exec->hostThisValue();
     
    6666    // Check if we're calling a method on the plug-in script object.
    6767    if (thisValue.inherits(JSHTMLElement::info())) {
    68         JSHTMLElement* element = static_cast<JSHTMLElement*>(asObject(thisValue));
     68        JSHTMLElement* element = jsCast<JSHTMLElement*>(asObject(thisValue));
    6969
    7070        // Try to get the script object from the element
     
    7474
    7575    if (thisValue.inherits(JSNPObject::info())) {
    76         JSNPObject* jsNPObject = static_cast<JSNPObject*>(asObject(thisValue));
     76        JSNPObject* jsNPObject = jsCast<JSNPObject*>(asObject(thisValue));
    7777
    7878        return JSValue::encode(jsNPObject->callMethod(exec, jsNPMethod->npIdentifier()));
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp

    r156240 r160133  
    226226    ASSERT(object->inherits(JSNPObject::info()));
    227227
    228     return JSValue::encode(static_cast<JSNPObject*>(object)->callObject(exec));
     228    return JSValue::encode(jsCast<JSNPObject*>(object)->callObject(exec));
    229229}
    230230
     
    245245    ASSERT(constructor->inherits(JSNPObject::info()));
    246246
    247     return JSValue::encode(static_cast<JSNPObject*>(constructor)->callConstructor(exec));
     247    return JSValue::encode(jsCast<JSNPObject*>(constructor)->callConstructor(exec));
    248248}
    249249
     
    418418}
    419419
    420 JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
    421 {
    422     JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase));
     420EncodedJSValue JSNPObject::propertyGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
     421{
     422    JSNPObject* thisObj = jsCast<JSNPObject*>(JSValue::decode(slotBase));
    423423    ASSERT_GC_OBJECT_INHERITS(thisObj, info());
    424424   
    425425    if (!thisObj->m_npObject)
    426         return throwInvalidAccessError(exec);
     426        return JSValue::encode(throwInvalidAccessError(exec));
    427427
    428428    if (!thisObj->m_npObject->_class->getProperty)
    429         return jsUndefined();
     429        return JSValue::encode(jsUndefined());
    430430
    431431    NPVariant result;
     
    447447
    448448    if (!returnValue)
    449         return jsUndefined();
     449        return JSValue::encode(jsUndefined());
    450450
    451451    JSValue propertyValue = thisObj->m_objectMap->convertNPVariantToJSValue(exec, thisObj->globalObject(), result);
    452452    releaseNPVariantValue(&result);
    453     return propertyValue;
    454 }
    455 
    456 JSValue JSNPObject::methodGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
    457 {
    458     JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase));
     453    return JSValue::encode(propertyValue);
     454}
     455
     456EncodedJSValue JSNPObject::methodGetter(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName propertyName)
     457{
     458    JSNPObject* thisObj = jsCast<JSNPObject*>(JSValue::decode(slotBase));
    459459    ASSERT_GC_OBJECT_INHERITS(thisObj, info());
    460460   
    461461    if (!thisObj->m_npObject)
    462         return throwInvalidAccessError(exec);
     462        return JSValue::encode(throwInvalidAccessError(exec));
    463463
    464464    NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName);
    465     return JSNPMethod::create(exec, thisObj->globalObject(), propertyName.publicName(), npIdentifier);
     465    return JSValue::encode(JSNPMethod::create(exec, thisObj->globalObject(), propertyName.publicName(), npIdentifier));
    466466}
    467467
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h

    r154373 r160133  
    9696    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode);
    9797
    98     static JSC::JSValue propertyGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
    99     static JSC::JSValue methodGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
     98    static JSC::EncodedJSValue propertyGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);
     99    static JSC::EncodedJSValue methodGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue, JSC::PropertyName);
    100100    static JSC::JSObject* throwInvalidAccessError(JSC::ExecState*);
    101101
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp

    r156626 r160133  
    7373    // If this is a JSNPObject, we can just get its underlying NPObject.
    7474    if (jsObject->classInfo() == JSNPObject::info()) {
    75         JSNPObject* jsNPObject = static_cast<JSNPObject*>(jsObject);
     75        JSNPObject* jsNPObject = jsCast<JSNPObject*>(jsObject);
    7676        NPObject* npObject = jsNPObject->npObject();
    7777       
     
    303303void NPRuntimeObjectMap::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
    304304{
    305     JSNPObject* object = static_cast<JSNPObject*>(handle.get().asCell());
     305    JSNPObject* object = jsCast<JSNPObject*>(handle.get().asCell());
    306306    weakRemove(m_jsNPObjects, static_cast<NPObject*>(context), object);
    307307    addToInvalidationQueue(object->leakNPObject());
  • trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r159234 r160133  
    665665        return String();
    666666
    667     return counterValueForElement(&static_cast<JSElement*>(toJS(element))->impl());
     667    return counterValueForElement(&jsCast<JSElement*>(toJS(element))->impl());
    668668}
    669669
Note: See TracChangeset for help on using the changeset viewer.