Ignore:
Timestamp:
Sep 16, 2011, 11:50:04 AM (14 years ago)
Author:
[email protected]
Message:

DFG JIT should inline Math.abs
https://bugs.webkit.org/show_bug.cgi?id=68227

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

This adds the ability to track intrinsic functions throughout the
host function infrastructure, so that the DFG can easily query
whether or not a call's target is intrinsic, and if so, which
intrinsic it is.

On top of this, it adds Math.abs intrinsics to DFG. Call(Math.abs)
is transformed into ValueToNumber<-ArithAbs nodes. These nodes
then get optimized using the usual tricks.

Also had to make a completely unrelated change to
DateInstanceCache.h in order to fix a preexisting alphabetical
sorting problem in JSGlobalData.h

This results in a big win in imaging-gaussian-blur: 61% faster
than before. The net win on Kraken is around 13%.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • create_hash_table:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::isFunctionConstant):
(JSC::DFG::Graph::valueOfFunctionConstant):

  • dfg/DFGIntrinsic.h: Added.
  • dfg/DFGJITCodeGenerator.h:

(JSC::DFG::JITCodeGenerator::isFunctionConstant):
(JSC::DFG::JITCodeGenerator::valueOfFunctionConstant):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::isFunctionConstant):
(JSC::DFG::JITCompiler::valueOfFunctionConstant):

  • dfg/DFGNode.h:
  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::propagateNode):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • jit/JITStubs.cpp:

(JSC::JITThunks::hostFunctionStub):

  • jit/JITStubs.h:
  • runtime/DateInstanceCache.h:
  • runtime/Executable.cpp:

(JSC::ExecutableBase::intrinsic):
(JSC::NativeExecutable::intrinsic):

  • runtime/Executable.h:

(JSC::NativeExecutable::create):
(JSC::NativeExecutable::finishCreation):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::getHostFunction):

  • runtime/JSGlobalData.h:
  • runtime/Lookup.cpp:

(JSC::HashTable::createTable):
(JSC::setUpStaticFunctionSlot):

  • runtime/Lookup.h:

(JSC::HashEntry::initialize):
(JSC::HashEntry::intrinsic):

Source/WebCore:

Reviewed by Oliver Hunt.

Added JavaScriptCore/dfg to include path path. Changed the bindings
scripts to handle the presence of intrinsics.

  • CMakeLists.txt:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHashTable):

Source/WebKit:

Reviewed by Oliver Hunt.

Added JavaScriptCore/dfg to include path path.

  • CMakeLists.txt:

Source/WebKit2:

Reviewed by Oliver Hunt.

Added JavaScriptCore/dfg to include path path.

  • CMakeLists.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r94929 r95310  
    157157        }
    158158
     159#if ENABLE(DFG_JIT)
     160        virtual DFG::Intrinsic intrinsic() const;
     161#endif
     162
    159163    protected:
    160164        JITCode m_jitCodeForCall;
     
    174178
    175179#if ENABLE(JIT)
    176         static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodeRef callThunk, NativeFunction function, MacroAssemblerCodeRef constructThunk, NativeFunction constructor)
     180        static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodeRef callThunk, NativeFunction function, MacroAssemblerCodeRef constructThunk, NativeFunction constructor, DFG::Intrinsic intrinsic)
    177181        {
    178182            NativeExecutable* executable;
    179183            if (!callThunk) {
    180184                executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor);
    181                 executable->finishCreation(globalData, JITCode(), JITCode());
     185                executable->finishCreation(globalData, JITCode(), JITCode(), intrinsic);
    182186            } else {
    183187                executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor);
    184                 executable->finishCreation(globalData, JITCode::HostFunction(callThunk), JITCode::HostFunction(constructThunk));
     188                executable->finishCreation(globalData, JITCode::HostFunction(callThunk), JITCode::HostFunction(constructThunk), intrinsic);
    185189            }
    186190            return executable;
     
    205209    protected:
    206210#if ENABLE(JIT)
    207         void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk)
     211        void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk, DFG::Intrinsic intrinsic)
    208212        {
    209213            Base::finishCreation(globalData);
     
    212216            m_jitCodeForCallWithArityCheck = callThunk.addressForCall();
    213217            m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall();
    214         }
     218#if ENABLE(DFG_JIT)
     219            m_intrinsic = intrinsic;
     220#endif
     221        }
     222#endif
     223       
     224#if ENABLE(DFG_JIT)
     225        virtual DFG::Intrinsic intrinsic() const;
    215226#endif
    216227 
     
    236247        // trampoline. It may be easier to make NativeFunction be passed 'this' as a part of the ArgList.
    237248        NativeFunction m_constructor;
     249       
     250        DFG::Intrinsic m_intrinsic;
    238251    };
    239252
Note: See TracChangeset for help on using the changeset viewer.