Ignore:
Timestamp:
Dec 23, 2013, 4:11:25 PM (11 years ago)
Author:
[email protected]
Message:

Refactor PutPropertySlot to be aware of custom properties
https://bugs.webkit.org/show_bug.cgi?id=126187

Reviewed by msaboff.

Source/JavaScriptCore:

Refactor PutPropertySlot, making the constructor take the thisValue
used as a target. This results in a wide range of boilerplate changes
to pass the new parameter.

  • API/JSObjectRef.cpp:

(JSObjectSetProperty):

  • dfg/DFGOperations.cpp:

(JSC::DFG::operationPutByValInternal):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):

  • jit/JITOperations.cpp:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/Arguments.cpp:

(JSC::Arguments::putByIndex):

  • runtime/ArrayPrototype.cpp:

(JSC::putProperty):
(JSC::arrayProtoFuncPush):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::putToPrimitiveByIndex):

  • runtime/JSCell.cpp:

(JSC::JSCell::putByIndex):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::put):

  • runtime/JSGenericTypedArrayViewInlines.h:

(JSC::JSGenericTypedArrayView<Adaptor>::putByIndex):

  • runtime/JSONObject.cpp:

(JSC::Walker::walk):

  • runtime/JSObject.cpp:

(JSC::JSObject::putByIndex):
(JSC::JSObject::putDirectNonIndexAccessor):
(JSC::JSObject::deleteProperty):

  • runtime/JSObject.h:

(JSC::JSObject::putDirect):

  • runtime/Lookup.h:

(JSC::putEntry):
(JSC::lookupPut):

  • runtime/PutPropertySlot.h:

(JSC::PutPropertySlot::PutPropertySlot):
(JSC::PutPropertySlot::setCustomProperty):
(JSC::PutPropertySlot::thisValue):
(JSC::PutPropertySlot::isCacheable):

Source/WebCore:

Update the bindings code generation and custom objects
to the new function signatures

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::put):

  • bindings/objc/WebScriptObject.mm:

(-[WebScriptObject setValue:forKey:]):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::JSTestInterface::putByIndex):

  • bridge/NP_jsobject.cpp:

(_NPN_SetProperty):

Source/WebKit/mac:

Update for new method signatures.

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::setProperty):

Source/WebKit2:

Update for new method signatures.

  • WebProcess/Plugins/Netscape/NPJSObject.cpp:

(WebKit::NPJSObject::setProperty):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r161009 r161033  
    2727#include "JSGlobalObject.h"
    2828#include "PropertySlot.h"
     29#include "PutPropertySlot.h"
    2930#include <wtf/Assertions.h>
    3031
     
    4243    // ie. typedef JSValue (*GetFunction)(ExecState*, JSObject* baseObject)
    4344    typedef PropertySlot::GetValueFunc GetFunction;
    44     typedef void (*PutFunction)(ExecState*, EncodedJSValue base, EncodedJSValue value);
     45    typedef PutPropertySlot::PutValueFunc PutFunction;
    4546
    4647    class HashEntry {
     
    291292    }
    292293
    293     template <class ThisImp>
    294     inline void putEntry(ExecState* exec, const HashEntry* entry, PropertyName propertyName, JSValue value, ThisImp* thisObj, bool shouldThrow = false)
     294    inline void putEntry(ExecState* exec, const HashEntry* entry, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
    295295    {
    296296        // If this is a function put it as an override property.
    297297        if (entry->attributes() & Function)
    298             thisObj->putDirect(exec->vm(), propertyName, value);
    299         else if (!(entry->attributes() & ReadOnly))
    300             entry->propertyPutter()(exec, JSValue::encode(thisObj), JSValue::encode(value));
    301         else if (shouldThrow)
     298            slot.base()->putDirect(exec->vm(), propertyName, value);
     299        else if (!(entry->attributes() & ReadOnly)) {
     300            entry->propertyPutter()(exec, JSValue::encode(slot.thisValue()), JSValue::encode(value));
     301            slot.setCustomProperty(slot.base(), entry->propertyPutter());
     302        } else if (slot.isStrictMode())
    302303            throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
    303304    }
     
    308309     * is found it sets the value and returns true, else it returns false.
    309310     */
    310     template <class ThisImp>
    311     inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable& table, ThisImp* thisObj, bool shouldThrow = false)
     311    inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable& table, PutPropertySlot& slot)
    312312    {
    313313        const HashEntry* entry = table.entry(exec, propertyName);
     
    316316            return false;
    317317
    318         putEntry<ThisImp>(exec, entry, propertyName, value, thisObj, shouldThrow);
     318        putEntry(exec, entry, propertyName, value, slot);
    319319        return true;
    320320    }
     
    329329    inline void lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable& table, ThisImp* thisObj, PutPropertySlot& slot)
    330330    {
    331         if (!lookupPut<ThisImp>(exec, propertyName, value, table, thisObj, slot.isStrictMode()))
     331        if (!lookupPut(exec, propertyName, value, table, slot))
    332332            ParentImp::put(thisObj, exec, propertyName, value, slot); // not found: forward to parent
    333333    }
Note: See TracChangeset for help on using the changeset viewer.