Ignore:
Timestamp:
Sep 22, 2008, 8:03:52 AM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-09-22 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.


  • speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag

Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>


2.2% speedup on EarleyBoyer benchmark.

  • API/JSCallbackConstructor.cpp:
  • API/JSCallbackConstructor.h: (JSC::JSCallbackConstructor::createStructureID):
  • API/JSCallbackFunction.cpp:
  • API/JSCallbackFunction.h: (JSC::JSCallbackFunction::createStructureID):
  • API/JSCallbackObject.h: (JSC::JSCallbackObject::createStructureID):
  • API/JSCallbackObjectFunctions.h: (JSC::::hasInstance):
  • API/JSValueRef.cpp: (JSValueIsInstanceOfConstructor):
  • JavaScriptCore.exp:
  • VM/Machine.cpp: (JSC::Machine::privateExecute): (JSC::Machine::cti_op_instanceof):
  • kjs/InternalFunction.cpp:
  • kjs/InternalFunction.h: (JSC::InternalFunction::createStructureID):
  • kjs/JSObject.cpp:
  • kjs/JSObject.h:
  • kjs/TypeInfo.h: (JSC::TypeInfo::implementsHasInstance):

WebCore:

2008-09-22 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.

  • speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag

Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>


2.2% speedup on EarleyBoyer benchmark.

  • bindings/js/JSQuarantinedObjectWrapper.cpp:
  • bindings/js/JSQuarantinedObjectWrapper.h: (WebCore::JSQuarantinedObjectWrapper::createStructureID):
  • bindings/scripts/CodeGeneratorJS.pm:
File:
1 edited

Legend:

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

    r36726 r36766  
    274274
    275275template <class Base>
    276 bool JSCallbackObject<Base>::implementsHasInstance() const
    277 {
    278     for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
    279         if (jsClass->hasInstance)
    280             return true;
    281    
     276bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue* value, JSValue*)
     277{
     278    JSContextRef execRef = toRef(exec);
     279    JSObjectRef thisRef = toRef(this);
     280   
     281    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
     282        if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
     283            JSLock::DropAllLocks dropAllLocks(exec);
     284            return hasInstance(execRef, thisRef, toRef(value), toRef(exec->exceptionSlot()));
     285        }
     286    }
    282287    return false;
    283 }
    284 
    285 template <class Base>
    286 bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue* value, JSValue*)
    287 {
    288     JSContextRef execRef = toRef(exec);
    289     JSObjectRef thisRef = toRef(this);
    290    
    291     for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
    292         if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
    293             JSLock::DropAllLocks dropAllLocks(exec);
    294             return hasInstance(execRef, thisRef, toRef(value), toRef(exec->exceptionSlot()));
    295         }
    296     }
    297     ASSERT_NOT_REACHED(); // implementsHasInstance should prevent us from reaching here
    298     return 0;
    299288}
    300289
Note: See TracChangeset for help on using the changeset viewer.