DFG JIT should inline Math.abs
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Sep 2011 18:50:04 +0000 (18:50 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Sep 2011 18:50:04 +0000 (18:50 +0000)
commitff5a50ce63947b3858fe203a1278709b252d02e6
treecb21b9bf05b30990215c8a9d6f91dd750fcb2537
parente0efc820adcdf751167c7dc4ab27bb7094bf3700
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@95310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/create_hash_table
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
Source/JavaScriptCore/dfg/DFGGraph.h
Source/JavaScriptCore/dfg/DFGIntrinsic.h [new file with mode: 0644]
Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h
Source/JavaScriptCore/dfg/DFGJITCompiler.h
Source/JavaScriptCore/dfg/DFGNode.h
Source/JavaScriptCore/dfg/DFGPropagator.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
Source/JavaScriptCore/jit/JITStubs.cpp
Source/JavaScriptCore/jit/JITStubs.h
Source/JavaScriptCore/runtime/DateInstanceCache.h
Source/JavaScriptCore/runtime/Executable.cpp
Source/JavaScriptCore/runtime/Executable.h
Source/JavaScriptCore/runtime/JSGlobalData.cpp
Source/JavaScriptCore/runtime/JSGlobalData.h
Source/JavaScriptCore/runtime/Lookup.cpp
Source/JavaScriptCore/runtime/Lookup.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog