[JSC] Shrink the Math inline caches some more
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2016 21:11:31 +0000 (21:11 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2016 21:11:31 +0000 (21:11 +0000)
commite87e4cae787da64b28adf15cc19da5ee7bdab210
treec2ce7a5ecf8980074b41803891a18477b52e14e4
parent9689718bd8657ac2373b3c14b28f2577b38acd7b
[JSC] Shrink the Math inline caches some more
https://bugs.webkit.org/show_bug.cgi?id=162485

Reviewed by Saam Barati.

Source/JavaScriptCore:

This patch applies some lessons learnt from op_negate
to shrink the generated asm of the previous 3 inline
caches.

In order of importance:
-We do not need to pass the pointer to ArithProfile
 on the slow path. We can just get the profile out
 of the Math IC.
 This saves us from materializing a 64bits value
 in a register before the call on the slow path.
-We can remove a bunch of mov by setting up the registers
 in the way the slow path needs them.
 The slow path makes a function calls with the input
 as second and third arguments, and return the result in
 the "return register". By using those as target when
 loading/storing from the stack, we remove 3 mov per slow path.
-When performing integer add, we can set the result directly in
 the output register if that does not trashes one of the input
 register. This removes one mov per integer add.

The inline cache average sizes on Sunspider change as follow:
-Adds: 147.573099->131.555556 (~10%)
-Muls: 186.882353->170.991597 (~8%)
-Subs: 139.127907->121.523256 (~12%)

* jit/JIT.h:
* jit/JITAddGenerator.cpp:
(JSC::JITAddGenerator::generateInline):
(JSC::JITAddGenerator::generateFastPath):
* jit/JITArithmetic.cpp:
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):
* jit/JITInlines.h:
(JSC::JIT::callOperation): Deleted.
* jit/JITOperations.cpp:
* jit/JITOperations.h:

Source/WTF:

* wtf/Bag.h:
Don't copy the arguments before initializing the nodes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/ArithProfile.cpp
Source/JavaScriptCore/bytecode/ArithProfile.h
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Source/JavaScriptCore/jit/JIT.h
Source/JavaScriptCore/jit/JITAddGenerator.cpp
Source/JavaScriptCore/jit/JITAddGenerator.h
Source/JavaScriptCore/jit/JITArithmetic.cpp
Source/JavaScriptCore/jit/JITInlines.h
Source/JavaScriptCore/jit/JITMathIC.h
Source/JavaScriptCore/jit/JITMulGenerator.cpp
Source/JavaScriptCore/jit/JITMulGenerator.h
Source/JavaScriptCore/jit/JITNegGenerator.cpp
Source/JavaScriptCore/jit/JITNegGenerator.h
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jit/JITOperations.h
Source/JavaScriptCore/jit/JITSubGenerator.cpp
Source/JavaScriptCore/jit/JITSubGenerator.h
Source/WTF/ChangeLog
Source/WTF/wtf/Bag.h