Changeset 193985 in webkit


Ignore:
Timestamp:
Dec 11, 2015 3:01:57 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

Refactoring to reduce potential cut-paste errors with the FTL ICs.
https://bugs.webkit.org/show_bug.cgi?id=152185

Reviewed by Saam Barati.

  • ftl/FTLCompile.cpp:
  • ICs now have their own names. GetById and PutByID fast path ICs no longer just say "inline cache fast path".
  • ftl/FTLCompileBinaryOp.cpp:

(JSC::FTL::generateBinaryArithOpFastPath):

  • Fixed an indentation.
  • ftl/FTLInlineCacheDescriptor.h:

(JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
(JSC::FTL::InlineCacheDescriptor::name):
(JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
(JSC::FTL::PutByIdDescriptor::PutByIdDescriptor):
(JSC::FTL::CheckInDescriptor::CheckInDescriptor):
(JSC::FTL::BinaryOpDescriptor::nodeType):
(JSC::FTL::BinaryOpDescriptor::size):
(JSC::FTL::BinaryOpDescriptor::slowPathFunction):
(JSC::FTL::BinaryOpDescriptor::leftOperand):
(JSC::FTL::BinaryOpDescriptor::BinaryOpDescriptor):
(JSC::FTL::ArithDivDescriptor::ArithDivDescriptor):
(JSC::FTL::ArithDivDescriptor::icSize):
(JSC::FTL::ArithDivDescriptor::nodeType):
(JSC::FTL::ArithDivDescriptor::opName):
(JSC::FTL::ArithDivDescriptor::slowPathFunction):
(JSC::FTL::ArithDivDescriptor::nonNumberSlowPathFunction):
(JSC::FTL::ArithMulDescriptor::ArithMulDescriptor):
(JSC::FTL::ArithMulDescriptor::icSize):
(JSC::FTL::ArithMulDescriptor::nodeType):
(JSC::FTL::ArithMulDescriptor::opName):
(JSC::FTL::ArithMulDescriptor::slowPathFunction):
(JSC::FTL::ArithMulDescriptor::nonNumberSlowPathFunction):
(JSC::FTL::ArithSubDescriptor::ArithSubDescriptor):
(JSC::FTL::ArithSubDescriptor::icSize):
(JSC::FTL::ArithSubDescriptor::nodeType):
(JSC::FTL::ArithSubDescriptor::opName):
(JSC::FTL::ArithSubDescriptor::slowPathFunction):
(JSC::FTL::ArithSubDescriptor::nonNumberSlowPathFunction):
(JSC::FTL::ValueAddDescriptor::ValueAddDescriptor):
(JSC::FTL::ValueAddDescriptor::icSize):
(JSC::FTL::ValueAddDescriptor::nodeType):
(JSC::FTL::ValueAddDescriptor::opName):
(JSC::FTL::ValueAddDescriptor::slowPathFunction):
(JSC::FTL::ValueAddDescriptor::nonNumberSlowPathFunction):
(JSC::FTL::LazySlowPathDescriptor::LazySlowPathDescriptor):
(JSC::FTL::ProbeDescriptor::ProbeDescriptor):
(JSC::FTL::BinaryOpDescriptor::name): Deleted.
(JSC::FTL::BinaryOpDescriptor::fastPathICName): Deleted.

  • ftl/FTLInlineCacheDescriptorInlines.h: Removed.
  • Consolidate the number of places where we have to fill in a data about new snippet ICs. It is all done in FTLInlineCacheDescriptor.h now.
  • ftl/FTLJITFinalizer.cpp:

(JSC::FTL::JITFinalizer::finalizeFunction):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::DFG::LowerDFGToLLVM::compileUntypedBinaryOp):
(JSC::FTL::DFG::LowerDFGToLLVM::compileValueAdd):
(JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub):
(JSC::FTL::DFG::LowerDFGToLLVM::compileArithMul):
(JSC::FTL::DFG::LowerDFGToLLVM::compileArithDiv):

  • Introduced a compileUntypedBinaryOp() template and use that at all the FTL places that need to use a snippet. This reduces the amount of cut and paste code.
  • ftl/FTLState.h:
  • Removed a bad #include.
Location:
trunk/Source/JavaScriptCore
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r193983 r193985  
     12015-12-11  Mark Lam  <mark.lam@apple.com>
     2
     3        Refactoring to reduce potential cut-paste errors with the FTL ICs.
     4        https://bugs.webkit.org/show_bug.cgi?id=152185
     5
     6        Reviewed by Saam Barati.
     7
     8        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     9        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     10        * JavaScriptCore.xcodeproj/project.pbxproj:
     11
     12        * ftl/FTLCompile.cpp:
     13        - ICs now have their own names.  GetById and PutByID fast path ICs no longer just
     14          say "inline cache fast path".
     15
     16        * ftl/FTLCompileBinaryOp.cpp:
     17        (JSC::FTL::generateBinaryArithOpFastPath):
     18        - Fixed an indentation.
     19
     20        * ftl/FTLInlineCacheDescriptor.h:
     21        (JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
     22        (JSC::FTL::InlineCacheDescriptor::name):
     23        (JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
     24        (JSC::FTL::PutByIdDescriptor::PutByIdDescriptor):
     25        (JSC::FTL::CheckInDescriptor::CheckInDescriptor):
     26        (JSC::FTL::BinaryOpDescriptor::nodeType):
     27        (JSC::FTL::BinaryOpDescriptor::size):
     28        (JSC::FTL::BinaryOpDescriptor::slowPathFunction):
     29        (JSC::FTL::BinaryOpDescriptor::leftOperand):
     30        (JSC::FTL::BinaryOpDescriptor::BinaryOpDescriptor):
     31        (JSC::FTL::ArithDivDescriptor::ArithDivDescriptor):
     32        (JSC::FTL::ArithDivDescriptor::icSize):
     33        (JSC::FTL::ArithDivDescriptor::nodeType):
     34        (JSC::FTL::ArithDivDescriptor::opName):
     35        (JSC::FTL::ArithDivDescriptor::slowPathFunction):
     36        (JSC::FTL::ArithDivDescriptor::nonNumberSlowPathFunction):
     37        (JSC::FTL::ArithMulDescriptor::ArithMulDescriptor):
     38        (JSC::FTL::ArithMulDescriptor::icSize):
     39        (JSC::FTL::ArithMulDescriptor::nodeType):
     40        (JSC::FTL::ArithMulDescriptor::opName):
     41        (JSC::FTL::ArithMulDescriptor::slowPathFunction):
     42        (JSC::FTL::ArithMulDescriptor::nonNumberSlowPathFunction):
     43        (JSC::FTL::ArithSubDescriptor::ArithSubDescriptor):
     44        (JSC::FTL::ArithSubDescriptor::icSize):
     45        (JSC::FTL::ArithSubDescriptor::nodeType):
     46        (JSC::FTL::ArithSubDescriptor::opName):
     47        (JSC::FTL::ArithSubDescriptor::slowPathFunction):
     48        (JSC::FTL::ArithSubDescriptor::nonNumberSlowPathFunction):
     49        (JSC::FTL::ValueAddDescriptor::ValueAddDescriptor):
     50        (JSC::FTL::ValueAddDescriptor::icSize):
     51        (JSC::FTL::ValueAddDescriptor::nodeType):
     52        (JSC::FTL::ValueAddDescriptor::opName):
     53        (JSC::FTL::ValueAddDescriptor::slowPathFunction):
     54        (JSC::FTL::ValueAddDescriptor::nonNumberSlowPathFunction):
     55        (JSC::FTL::LazySlowPathDescriptor::LazySlowPathDescriptor):
     56        (JSC::FTL::ProbeDescriptor::ProbeDescriptor):
     57        (JSC::FTL::BinaryOpDescriptor::name): Deleted.
     58        (JSC::FTL::BinaryOpDescriptor::fastPathICName): Deleted.
     59        * ftl/FTLInlineCacheDescriptorInlines.h: Removed.
     60        - Consolidate the number of places where we have to fill in a data about new
     61          snippet ICs.  It is all done in FTLInlineCacheDescriptor.h now.   
     62
     63        * ftl/FTLJITFinalizer.cpp:
     64        (JSC::FTL::JITFinalizer::finalizeFunction):
     65
     66        * ftl/FTLLowerDFGToLLVM.cpp:
     67        (JSC::FTL::DFG::LowerDFGToLLVM::compileUntypedBinaryOp):
     68        (JSC::FTL::DFG::LowerDFGToLLVM::compileValueAdd):
     69        (JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub):
     70        (JSC::FTL::DFG::LowerDFGToLLVM::compileArithMul):
     71        (JSC::FTL::DFG::LowerDFGToLLVM::compileArithDiv):
     72        - Introduced a compileUntypedBinaryOp() template and use that at all the FTL
     73          places that need to use a snippet.  This reduces the amount of cut and paste
     74          code.
     75
     76        * ftl/FTLState.h:
     77        - Removed a bad #include.
     78
    1792015-12-11  Keith Miller  <keith_miller@apple.com>
    280
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r193788 r193985  
    13201320    <ClInclude Include="..\ftl\FTLGeneratedFunction.h" />
    13211321    <ClInclude Include="..\ftl\FTLInlineCacheDescriptor.h" />
    1322     <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h" />
    13231322    <ClInclude Include="..\ftl\FTLInlineCacheSize.h" />
    13241323    <ClInclude Include="..\ftl\FTLIntrinsicRepository.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r193788 r193985  
    42534253      <Filter>ftl</Filter>
    42544254    </ClInclude>
    4255     <ClInclude Include="..\ftl\FTLInlineCacheDescriptorInlines.h">
    4256       <Filter>ftl</Filter>
    4257     </ClInclude>
    42584255    <ClInclude Include="..\ftl\FTLInlineCacheSize.h">
    42594256      <Filter>ftl</Filter>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r193938 r193985  
    20032003                FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */; };
    20042004                FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; };
    2005                 FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */; };
    20062005                FE187A191C0E13E30038BBCA /* FTLCompileBinaryOp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */; };
    20072006                FE187A1A1C0E13E60038BBCA /* FTLCompileBinaryOp.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */; };
     
    41914190                FE187A151C0E13C60038BBCA /* FTLCompileBinaryOp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCompileBinaryOp.cpp; path = ftl/FTLCompileBinaryOp.cpp; sourceTree = "<group>"; };
    41924191                FE187A161C0E13C60038BBCA /* FTLCompileBinaryOp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLCompileBinaryOp.h; path = ftl/FTLCompileBinaryOp.h; sourceTree = "<group>"; };
    4193                 FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLInlineCacheDescriptorInlines.h; path = ftl/FTLInlineCacheDescriptorInlines.h; sourceTree = "<group>"; };
    41944192                FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
    41954193                FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; };
     
    45094507                                A78A977C179738D5009DF744 /* FTLGeneratedFunction.h */,
    45104508                                0F25F1A7181635F300522F39 /* FTLInlineCacheDescriptor.h */,
    4511                                 FE187A171C0E13C60038BBCA /* FTLInlineCacheDescriptorInlines.h */,
    45124509                                0F25F1A8181635F300522F39 /* FTLInlineCacheSize.cpp */,
    45134510                                0F25F1A9181635F300522F39 /* FTLInlineCacheSize.h */,
     
    69846981                                0F7C11AD1BC3862C00C74CDB /* CopyBarrier.h in Headers */,
    69856982                                0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */,
    6986                                 FE187A181C0E13DD0038BBCA /* FTLInlineCacheDescriptorInlines.h in Headers */,
    69876983                                C2239D1816262BDD005AC5FD /* CopyVisitor.h in Headers */,
    69886984                                C2239D1916262BDD005AC5FD /* CopyVisitorInlines.h in Headers */,
  • trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp

    r193485 r193985  
    4141#include "FTLExceptionHandlerManager.h"
    4242#include "FTLExitThunkGenerator.h"
    43 #include "FTLInlineCacheDescriptorInlines.h"
     43#include "FTLInlineCacheDescriptor.h"
    4444#include "FTLInlineCacheSize.h"
    4545#include "FTLJITCode.h"
     
    216216void generateICFastPath(
    217217    State& state, CodeBlock* codeBlock, GeneratedFunction generatedFunction,
    218     StackMaps::RecordMap& recordMap, DescriptorType& ic, size_t sizeOfIC)
     218    StackMaps::RecordMap& recordMap, DescriptorType& ic, size_t sizeOfIC, const char* icName)
    219219{
    220220    VM& vm = state.graph.m_vm;
     
    240240            bitwise_cast<char*>(generatedFunction) + record.instructionOffset;
    241241
    242         generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "inline cache fast path", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
     242        generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, icName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
    243243            state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i],
    244244                CodeLocationLabel(startOfIC + sizeOfIC));
     
    305305        };
    306306
    307         generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "CheckIn inline cache", postLink);
     307        generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "CheckIn", postLink);
    308308    }
    309309}
     
    340340
    341341        char* startOfIC = bitwise_cast<char*>(generatedFunction) + record.instructionOffset;
    342         const char* fastPathICName = ic.fastPathICName();
    343         generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, fastPathICName, [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
     342        generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, ic.name(), [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
    344343            linkBuffer.link(done, CodeLocationLabel(startOfIC + sizeOfIC));
    345344            state.finalizer->sideCodeLinkBuffer->link(ic.m_slowPathDone[i], CodeLocationLabel(startOfIC + sizeOfIC));
     
    878877            generateICFastPath(
    879878                state, codeBlock, generatedFunction, recordMap, state.getByIds[i],
    880                 sizeOfGetById());
     879                sizeOfGetById(), "GetById");
    881880        }
    882881        for (unsigned i = state.putByIds.size(); i--;) {
    883882            generateICFastPath(
    884883                state, codeBlock, generatedFunction, recordMap, state.putByIds[i],
    885                 sizeOfPutById());
     884                sizeOfPutById(), "PutById");
    886885        }
    887886        for (unsigned i = state.checkIns.size(); i--;) {
     
    922921        char* startOfIC = bitwise_cast<char*>(generatedFunction) + call.m_instructionOffset;
    923922
    924         generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfCall(), "JSCall inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
     923        generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfCall(), "JSCall", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
    925924            call.link(vm, linkBuffer);
    926925        });
     
    938937        size_t sizeOfIC = sizeOfICFor(call.node());
    939938
    940         generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "varargs call inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
     939        generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "varargs call", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
    941940            call.link(vm, linkBuffer, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
    942941        });
     
    954953        size_t sizeOfIC = call.estimatedSize();
    955954
    956         generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "tail call inline cache", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
     955        generateInlineIfPossibleOutOfLineIfNot(state, vm, codeBlock, fastPathJIT, startOfIC, sizeOfIC, "tail call", [&] (LinkBuffer& linkBuffer, CCallHelpers&, bool) {
    957956            call.link(vm, linkBuffer);
    958957        });
  • trunk/Source/JavaScriptCore/ftl/FTLCompileBinaryOp.cpp

    r193781 r193985  
    180180
    181181    auto numberOfBytesUsedToPreserveReusedRegisters =
    182     allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
     182        allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
    183183
    184184    context.initializeRegisters(jit);
  • trunk/Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h

    r193781 r193985  
    3131#include "CodeOrigin.h"
    3232#include "DFGAbstractValue.h"
     33#include "DFGOperations.h"
     34#include "FTLInlineCacheSize.h"
    3335#include "FTLLazySlowPath.h"
    3436#include "JITInlineCacheGenerator.h"
     
    133135    size_t size() const { return m_size; }
    134136    const char* name() const { return m_name; }
    135     const char* fastPathICName() const { return m_fastPathICName; }
    136137    SlowPathFunction slowPathFunction() const { return m_slowPathFunction; }
    137138
     
    143144protected:
    144145    BinaryOpDescriptor(unsigned nodeType, unsigned stackmapID, CodeOrigin codeOrigin,
    145         size_t size, const char* name, const char* fastPathICName,
    146         SlowPathFunction slowPathFunction, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
     146        size_t size, const char* name, SlowPathFunction slowPathFunction,
     147        const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
    147148        : InlineCacheDescriptor(stackmapID, codeOrigin, nullptr)
    148149        , m_nodeType(nodeType)
    149150        , m_size(size)
    150151        , m_name(name)
    151         , m_fastPathICName(fastPathICName)
    152152        , m_slowPathFunction(slowPathFunction)
    153153        , m_leftOperand(leftOperand)
     
    159159    size_t m_size;
    160160    const char* m_name;
    161     const char* m_fastPathICName;
    162161    SlowPathFunction m_slowPathFunction;
    163162
     
    168167class ArithDivDescriptor : public BinaryOpDescriptor {
    169168public:
    170     ArithDivDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
    171     static size_t icSize();
     169    ArithDivDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
     170        : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
     171    { }
     172
     173    static size_t icSize() { return sizeOfArithDiv(); }
     174    static unsigned nodeType() { return DFG::ArithDiv; }
     175    static const char* opName() { return "ArithDiv"; }
     176    static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueDiv; }
     177    static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); }
    172178};
    173179
    174180class ArithMulDescriptor : public BinaryOpDescriptor {
    175181public:
    176     ArithMulDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
    177     static size_t icSize();
     182    ArithMulDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
     183        : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
     184    { }
     185
     186    static size_t icSize() { return sizeOfArithMul(); }
     187    static unsigned nodeType() { return DFG::ArithMul; }
     188    static const char* opName() { return "ArithMul"; }
     189    static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueMul; }
     190    static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); }
    178191};
    179192
    180193class ArithSubDescriptor : public BinaryOpDescriptor {
    181194public:
    182     ArithSubDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
    183     static size_t icSize();
     195    ArithSubDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
     196        : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
     197    { }
     198
     199    static size_t icSize() { return sizeOfArithSub(); }
     200    static unsigned nodeType() { return DFG::ArithSub; }
     201    static const char* opName() { return "ArithSub"; }
     202    static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueSub; }
     203    static J_JITOperation_EJJ nonNumberSlowPathFunction() { return slowPathFunction(); }
    184204};
    185205
    186206class ValueAddDescriptor : public BinaryOpDescriptor {
    187207public:
    188     ValueAddDescriptor(unsigned stackmapID, CodeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand);
    189     static size_t icSize();
     208    ValueAddDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, const SnippetOperand& leftOperand, const SnippetOperand& rightOperand)
     209        : BinaryOpDescriptor(nodeType(), stackmapID, codeOrigin, icSize(), opName(), slowPathFunction(), leftOperand, rightOperand)
     210    { }
     211
     212    static size_t icSize() { return sizeOfValueAdd(); }
     213    static unsigned nodeType() { return DFG::ValueAdd; }
     214    static const char* opName() { return "ValueAdd"; }
     215    static J_JITOperation_EJJ slowPathFunction() { return DFG::operationValueAdd; }
     216    static J_JITOperation_EJJ nonNumberSlowPathFunction() { return DFG::operationValueAddNotNumber; }
    190217};
    191218
  • trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp

    r193362 r193985  
    138138        jitCode->addHandle(FINALIZE_CODE_IF(
    139139            dumpDisassembly, *outOfLineCodeInfos[i].m_linkBuffer,
    140             ("FTL out of line code for %s", outOfLineCodeInfos[i].m_codeDescription)).executableMemory());
     140            ("FTL out of line code for %s inline cache", outOfLineCodeInfos[i].m_codeDescription)).executableMemory());
    141141    }
    142142#endif // FTL_USES_B3
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp

    r193974 r193985  
    10391039    }
    10401040
     1041    enum ConstInt32OperandOptimizationSupport {
     1042        HasConstInt32OperandOptimization,
     1043        DoesNotHaveConstInt32OperandOptimization,
     1044    };
     1045
     1046    enum ConstDoubleOperandOptimizationSupport {
     1047        HasConstDoubleOperandOptimization,
     1048        DoesNotHaveConstDoubleOperandOptimization,
     1049    };
     1050
     1051    template <typename SnippetICDescriptor,
     1052        ConstInt32OperandOptimizationSupport constInt32Opt = HasConstInt32OperandOptimization,
     1053        ConstDoubleOperandOptimizationSupport constDoubleOpt = DoesNotHaveConstDoubleOperandOptimization>
     1054    void compileUntypedBinaryOp()
     1055    {
     1056        Edge& leftChild = m_node->child1();
     1057        Edge& rightChild = m_node->child2();
     1058
     1059        if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
     1060            setJSValue(vmCall(m_out.int64, m_out.operation(SnippetICDescriptor::nonNumberSlowPathFunction()), m_callFrame,
     1061                lowJSValue(leftChild), lowJSValue(rightChild)));
     1062            return;
     1063        }
     1064
     1065        unsigned stackmapID = m_stackmapIDs++;
     1066
     1067        if (Options::verboseCompilation())
     1068            dataLog("    Emitting ", SnippetICDescriptor::opName(), " patchpoint with stackmap #", stackmapID, "\n");
     1069
     1070#if FTL_USES_B3
     1071        CRASH();
     1072#else
     1073        LValue left = lowJSValue(leftChild);
     1074        LValue right = lowJSValue(rightChild);
     1075
     1076        SnippetOperand leftOperand(abstractValue(leftChild).resultType());
     1077        SnippetOperand rightOperand(abstractValue(rightChild).resultType());
     1078
     1079        if (constInt32Opt == HasConstInt32OperandOptimization && leftChild->isInt32Constant())
     1080            leftOperand.setConstInt32(leftChild->asInt32());
     1081#if USE(JSVALUE64)
     1082        else if (constDoubleOpt == HasConstDoubleOperandOptimization && leftChild->isDoubleConstant())
     1083            leftOperand.setConstDouble(leftChild->asNumber());
     1084#endif
     1085
     1086        if (leftOperand.isConst()) {
     1087            // Because the snippet does not support both operands being constant, if the left
     1088            // operand is already a constant, we'll just pretend the right operand is not.
     1089        } else if (constInt32Opt == HasConstInt32OperandOptimization && rightChild->isInt32Constant())
     1090            rightOperand.setConstInt32(rightChild->asInt32());
     1091#if USE(JSVALUE64)
     1092        else if (constDoubleOpt == HasConstDoubleOperandOptimization && rightChild->isDoubleConstant())
     1093            rightOperand.setConstDouble(rightChild->asNumber());
     1094#endif
     1095
     1096        RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
     1097
     1098        // Arguments: id, bytes, target, numArgs, args...
     1099        StackmapArgumentList arguments;
     1100        arguments.append(m_out.constInt64(stackmapID));
     1101        arguments.append(m_out.constInt32(SnippetICDescriptor::icSize()));
     1102        arguments.append(constNull(m_out.ref8));
     1103        arguments.append(m_out.constInt32(2));
     1104        arguments.append(left);
     1105        arguments.append(right);
     1106
     1107        appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
     1108            ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
     1109
     1110        LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
     1111        setInstructionCallingConvention(call, LLVMAnyRegCallConv);
     1112
     1113        m_ftlState.binaryOps.append(SnippetICDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
     1114
     1115        setJSValue(call);
     1116#endif
     1117    }
     1118
    10411119    void compileUpsilon()
    10421120    {
     
    15131591    void compileValueAdd()
    15141592    {
    1515         Edge& leftChild = m_node->child1();
    1516         Edge& rightChild = m_node->child2();
    1517 
    1518         if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
    1519             setJSValue(vmCall(m_out.int64, m_out.operation(operationValueAddNotNumber), m_callFrame,
    1520                 lowJSValue(leftChild), lowJSValue(rightChild)));
    1521             return;
    1522         }
    1523 
    1524         unsigned stackmapID = m_stackmapIDs++;
    1525 
    1526         if (Options::verboseCompilation())
    1527             dataLog("    Emitting ValueAdd patchpoint with stackmap #", stackmapID, "\n");
    1528 
    1529 #if FTL_USES_B3
    1530         CRASH();
    1531 #else
    1532         LValue left = lowJSValue(leftChild);
    1533         LValue right = lowJSValue(rightChild);
    1534 
    1535         SnippetOperand leftOperand(abstractValue(leftChild).resultType());
    1536         SnippetOperand rightOperand(abstractValue(rightChild).resultType());
    1537 
    1538         // Because the snippet does not support both operands being constant, if the left
    1539         // operand is already a constant, we'll just pretend the right operand is not.
    1540         if (leftChild->isInt32Constant())
    1541             leftOperand.setConstInt32(leftChild->asInt32());
    1542         else if (rightChild->isInt32Constant())
    1543             rightOperand.setConstInt32(rightChild->asInt32());
    1544 
    1545         // Arguments: id, bytes, target, numArgs, args...
    1546         StackmapArgumentList arguments;
    1547         arguments.append(m_out.constInt64(stackmapID));
    1548         arguments.append(m_out.constInt32(ValueAddDescriptor::icSize()));
    1549         arguments.append(constNull(m_out.ref8));
    1550         arguments.append(m_out.constInt32(2));
    1551         arguments.append(left);
    1552         arguments.append(right);
    1553 
    1554         appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
    1555             ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
    1556 
    1557         LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
    1558         setInstructionCallingConvention(call, LLVMAnyRegCallConv);
    1559 
    1560         m_ftlState.binaryOps.append(ValueAddDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
    1561 
    1562         setJSValue(call);
    1563 #endif
     1593        compileUntypedBinaryOp<ValueAddDescriptor>();
    15641594    }
    15651595   
     
    17101740            }
    17111741           
    1712             unsigned stackmapID = m_stackmapIDs++;
    1713 
    1714             if (Options::verboseCompilation())
    1715                 dataLog("    Emitting ArithSub patchpoint with stackmap #", stackmapID, "\n");
    1716 
    1717 #if FTL_USES_B3
    1718             CRASH();
    1719 #else
    1720             LValue left = lowJSValue(m_node->child1());
    1721             LValue right = lowJSValue(m_node->child2());
    1722 
    1723             // Arguments: id, bytes, target, numArgs, args...
    1724             StackmapArgumentList arguments;
    1725             arguments.append(m_out.constInt64(stackmapID));
    1726             arguments.append(m_out.constInt32(ArithSubDescriptor::icSize()));
    1727             arguments.append(constNull(m_out.ref8));
    1728             arguments.append(m_out.constInt32(2));
    1729             arguments.append(left);
    1730             arguments.append(right);
    1731 
    1732             appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
    1733                 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
    1734 
    1735             LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
    1736             setInstructionCallingConvention(call, LLVMAnyRegCallConv);
    1737 
    1738             SnippetOperand leftOperand(abstractValue(m_node->child1()).resultType());
    1739             SnippetOperand rightOperand(abstractValue(m_node->child2()).resultType());
    1740             m_ftlState.binaryOps.append(ArithSubDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
    1741 
    1742             setJSValue(call);
    1743 #endif
     1742            compileUntypedBinaryOp<ArithSubDescriptor, DoesNotHaveConstInt32OperandOptimization, DoesNotHaveConstDoubleOperandOptimization>();
    17441743            break;
    17451744        }
     
    18371836
    18381837        case UntypedUse: {
    1839             Edge& leftChild = m_node->child1();
    1840             Edge& rightChild = m_node->child2();
    1841 
    1842             if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
    1843                 setJSValue(vmCall(m_out.int64, m_out.operation(operationValueMul), m_callFrame,
    1844                     lowJSValue(leftChild), lowJSValue(rightChild)));
    1845                 return;
    1846             }
    1847 
    1848             unsigned stackmapID = m_stackmapIDs++;
    1849 
    1850             if (Options::verboseCompilation())
    1851                 dataLog("    Emitting ArithMul patchpoint with stackmap #", stackmapID, "\n");
    1852 
    1853 #if FTL_USES_B3
    1854             CRASH();
    1855 #else
    1856             LValue left = lowJSValue(leftChild);
    1857             LValue right = lowJSValue(rightChild);
    1858 
    1859             SnippetOperand leftOperand(abstractValue(leftChild).resultType());
    1860             SnippetOperand rightOperand(abstractValue(rightChild).resultType());
    1861 
    1862             // Because the snippet does not support both operands being constant, if the left
    1863             // operand is already a constant, we'll just pretend the right operand is not.
    1864             if (leftChild->isInt32Constant())
    1865                 leftOperand.setConstInt32(leftChild->asInt32());
    1866             else if (rightChild->isInt32Constant())
    1867                 rightOperand.setConstInt32(rightChild->asInt32());
    1868 
    1869             RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
    1870 
    1871             // Arguments: id, bytes, target, numArgs, args...
    1872             StackmapArgumentList arguments;
    1873             arguments.append(m_out.constInt64(stackmapID));
    1874             arguments.append(m_out.constInt32(ArithMulDescriptor::icSize()));
    1875             arguments.append(constNull(m_out.ref8));
    1876             arguments.append(m_out.constInt32(2));
    1877             arguments.append(left);
    1878             arguments.append(right);
    1879 
    1880             appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
    1881                 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
    1882 
    1883             LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
    1884             setInstructionCallingConvention(call, LLVMAnyRegCallConv);
    1885 
    1886             m_ftlState.binaryOps.append(ArithMulDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
    1887 
    1888             setJSValue(call);
    1889 #endif
     1838            compileUntypedBinaryOp<ArithMulDescriptor>();
    18901839            break;
    18911840        }
     
    19561905
    19571906        case UntypedUse: {
    1958             Edge& leftChild = m_node->child1();
    1959             Edge& rightChild = m_node->child2();
    1960 
    1961             if (!(provenType(leftChild) & SpecFullNumber) || !(provenType(rightChild) & SpecFullNumber)) {
    1962                 setJSValue(vmCall(m_out.int64, m_out.operation(operationValueDiv), m_callFrame,
    1963                     lowJSValue(leftChild), lowJSValue(rightChild)));
    1964                 return;
    1965             }
    1966 
    1967             unsigned stackmapID = m_stackmapIDs++;
    1968 
    1969             if (Options::verboseCompilation())
    1970                 dataLog("    Emitting ArithDiv patchpoint with stackmap #", stackmapID, "\n");
    1971 
    1972 #if FTL_USES_B3
    1973             CRASH();
    1974 #else
    1975             LValue left = lowJSValue(leftChild);
    1976             LValue right = lowJSValue(rightChild);
    1977 
    1978             SnippetOperand leftOperand(abstractValue(leftChild).resultType());
    1979             SnippetOperand rightOperand(abstractValue(rightChild).resultType());
    1980 
    1981             if (leftChild->isInt32Constant())
    1982                 leftOperand.setConstInt32(leftChild->asInt32());
    1983 #if USE(JSVALUE64)
    1984             else if (leftChild->isDoubleConstant())
    1985                 leftOperand.setConstDouble(leftChild->asNumber());
    1986 #endif
    1987 
    1988             if (leftOperand.isConst()) {
    1989                 // The snippet generator only supports 1 argument as a constant.
    1990                 // Ignore the rightChild's const-ness.
    1991             } else if (rightChild->isInt32Constant())
    1992                 rightOperand.setConstInt32(rightChild->asInt32());
    1993 #if USE(JSVALUE64)
    1994             else if (rightChild->isDoubleConstant())
    1995                 rightOperand.setConstDouble(rightChild->asNumber());
    1996 #endif
    1997 
    1998             RELEASE_ASSERT(!leftOperand.isConst() || !rightOperand.isConst());
    1999 
    2000             // Arguments: id, bytes, target, numArgs, args...
    2001             StackmapArgumentList arguments;
    2002             arguments.append(m_out.constInt64(stackmapID));
    2003             arguments.append(m_out.constInt32(ArithDivDescriptor::icSize()));
    2004             arguments.append(constNull(m_out.ref8));
    2005             arguments.append(m_out.constInt32(2));
    2006             arguments.append(left);
    2007             arguments.append(right);
    2008 
    2009             appendOSRExitArgumentsForPatchpointIfWillCatchException(arguments,
    2010                 ExceptionType::BinaryOpGenerator, 3); // left, right, and result show up in the stackmap locations.
    2011 
    2012             LValue call = m_out.call(m_out.int64, m_out.patchpointInt64Intrinsic(), arguments);
    2013             setInstructionCallingConvention(call, LLVMAnyRegCallConv);
    2014 
    2015             m_ftlState.binaryOps.append(ArithDivDescriptor(stackmapID, m_node->origin.semantic, leftOperand, rightOperand));
    2016 
    2017             setJSValue(call);
    2018 #endif // FTL_USES_B3
     1907            compileUntypedBinaryOp<ArithDivDescriptor, HasConstInt32OperandOptimization, HasConstDoubleOperandOptimization>();
    20191908            break;
    20201909        }
  • trunk/Source/JavaScriptCore/ftl/FTLState.h

    r193640 r193985  
    4141#include "FTLJSTailCall.h"
    4242#include "FTLStackMaps.h"
    43 #include "FTLState.h"
    4443#include <wtf/Noncopyable.h>
    4544
Note: See TracChangeset for help on using the changeset viewer.