Ignore:
Timestamp:
May 18, 2010, 11:04:18 PM (15 years ago)
Author:
[email protected]
Message:

Bug 39343 - Dynamically generate a native call thunk per NativeFunction

Reviewed by Geoff Garen.

https://bugs.webkit.org/show_bug.cgi?id=39252 regressed performance on i386,
by adding an extra indirection to making a native call. By introducing per-
NativeFunction thunks we can hard code the function pointer into the thunk
so that it need not be loaded from the callee.

  • jit/JIT.h:

(JSC::JIT::compileCTINativeCall):

  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileCTINativeCall):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::privateCompileCTINativeCall):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitSlow_op_get_by_val):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emitSlow_op_get_by_val):

  • jit/JITStubs.cpp:

(JSC::JITThunks::ctiStub):
(JSC::JITThunks::hostFunctionStub):

  • jit/JITStubs.h:
  • jit/SpecializedThunkJIT.h:

(JSC::SpecializedThunkJIT::finalize):

  • jit/ThunkGenerators.cpp:

(JSC::charCodeAtThunkGenerator):
(JSC::charAtThunkGenerator):
(JSC::fromCharCodeThunkGenerator):
(JSC::sqrtThunkGenerator):
(JSC::powThunkGenerator):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::JSFunction):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::getHostFunction):

  • runtime/JSGlobalData.h:

(JSC::JSGlobalData::getCTIStub):

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/StringConstructor.cpp:

(JSC::StringConstructor::StringConstructor):

  • wtf/Platform.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r59742 r59746  
    34053405}
    34063406
    3407 MacroAssemblerCodePtr JITThunks::specializedThunk(JSGlobalData* globalData, ThunkGenerator generator)
    3408 {
    3409     std::pair<ThunkMap::iterator, bool> entry = m_thunkMap.add(generator, MacroAssemblerCodePtr());
     3407MacroAssemblerCodePtr JITThunks::ctiStub(JSGlobalData* globalData, ThunkGenerator generator)
     3408{
     3409    std::pair<CTIStubMap::iterator, bool> entry = m_ctiStubMap.add(generator, MacroAssemblerCodePtr());
    34103410    if (entry.second)
    34113411        entry.first->second = generator(globalData, m_executablePool.get());
     
    34133413}
    34143414
     3415PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function)
     3416{
     3417    std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
     3418    if (entry.second)
     3419        entry.first->second = NativeExecutable::create(JIT::compileCTINativeCall(globalData, m_executablePool, function), function);
     3420    return entry.first->second;
     3421}
     3422
     3423PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator)
     3424{
     3425    std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
     3426    if (entry.second)
     3427        entry.first->second = NativeExecutable::create(generator(globalData, m_executablePool.get()), function);
     3428    return entry.first->second;
     3429}
     3430
    34153431} // namespace JSC
    34163432
Note: See TracChangeset for help on using the changeset viewer.