Ignore:
Timestamp:
Oct 20, 2017, 12:50:08 AM (8 years ago)
Author:
[email protected]
Message:

Optimize accesses to how we get the direct prototype
https://bugs.webkit.org/show_bug.cgi?id=178548

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

This patch makes JSObject::getPrototypeDirect take VM& as a parameter
so it can use the faster version of the structure accessor function.
The reason for making this change is that JSObjet::getPrototypeDirect
is called on the hot path in property lookup.

  • API/JSObjectRef.cpp:

(JSObjectGetPrototype):

  • jsc.cpp:

(WTF::DOMJITGetterBaseJSObject::DOMJITAttribute::slowCall):
(WTF::DOMJITGetterBaseJSObject::customGetter):
(functionCreateProxy):

  • runtime/ArrayPrototype.cpp:

(JSC::speciesWatchpointIsValid):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::sanitizedToString):

  • runtime/JSArray.cpp:

(JSC::JSArray::isIteratorProtocolFastAndNonObservable):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):
(JSC::lastInPrototypeChain):
(JSC::JSGlobalObject::resetPrototype):
(JSC::JSGlobalObject::finishCreation):

  • runtime/JSGlobalObjectInlines.h:

(JSC::JSGlobalObject::objectPrototypeIsSane):
(JSC::JSGlobalObject::arrayPrototypeChainIsSane):
(JSC::JSGlobalObject::stringPrototypeChainIsSane):

  • runtime/JSLexicalEnvironment.cpp:

(JSC::JSLexicalEnvironment::getOwnPropertySlot):

  • runtime/JSMap.cpp:

(JSC::JSMap::isIteratorProtocolFastAndNonObservable):

  • runtime/JSObject.cpp:

(JSC::JSObject::calculatedClassName):
(JSC::JSObject::setPrototypeWithCycleCheck):
(JSC::JSObject::getPrototype):
(JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype):
(JSC::JSObject::attemptToInterceptPutByIndexOnHole):
(JSC::JSObject::anyObjectInChainMayInterceptIndexedAccesses const):
(JSC::JSObject::prototypeChainMayInterceptStoreTo):

  • runtime/JSObject.h:

(JSC::JSObject::finishCreation):
(JSC::JSObject::getPrototypeDirect const):
(JSC::JSObject::getPrototype):

  • runtime/JSObjectInlines.h:

(JSC::JSObject::canPerformFastPutInline):
(JSC::JSObject::getPropertySlot):
(JSC::JSObject::getNonIndexPropertySlot):

  • runtime/JSProxy.cpp:

(JSC::JSProxy::setTarget):

  • runtime/JSSet.cpp:

(JSC::JSSet::isIteratorProtocolFastAndNonObservable):

  • runtime/ProgramExecutable.cpp:

(JSC::ProgramExecutable::initializeGlobalProperties):

  • runtime/StructureInlines.h:

(JSC::Structure::isValid const):

Source/WebCore:

No new tests: no functionality change.

  • bindings/js/JSDOMAbstractOperations.h:

(WebCore::isVisibleNamedProperty):
(WebCore::accessVisibleNamedProperty):

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::toJSDOMWindow):

  • bindings/js/JSDOMWindowProperties.cpp:

(WebCore::JSDOMWindowProperties::getOwnPropertySlot):

  • bindings/js/JSPluginElementFunctions.cpp:

(WebCore::pluginElementCustomGetOwnPropertySlot):

  • bindings/js/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::initScript):

  • bindings/scripts/CodeGeneratorJS.pm:

(GeneratePut):
(GeneratePutByIndex):
(GenerateConstructorHelperMethods):

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

(WebCore::JSTestGlobalObjectConstructor::initializeProperties):

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

(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::put):
(WebCore::JSTestNamedAndIndexedSetterNoIdentifier::putByIndex):

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

(WebCore::JSTestNamedAndIndexedSetterThrowingException::put):
(WebCore::JSTestNamedAndIndexedSetterThrowingException::putByIndex):

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

(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::put):
(WebCore::JSTestNamedAndIndexedSetterWithIdentifier::putByIndex):

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

(WebCore::JSTestNamedSetterNoIdentifier::put):
(WebCore::JSTestNamedSetterNoIdentifier::putByIndex):

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

(WebCore::JSTestNamedSetterThrowingException::put):
(WebCore::JSTestNamedSetterThrowingException::putByIndex):

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

(WebCore::JSTestNamedSetterWithIdentifier::put):
(WebCore::JSTestNamedSetterWithIdentifier::putByIndex):

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

(WebCore::JSTestNamedSetterWithIndexedGetter::put):
(WebCore::JSTestNamedSetterWithIndexedGetter::putByIndex):

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

(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::put):
(WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::putByIndex):

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

(WebCore::JSTestNamedSetterWithUnforgableProperties::put):
(WebCore::JSTestNamedSetterWithUnforgableProperties::putByIndex):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r223738 r223746  
    997997            NativeCallFrameTracer tracer(&vm, exec);
    998998            JSObject* object = static_cast<JSObject*>(pointer);
    999             return JSValue::encode(object->getPrototypeDirect());
     999            return JSValue::encode(object->getPrototypeDirect(vm));
    10001000        }
    10011001
     
    10241024        JSObject* thisObject = jsDynamicCast<JSObject*>(vm, JSValue::decode(thisValue));
    10251025        RELEASE_ASSERT(thisObject);
    1026         return JSValue::encode(thisObject->getPrototypeDirect());
     1026        return JSValue::encode(thisObject->getPrototypeDirect(vm));
    10271027    }
    10281028};
     
    22122212        return JSValue::encode(jsUndefined());
    22132213    JSObject* jsTarget = asObject(target.asCell());
    2214     Structure* structure = JSProxy::createStructure(vm, exec->lexicalGlobalObject(), jsTarget->getPrototypeDirect(), ImpureProxyType);
     2214    Structure* structure = JSProxy::createStructure(vm, exec->lexicalGlobalObject(), jsTarget->getPrototypeDirect(vm), ImpureProxyType);
    22152215    JSProxy* proxy = JSProxy::create(vm, structure, jsTarget);
    22162216    return JSValue::encode(proxy);
Note: See TracChangeset for help on using the changeset viewer.