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/Lookup.h

    r94701 r95310  
    2323
    2424#include "CallFrame.h"
     25#include "DFGIntrinsic.h"
    2526#include "Identifier.h"
    2627#include "JSGlobalObject.h"
     
    4546#if ENABLE(JIT)
    4647        ThunkGenerator generator;
     48#if ENABLE(DFG_JIT)
     49        DFG::Intrinsic intrinsic;
     50#endif
    4751#endif
    4852    };
     
    5963#if ENABLE(JIT)
    6064                        , ThunkGenerator generator = 0
     65#if ENABLE(DFG_JIT)
     66                        , DFG::Intrinsic intrinsic = DFG::NoIntrinsic
     67#endif
    6168#endif
    6269                        )
     
    6875#if ENABLE(JIT)
    6976            m_u.function.generator = generator;
     77#if ENABLE(DFG_JIT)
     78            m_u.function.intrinsic = intrinsic;
     79#endif
    7080#endif
    7181            m_next = 0;
     
    7989#if ENABLE(JIT)
    8090        ThunkGenerator generator() const { ASSERT(m_attributes & Function); return m_u.function.generator; }
     91        DFG::Intrinsic intrinsic() const
     92        {
     93            ASSERT(m_attributes & Function);
     94#if ENABLE(DFG_JIT)
     95            return m_u.function.intrinsic;
     96#else
     97            return DFG::NoIntrinsic;
     98#endif
     99        }
    81100#endif
    82101        NativeFunction function() const { ASSERT(m_attributes & Function); return m_u.function.functionValue; }
     
    105124#if ENABLE(JIT)
    106125                ThunkGenerator generator;
     126#if ENABLE(DFG_JIT)
     127                DFG::Intrinsic intrinsic;
     128#endif
    107129#endif
    108130            } function;
Note: See TracChangeset for help on using the changeset viewer.