Changeset 90437 in webkit


Ignore:
Timestamp:
Jul 5, 2011 11:35:44 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-07-05 Filip Pizlo <fpizlo@apple.com>

DFG JIT virtual call implementation is inefficient.
https://bugs.webkit.org/show_bug.cgi?id=63974

Reviewed by Gavin Barraclough.

  • dfg/DFGOperations.cpp:
  • runtime/Executable.h: (JSC::ExecutableBase::generatedJITCodeForCallWithArityCheck): (JSC::ExecutableBase::generatedJITCodeForConstructWithArityCheck): (JSC::ExecutableBase::generatedJITCodeWithArityCheckFor): (JSC::ExecutableBase::hasJITCodeForCall): (JSC::ExecutableBase::hasJITCodeForConstruct): (JSC::ExecutableBase::hasJITCodeFor):
  • runtime/JSFunction.h: (JSC::JSFunction::scopeUnchecked):
Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r90426 r90437  
     12011-07-05  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG JIT virtual call implementation is inefficient.
     4        https://bugs.webkit.org/show_bug.cgi?id=63974
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        * dfg/DFGOperations.cpp:
     9        * runtime/Executable.h:
     10        (JSC::ExecutableBase::generatedJITCodeForCallWithArityCheck):
     11        (JSC::ExecutableBase::generatedJITCodeForConstructWithArityCheck):
     12        (JSC::ExecutableBase::generatedJITCodeWithArityCheckFor):
     13        (JSC::ExecutableBase::hasJITCodeForCall):
     14        (JSC::ExecutableBase::hasJITCodeForConstruct):
     15        (JSC::ExecutableBase::hasJITCodeFor):
     16        * runtime/JSFunction.h:
     17        (JSC::JSFunction::scopeUnchecked):
     18
    1192011-07-05  Oliver Hunt  <oliver@apple.com>
    220
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r90423 r90437  
    489489    JSValue calleeAsValue = execCallee->calleeAsValue();
    490490    JSCell* calleeAsFunctionCell = getJSFunction(*globalData, calleeAsValue);
    491     if (!calleeAsFunctionCell)
     491    if (UNLIKELY(!calleeAsFunctionCell))
    492492        return handleHostCall(execCallee, calleeAsValue);
    493493   
    494494    JSFunction* function = asFunction(calleeAsFunctionCell);
    495495    ExecutableBase* executable = function->executable();
    496     if (executable->isHostFunction())
    497         return executable->generatedJITCodeForCall().addressForCall().executableAddress();
    498 
    499     FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
    500     JSObject* error = functionExecutable->compileForCall(exec, function->scope());
    501     if (error) {
    502         exec->globalData().exception = error;
    503         return 0;
    504     }
    505     execCallee->setScopeChain(function->scope());
    506     return functionExecutable->generatedJITCodeForCallWithArityCheck().executableAddress();
     496    if (UNLIKELY(!executable->hasJITCodeForCall())) {
     497        FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
     498        JSObject* error = functionExecutable->compileForCall(exec, function->scope());
     499        if (error) {
     500            exec->globalData().exception = error;
     501            return 0;
     502        }
     503    }
     504    execCallee->setScopeChain(function->scopeUnchecked());
     505    return executable->generatedJITCodeForCallWithArityCheck().executableAddress();
    507506}
    508507
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r90414 r90437  
    103103        }
    104104
     105        MacroAssemblerCodePtr generatedJITCodeForCallWithArityCheck()
     106        {
     107            ASSERT(m_jitCodeForCall);
     108            ASSERT(m_jitCodeForCallWithArityCheck);
     109            return m_jitCodeForCallWithArityCheck;
     110        }
     111
     112        MacroAssemblerCodePtr generatedJITCodeForConstructWithArityCheck()
     113        {
     114            ASSERT(m_jitCodeForConstruct);
     115            ASSERT(m_jitCodeForConstructWithArityCheck);
     116            return m_jitCodeForConstructWithArityCheck;
     117        }
     118       
     119        MacroAssemblerCodePtr generatedJITCodeWithArityCheckFor(CodeSpecializationKind kind)
     120        {
     121            if (kind == CodeForCall)
     122                return generatedJITCodeForCallWithArityCheck();
     123            ASSERT(kind == CodeForConstruct);
     124            return generatedJITCodeForConstructWithArityCheck();
     125        }
     126       
     127        bool hasJITCodeForCall() const
     128        {
     129            return m_numParametersForCall >= 0;
     130        }
     131       
     132        bool hasJITCodeForConstruct() const
     133        {
     134            return m_numParametersForConstruct >= 0;
     135        }
     136       
     137        bool hasJITCodeFor(CodeSpecializationKind kind) const
     138        {
     139            if (kind == CodeForCall)
     140                return hasJITCodeForCall();
     141            ASSERT(kind == CodeForConstruct);
     142            return hasJITCodeForConstruct();
     143        }
     144
    105145        void clearExecutableCode()
    106146        {
     
    456496        Identifier m_name;
    457497        SharedSymbolTable* m_symbolTable;
    458 
    459 #if ENABLE(JIT)
    460     public:
    461         MacroAssemblerCodePtr generatedJITCodeForCallWithArityCheck()
    462         {
    463             ASSERT(m_jitCodeForCall);
    464             ASSERT(m_jitCodeForCallWithArityCheck);
    465             return m_jitCodeForCallWithArityCheck;
    466         }
    467 
    468         MacroAssemblerCodePtr generatedJITCodeForConstructWithArityCheck()
    469         {
    470             ASSERT(m_jitCodeForConstruct);
    471             ASSERT(m_jitCodeForConstructWithArityCheck);
    472             return m_jitCodeForConstructWithArityCheck;
    473         }
    474        
    475         MacroAssemblerCodePtr generatedJITCodeWithArityCheckFor(CodeSpecializationKind kind)
    476         {
    477             if (kind == CodeForCall)
    478                 return generatedJITCodeForCallWithArityCheck();
    479             ASSERT(kind == CodeForConstruct);
    480             return generatedJITCodeForConstructWithArityCheck();
    481         }
    482 #endif
    483498    };
    484499
  • trunk/Source/JavaScriptCore/runtime/JSFunction.h

    r90423 r90437  
    6464            return m_scopeChain.get();
    6565        }
     66        // This method may be called for host functins, in which case it
     67        // will return an arbitrary value. This should only be used for
     68        // optimized paths in which the return value does not matter for
     69        // host functions, and checking whether the function is a host
     70        // function is deemed too expensive.
     71        ScopeChainNode* scopeUnchecked()
     72        {
     73            return m_scopeChain.get();
     74        }
    6675        void setScope(JSGlobalData& globalData, ScopeChainNode* scopeChain)
    6776        {
Note: See TracChangeset for help on using the changeset viewer.