Ignore:
Timestamp:
Apr 15, 2014, 10:46:42 AM (11 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r167199 and r167251.
https://bugs.webkit.org/show_bug.cgi?id=131678

Caused a DYEBench regression and does not seem to improve perf
on relevant websites (Requested by rniwa on #webkit).

Reverted changesets:

"Rewrite Function.bind as a builtin"
https://bugs.webkit.org/show_bug.cgi?id=131083
http://trac.webkit.org/changeset/167199

"Update test result"
http://trac.webkit.org/changeset/167251

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r167199 r167313  
    3434#include "GetterSetter.h"
    3535#include "JSArray.h"
     36#include "JSBoundFunction.h"
    3637#include "JSFunctionInlines.h"
    3738#include "JSGlobalObject.h"
     
    251252class RetrieveCallerFunctionFunctor {
    252253public:
    253     RetrieveCallerFunctionFunctor(ExecState* exec, JSFunction* functionObj)
    254         : m_exec(exec)
    255         , m_targetCallee(jsDynamicCast<JSObject*>(functionObj))
     254    RetrieveCallerFunctionFunctor(JSFunction* functionObj)
     255        : m_targetCallee(jsDynamicCast<JSObject*>(functionObj))
    256256        , m_hasFoundFrame(false)
    257257        , m_hasSkippedToCallerFrame(false)
     
    266266        JSObject* callee = visitor->callee();
    267267
    268         if (callee && callee->hasOwnProperty(m_exec, m_exec->propertyNames().boundFunctionNamePrivateName))
     268        if (callee && callee->inherits(JSBoundFunction::info()))
    269269            return StackVisitor::Continue;
    270270
     
    284284
    285285private:
    286     ExecState* m_exec;
    287286    JSObject* m_targetCallee;
    288287    bool m_hasFoundFrame;
     
    293292static JSValue retrieveCallerFunction(ExecState* exec, JSFunction* functionObj)
    294293{
    295     RetrieveCallerFunctionFunctor functor(exec, functionObj);
     294    RetrieveCallerFunctionFunctor functor(functionObj);
    296295    exec->iterate(functor);
    297296    return functor.result();
     
    330329{
    331330    JSFunction* thisObject = jsCast<JSFunction*>(object);
    332     if (thisObject->isHostFunction())
     331    if (thisObject->isHostOrBuiltinFunction())
    333332        return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    334     if (thisObject->isBuiltinFunction()) {
    335         if (propertyName == exec->propertyNames().caller) {
    336             if (thisObject->jsExecutable()->isStrictMode()) {
    337                 bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    338                 if (!result) {
    339                     thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor);
    340                     result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    341                     ASSERT(result);
    342                 }
    343                 return result;
    344             }
    345             slot.setCacheableCustom(thisObject, ReadOnly | DontEnum | DontDelete, callerGetter);
    346             return true;
    347         }
    348         if (propertyName == exec->propertyNames().prototypeForHasInstancePrivateName) {
    349             PropertySlot boundFunctionSlot(thisObject);
    350             if (Base::getOwnPropertySlot(thisObject, exec, exec->propertyNames().boundFunctionPrivateName, boundFunctionSlot)) {
    351                 JSValue boundFunction = boundFunctionSlot.getValue(exec, exec->propertyNames().boundFunctionPrivateName);
    352                 PropertySlot boundPrototypeSlot(asObject(boundFunction));
    353                 if (asObject(boundFunction)->getPropertySlot(exec, propertyName, boundPrototypeSlot)) {
    354                     slot.setValue(boundPrototypeSlot.slotBase(), boundPrototypeSlot.attributes(), boundPrototypeSlot.getValue(exec, propertyName));
    355                     return true;
    356                 }
    357             }
    358         }
    359         if (propertyName == exec->propertyNames().name) {
    360             PropertySlot nameSlot(thisObject);
    361             if (Base::getOwnPropertySlot(thisObject, exec, exec->vm().propertyNames->boundFunctionNamePrivateName, nameSlot)) {
    362                 slot.setValue(thisObject, DontEnum | DontDelete | ReadOnly, nameSlot.getValue(exec, exec->vm().propertyNames->boundFunctionNamePrivateName));
    363                 return true;
    364             }
    365         }
    366         if (propertyName == exec->propertyNames().length) {
    367             PropertySlot lengthSlot(thisObject);
    368             if (Base::getOwnPropertySlot(thisObject, exec, exec->vm().propertyNames->boundFunctionLengthPrivateName, lengthSlot)) {
    369                 slot.setValue(thisObject, DontEnum | DontDelete | ReadOnly, lengthSlot.getValue(exec, exec->vm().propertyNames->boundFunctionLengthPrivateName));
    370                 return true;
    371             }
    372         }
    373            
    374         return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    375     }
    376    
    377     if (propertyName == exec->propertyNames().prototype || propertyName == exec->propertyNames().prototypeForHasInstancePrivateName) {
     333
     334    if (propertyName == exec->propertyNames().prototype) {
    378335        VM& vm = exec->vm();
    379336        unsigned attributes;
     
    382339            JSObject* prototype = constructEmptyObject(exec);
    383340            prototype->putDirect(vm, exec->propertyNames().constructor, thisObject, DontEnum);
    384             thisObject->putDirectPrototypeProperty(vm, prototype, DontDelete | DontEnum);
     341            thisObject->putDirect(vm, exec->propertyNames().prototype, prototype, DontDelete | DontEnum);
    385342            offset = thisObject->getDirectOffset(vm, exec->propertyNames().prototype, attributes);
    386343            ASSERT(isValidOffset(offset));
     
    434391{
    435392    JSFunction* thisObject = jsCast<JSFunction*>(object);
    436     if (mode == IncludeDontEnumProperties) {
    437         bool shouldIncludeJSFunctionProperties = !thisObject->isHostOrBuiltinFunction();
    438         if (!shouldIncludeJSFunctionProperties && thisObject->isBuiltinFunction()) {
    439             PropertySlot boundFunctionSlot(thisObject);
    440             shouldIncludeJSFunctionProperties = Base::getOwnPropertySlot(thisObject, exec, exec->propertyNames().boundFunctionPrivateName, boundFunctionSlot);
    441         }
    442         if (shouldIncludeJSFunctionProperties) {
    443             VM& vm = exec->vm();
    444             // Make sure prototype has been reified.
    445             PropertySlot slot(thisObject);
    446             thisObject->methodTable(vm)->getOwnPropertySlot(thisObject, exec, vm.propertyNames->prototype, slot);
    447 
    448             propertyNames.add(vm.propertyNames->arguments);
    449             propertyNames.add(vm.propertyNames->caller);
    450             propertyNames.add(vm.propertyNames->length);
    451             propertyNames.add(vm.propertyNames->name);
    452         }
     393    if (!thisObject->isHostOrBuiltinFunction() && (mode == IncludeDontEnumProperties)) {
     394        VM& vm = exec->vm();
     395        // Make sure prototype has been reified.
     396        PropertySlot slot(thisObject);
     397        thisObject->methodTable(vm)->getOwnPropertySlot(thisObject, exec, vm.propertyNames->prototype, slot);
     398
     399        propertyNames.add(vm.propertyNames->arguments);
     400        propertyNames.add(vm.propertyNames->caller);
     401        propertyNames.add(vm.propertyNames->length);
     402        propertyNames.add(vm.propertyNames->name);
    453403    }
    454404    Base::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
     
    470420        thisObject->m_allocationProfileWatchpoint.fireAll();
    471421        // Don't allow this to be cached, since a [[Put]] must clear m_allocationProfile.
    472         PutPropertySlot dontCachePrototype(thisObject);
    473         Base::put(thisObject, exec, propertyName, value, dontCachePrototype);
    474         PutPropertySlot dontCachePrototypeForHasInstance(thisObject);
    475         Base::put(thisObject, exec, exec->propertyNames().prototypeForHasInstancePrivateName, value, dontCachePrototypeForHasInstance);
     422        PutPropertySlot dontCache(thisObject);
     423        Base::put(thisObject, exec, propertyName, value, dontCache);
    476424        return;
    477425    }
     
    518466        thisObject->m_allocationProfile.clear();
    519467        thisObject->m_allocationProfileWatchpoint.fireAll();
    520         if (!Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException))
    521             return false;
    522         Base::defineOwnProperty(object, exec, exec->propertyNames().prototypeForHasInstancePrivateName, descriptor, throwException);
    523         return true;
     468        return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
    524469    }
    525470
Note: See TracChangeset for help on using the changeset viewer.