Ignore:
Timestamp:
Jul 31, 2013, 4:57:23 PM (12 years ago)
Author:
[email protected]
Message:

Reduce JSC API static value setter/getter overhead.
https://bugs.webkit.org/show_bug.cgi?id=119277

Patch by Yi Shen <[email protected]> on 2013-07-31
Reviewed by Geoffrey Garen.

Add property name to the static value entry, so that OpaqueJSString::create() doesn't
need to get called every time when set or get the static value.

  • API/JSCallbackObjectFunctions.h:

(JSC::::put):
(JSC::::putByIndex):
(JSC::::getStaticValue):

  • API/JSClassRef.cpp:

(OpaqueJSClassContextData::OpaqueJSClassContextData):

  • API/JSClassRef.h:

(StaticValueEntry::StaticValueEntry):

File:
1 edited

Legend:

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

    r153532 r153547  
    264264                        return;
    265265                    if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
    266                         if (!propertyNameRef)
    267                             propertyNameRef = OpaqueJSString::create(name);
    268266                        JSValueRef exception = 0;
    269267                        bool result;
    270268                        {
    271269                            APICallbackShim callbackShim(exec);
    272                             result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
     270                            result = setProperty(ctx, thisRef, entry->propertyNameRef.get(), valueRef, &exception);
    273271                        }
    274272                        if (exception)
     
    325323                    return;
    326324                if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
    327                     if (!propertyNameRef)
    328                         propertyNameRef = OpaqueJSString::create(propertyName.impl());
    329325                    JSValueRef exception = 0;
    330326                    bool result;
    331327                    {
    332328                        APICallbackShim callbackShim(exec);
    333                         result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
     329                        result = setProperty(ctx, thisRef, entry->propertyNameRef.get(), valueRef, &exception);
    334330                    }
    335331                    if (exception)
     
    581577{
    582578    JSObjectRef thisRef = toRef(this);
    583     RefPtr<OpaqueJSString> propertyNameRef;
    584579   
    585580    if (StringImpl* name = propertyName.publicName()) {
     
    588583                if (StaticValueEntry* entry = staticValues->get(name)) {
    589584                    if (JSObjectGetPropertyCallback getProperty = entry->getProperty) {
    590                         if (!propertyNameRef)
    591                             propertyNameRef = OpaqueJSString::create(name);
    592585                        JSValueRef exception = 0;
    593586                        JSValueRef value;
    594587                        {
    595588                            APICallbackShim callbackShim(exec);
    596                             value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
     589                            value = getProperty(toRef(exec), thisRef, entry->propertyNameRef.get(), &exception);
    597590                        }
    598591                        if (exception) {
Note: See TracChangeset for help on using the changeset viewer.