Changeset 199863 in webkit


Ignore:
Timestamp:
Apr 21, 2016 7:28:00 PM (8 years ago)
Author:
keith_miller@apple.com
Message:

FTL should handle exceptions in operationInOptimize
https://bugs.webkit.org/show_bug.cgi?id=156885

Reviewed by Michael Saboff.

For some reasone we didn't handle any exceptions in "in" when we called
operationInOptimize in the FTL.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpAssumingJITType):

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileIn):

  • ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which

function to use for different exception types.

  • jsc.cpp:

(GlobalObject::finishCreation):
(functionNoFTL):

  • runtime/Executable.cpp:

(JSC::ScriptExecutable::ScriptExecutable):

  • runtime/Executable.h:

(JSC::ScriptExecutable::setNeverFTLOptimize):
(JSC::ScriptExecutable::neverFTLOptimize):

  • tests/stress/in-ftl-exception-check.js: Added.

(foo):
(bar):
(catch):

Location:
trunk/Source/JavaScriptCore
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r199861 r199863  
     12016-04-21  Keith Miller  <keith_miller@apple.com>
     2
     3        FTL should handle exceptions in operationInOptimize
     4        https://bugs.webkit.org/show_bug.cgi?id=156885
     5
     6        Reviewed by Michael Saboff.
     7
     8        For some reasone we didn't handle any exceptions in "in" when we called
     9        operationInOptimize in the FTL.
     10
     11        * bytecode/CodeBlock.cpp:
     12        (JSC::CodeBlock::dumpAssumingJITType):
     13        * ftl/FTLCapabilities.cpp:
     14        (JSC::FTL::canCompile):
     15        * ftl/FTLLowerDFGToB3.cpp:
     16        (JSC::FTL::DFG::LowerDFGToB3::compileIn):
     17        * ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which
     18        function to use for different exception types.
     19
     20        * jsc.cpp:
     21        (GlobalObject::finishCreation):
     22        (functionNoFTL):
     23        * runtime/Executable.cpp:
     24        (JSC::ScriptExecutable::ScriptExecutable):
     25        * runtime/Executable.h:
     26        (JSC::ScriptExecutable::setNeverFTLOptimize):
     27        (JSC::ScriptExecutable::neverFTLOptimize):
     28        * tests/stress/in-ftl-exception-check.js: Added.
     29        (foo):
     30        (bar):
     31        (catch):
     32
    1332016-04-21  Filip Pizlo  <fpizlo@apple.com>
    234
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r199731 r199863  
    19971997                DC17E8191C9C91DB008A6AB3 /* ShadowChickenInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = DC17E8151C9C7FD4008A6AB3 /* ShadowChickenInlines.h */; };
    19981998                DC17E81A1C9C91E9008A6AB3 /* CCallHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC17E8161C9C802B008A6AB3 /* CCallHelpers.cpp */; };
     1999                DC2143071CA32E55000A8869 /* ICStats.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2143061CA32E52000A8869 /* ICStats.h */; };
     2000                DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC2143051CA32E52000A8869 /* ICStats.cpp */; };
    19992001                DE26E9031CB5DD0500D2BE82 /* BuiltinExecutableCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = DE26E9021CB5DD0500D2BE82 /* BuiltinExecutableCreator.h */; };
    20002002                DE26E9071CB5DEFB00D2BE82 /* BuiltinExecutableCreator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE26E9061CB5DD9600D2BE82 /* BuiltinExecutableCreator.cpp */; };
     
    20022004                DEA7E2441BBC677200D78440 /* JSTypedArrayViewPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53F256E11B87E28000B4B768 /* JSTypedArrayViewPrototype.cpp */; };
    20032005                DEA7E2451BBC677F00D78440 /* JSTypedArrayViewPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 53917E7C1B791106000EBD33 /* JSTypedArrayViewPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2004                 DC2143071CA32E55000A8869 /* ICStats.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2143061CA32E52000A8869 /* ICStats.h */; };
    2005                 DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC2143051CA32E52000A8869 /* ICStats.cpp */; };
    20062006                E124A8F70E555775003091F1 /* OpaqueJSString.h in Headers */ = {isa = PBXBuildFile; fileRef = E124A8F50E555775003091F1 /* OpaqueJSString.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20072007                E124A8F80E555775003091F1 /* OpaqueJSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E124A8F60E555775003091F1 /* OpaqueJSString.cpp */; };
     
    42054205                D21202290AD4310C00ED79B6 /* DateConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateConversion.h; sourceTree = "<group>"; };
    42064206                DC00039019D8BE6F00023EB0 /* DFGPreciseLocalClobberize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGPreciseLocalClobberize.h; path = dfg/DFGPreciseLocalClobberize.h; sourceTree = "<group>"; };
    4207                 DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = "<group>"; };
    4208                 DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = "<group>"; };
    42094207                DC17E8131C9C7FD4008A6AB3 /* ShadowChicken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowChicken.cpp; sourceTree = "<group>"; };
    42104208                DC17E8141C9C7FD4008A6AB3 /* ShadowChicken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowChicken.h; sourceTree = "<group>"; };
    42114209                DC17E8151C9C7FD4008A6AB3 /* ShadowChickenInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowChickenInlines.h; sourceTree = "<group>"; };
    42124210                DC17E8161C9C802B008A6AB3 /* CCallHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCallHelpers.cpp; sourceTree = "<group>"; };
     4211                DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = "<group>"; };
     4212                DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = "<group>"; };
    42134213                DE26E9021CB5DD0500D2BE82 /* BuiltinExecutableCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuiltinExecutableCreator.h; sourceTree = "<group>"; };
    42144214                DE26E9061CB5DD9600D2BE82 /* BuiltinExecutableCreator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltinExecutableCreator.cpp; sourceTree = "<group>"; };
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r199724 r199863  
    231231    if (ownerScriptExecutable()->neverOptimize())
    232232        out.print(" (NeverOptimize)");
     233    else if (ownerScriptExecutable()->neverFTLOptimize())
     234        out.print(" (NeverFTLOptimize)");
    233235    if (ownerScriptExecutable()->didTryToEnterInLoop())
    234236        out.print(" (DidTryToEnterInLoop)");
  • trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

    r199748 r199863  
    440440        return CannotCompile;
    441441    }
     442
     443    if (UNLIKELY(graph.m_codeBlock->ownerScriptExecutable()->neverFTLOptimize())) {
     444        if (verboseCapabilities())
     445            dataLog("FTL rejecting ", *graph.m_codeBlock, " because it is marked as never FTL compile.\n");
     446        return CannotCompile;
     447    }
    442448   
    443449    CapabilityLevel result = CanCompileAndOSREnter;
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r199748 r199863  
    59845984                patchpoint->clobber(RegisterSet::macroScratchRegisters());
    59855985
     5986                RefPtr<PatchpointExceptionHandle> exceptionHandle = preparePatchpointForExceptions(patchpoint);
     5987
    59865988                State* state = &m_ftlState;
    59875989                patchpoint->setGenerator(
    59885990                    [=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
    59895991                        AllowMacroScratchRegisterUsage allowScratch(jit);
     5992
     5993                        // This is the direct exit target for operation calls. We don't need a JS exceptionHandle because we don't
     5994                        // cache Proxy objects.
     5995                        Box<CCallHelpers::JumpList> exceptions = exceptionHandle->scheduleExitCreation(params)->jumps(jit);
    59905996
    59915997                        GPRReg baseGPR = params[1].gpr();
     
    60126018                                CCallHelpers::Call slowPathCall = callOperation(
    60136019                                    *state, params.unavailableRegisters(), jit,
    6014                                     node->origin.semantic, nullptr, operationInOptimize,
     6020                                    node->origin.semantic, exceptions.get(), operationInOptimize,
    60156021                                    resultGPR, CCallHelpers::TrustedImmPtr(stubInfo), baseGPR,
    60166022                                    CCallHelpers::TrustedImmPtr(str)).call();
  • trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.h

    r196729 r199863  
    7979    // created, but it will happen before linking. You can link jumps to it during link time. That's
    8080    // why this returns an ExceptionTarget. That will contain the jump destination (target->label())
    81     // at link time.
     81    // at link time. This function should be used for exceptions from C calls.
    8282    RefPtr<ExceptionTarget> scheduleExitCreation(const B3::StackmapGenerationParams&);
    8383
    8484    // Schedules the creation of an OSR exit jump destination, and ensures that it gets associated
    85     // with the handler for some callsite index.
     85    // with the handler for some callsite index. This function should be used for exceptions from JS.
    8686    void scheduleExitCreationForUnwind(const B3::StackmapGenerationParams&, CallSiteIndex);
    8787
  • trunk/Source/JavaScriptCore/jsc.cpp

    r199800 r199863  
    591591static EncodedJSValue JSC_HOST_CALL functionNeverInlineFunction(ExecState*);
    592592static EncodedJSValue JSC_HOST_CALL functionNoDFG(ExecState*);
     593static EncodedJSValue JSC_HOST_CALL functionNoFTL(ExecState*);
    593594static EncodedJSValue JSC_HOST_CALL functionOptimizeNextInvocation(ExecState*);
    594595static EncodedJSValue JSC_HOST_CALL functionNumberOfDFGCompiles(ExecState*);
     
    767768        addFunction(vm, "noInline", functionNeverInlineFunction, 1);
    768769        addFunction(vm, "noDFG", functionNoDFG, 1);
     770        addFunction(vm, "noFTL", functionNoFTL, 1);
    769771        addFunction(vm, "numberOfDFGCompiles", functionNumberOfDFGCompiles, 1);
    770772        addFunction(vm, "optimizeNextInvocation", functionOptimizeNextInvocation, 1);
     
    15221524}
    15231525
     1526EncodedJSValue JSC_HOST_CALL functionNoFTL(ExecState* exec)
     1527{
     1528    if (JSFunction* function = jsDynamicCast<JSFunction*>(exec->argument(0))) {
     1529        FunctionExecutable* executable = function->jsExecutable();
     1530        executable->setNeverFTLOptimize(true);
     1531    }
     1532
     1533    return JSValue::encode(jsUndefined());
     1534}
     1535
    15241536EncodedJSValue JSC_HOST_CALL functionOptimizeNextInvocation(ExecState* exec)
    15251537{
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r198980 r199863  
    118118    , m_neverInline(false)
    119119    , m_neverOptimize(false)
     120    , m_neverFTLOptimize(false)
    120121    , m_isArrowFunctionContext(isInArrowFunctionContext)
    121122    , m_derivedContextType(static_cast<unsigned>(derivedContextType))
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r198980 r199863  
    358358    void setNeverInline(bool value) { m_neverInline = value; }
    359359    void setNeverOptimize(bool value) { m_neverOptimize = value; }
     360    void setNeverFTLOptimize(bool value) { m_neverFTLOptimize = value; }
    360361    void setDidTryToEnterInLoop(bool value) { m_didTryToEnterInLoop = value; }
    361362    bool neverInline() const { return m_neverInline; }
    362363    bool neverOptimize() const { return m_neverOptimize; }
     364    bool neverFTLOptimize() const { return m_neverFTLOptimize; }
    363365    bool didTryToEnterInLoop() const { return m_didTryToEnterInLoop; }
    364366    bool isInliningCandidate() const { return !neverInline(); }
     
    420422    bool m_neverInline : 1;
    421423    bool m_neverOptimize : 1;
     424    bool m_neverFTLOptimize : 1;
    422425    bool m_isArrowFunctionContext : 1;
    423426    unsigned m_derivedContextType : 2; // DerivedContextType
Note: See TracChangeset for help on using the changeset viewer.