- Source/JavaScriptCore/ChangeLog +28 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2014-01-16  Filip Pizlo  <fpizlo@apple.com>
2
3
        FTL watchpoint tests that use dfgIncrement() and friends fail because numberOfDFGCompiles() returns zero with --testTheFTL=true and right after the first FTL OSR exit but just before recompilation is triggered
4
        https://bugs.webkit.org/show_bug.cgi?id=127163
5
6
        Reviewed by NOBODY (OOPS!).
7
        
8
        We just need to track if we had ever compiled with the FTL. Also rework the various
9
        bool's in CodeBlock so that they are bitfields if possible. To that end, make sure
10
        we only write to them from the main thread.
11
        
12
        This fixes a bunch of LayoutTests with --ftl-jit. Now only two fail.
13
14
        * bytecode/CodeBlock.cpp:
15
        (JSC::CodeBlock::dumpAssumingJITType):
16
        (JSC::CodeBlock::CodeBlock):
17
        (JSC::CodeBlock::numberOfDFGCompiles):
18
        * bytecode/CodeBlock.h:
19
        * dfg/DFGJITCode.cpp:
20
        (JSC::DFG::JITCode::setOptimizationThresholdBasedOnCompilationResult):
21
        * dfg/DFGJITFinalizer.cpp:
22
        (JSC::DFG::JITFinalizer::finalizeCommon):
23
        * dfg/DFGPlan.cpp:
24
        (JSC::DFG::Plan::Plan):
25
        * dfg/DFGPlan.h:
26
        * dfg/DFGTierUpCheckInjectionPhase.cpp:
27
        (JSC::DFG::TierUpCheckInjectionPhase::run):
28
1
2014-01-16  Filip Pizlo  <fpizlo@apple.com>
29
2014-01-16  Filip Pizlo  <fpizlo@apple.com>
2
30
3
        JSC layout tests should run with the FTL
31
        JSC layout tests should run with the FTL
- Source/JavaScriptCore/bytecode/CodeBlock.cpp -3 / +7 lines
Lines 147-152 void CodeBlock::dumpAssumingJITType(Prin Source/JavaScriptCore/bytecode/CodeBlock.cpp_sec1
147
        out.print(" (NeverInline)");
147
        out.print(" (NeverInline)");
148
    if (ownerExecutable()->isStrictMode())
148
    if (ownerExecutable()->isStrictMode())
149
        out.print(" (StrictMode)");
149
        out.print(" (StrictMode)");
150
    if (this->jitType() == JITCode::BaselineJIT && m_didFailFTLCompilation)
151
        out.print(" (FTLFail)");
152
    if (this->jitType() == JITCode::BaselineJIT && m_hasBeenCompiledWithFTL)
153
        out.print(" (HadFTLReplacement)");
150
    out.print("]");
154
    out.print("]");
151
}
155
}
152
156
Lines 1472-1477 CodeBlock::CodeBlock(CopyParsedBlockTag, Source/JavaScriptCore/bytecode/CodeBlock.cpp_sec2
1472
    , m_isConstructor(other.m_isConstructor)
1476
    , m_isConstructor(other.m_isConstructor)
1473
    , m_shouldAlwaysBeInlined(true)
1477
    , m_shouldAlwaysBeInlined(true)
1474
    , m_didFailFTLCompilation(false)
1478
    , m_didFailFTLCompilation(false)
1479
    , m_hasBeenCompiledWithFTL(false)
1475
    , m_unlinkedCode(*other.m_vm, other.m_ownerExecutable.get(), other.m_unlinkedCode.get())
1480
    , m_unlinkedCode(*other.m_vm, other.m_ownerExecutable.get(), other.m_unlinkedCode.get())
1476
    , m_ownerExecutable(*other.m_vm, other.m_ownerExecutable.get(), other.m_ownerExecutable.get())
1481
    , m_ownerExecutable(*other.m_vm, other.m_ownerExecutable.get(), other.m_ownerExecutable.get())
1477
    , m_vm(other.m_vm)
1482
    , m_vm(other.m_vm)
Lines 1527-1532 CodeBlock::CodeBlock(ScriptExecutable* o Source/JavaScriptCore/bytecode/CodeBlock.cpp_sec3
1527
    , m_isConstructor(unlinkedCodeBlock->isConstructor())
1532
    , m_isConstructor(unlinkedCodeBlock->isConstructor())
1528
    , m_shouldAlwaysBeInlined(true)
1533
    , m_shouldAlwaysBeInlined(true)
1529
    , m_didFailFTLCompilation(false)
1534
    , m_didFailFTLCompilation(false)
1535
    , m_hasBeenCompiledWithFTL(false)
1530
    , m_unlinkedCode(m_globalObject->vm(), ownerExecutable, unlinkedCodeBlock)
1536
    , m_unlinkedCode(m_globalObject->vm(), ownerExecutable, unlinkedCodeBlock)
1531
    , m_ownerExecutable(m_globalObject->vm(), ownerExecutable, ownerExecutable)
1537
    , m_ownerExecutable(m_globalObject->vm(), ownerExecutable, ownerExecutable)
1532
    , m_vm(unlinkedCodeBlock->vm())
1538
    , m_vm(unlinkedCodeBlock->vm())
Lines 2909-2917 unsigned CodeBlock::numberOfDFGCompiles( Source/JavaScriptCore/bytecode/CodeBlock.cpp_sec4
2909
    if (Options::testTheFTL()) {
2915
    if (Options::testTheFTL()) {
2910
        if (m_didFailFTLCompilation)
2916
        if (m_didFailFTLCompilation)
2911
            return 1000000;
2917
            return 1000000;
2912
        if (replacement()->jitType() != JITCode::FTLJIT)
2918
        return (m_hasBeenCompiledWithFTL ? 1 : 0) + m_reoptimizationRetryCounter;
2913
            return 0;
2914
        return 1 + m_reoptimizationRetryCounter;
2915
    }
2919
    }
2916
    return (JITCode::isOptimizingJIT(replacement()->jitType()) ? 1 : 0) + m_reoptimizationRetryCounter;
2920
    return (JITCode::isOptimizingJIT(replacement()->jitType()) ? 1 : 0) + m_reoptimizationRetryCounter;
2917
}
2921
}
- Source/JavaScriptCore/bytecode/CodeBlock.h -4 / +5 lines
Lines 901-907 public: Source/JavaScriptCore/bytecode/CodeBlock.h_sec1
901
901
902
    int m_numCalleeRegisters;
902
    int m_numCalleeRegisters;
903
    int m_numVars;
903
    int m_numVars;
904
    bool m_isConstructor;
904
    bool m_isConstructor : 1;
905
    
905
    
906
    // This is intentionally public; it's the responsibility of anyone doing any
906
    // This is intentionally public; it's the responsibility of anyone doing any
907
    // of the following to hold the lock:
907
    // of the following to hold the lock:
Lines 921-930 public: Source/JavaScriptCore/bytecode/CodeBlock.h_sec2
921
    // concurrent compilation threads finish what they're doing.
921
    // concurrent compilation threads finish what they're doing.
922
    mutable ConcurrentJITLock m_lock;
922
    mutable ConcurrentJITLock m_lock;
923
    
923
    
924
    bool m_shouldAlwaysBeInlined;
924
    bool m_shouldAlwaysBeInlined; // Not a bitfield because the JIT wants to store to it.
925
    bool m_allTransitionsHaveBeenMarked; // Initialized and used on every GC.
925
    bool m_allTransitionsHaveBeenMarked : 1; // Initialized and used on every GC.
926
    
926
    
927
    bool m_didFailFTLCompilation;
927
    bool m_didFailFTLCompilation : 1;
928
    bool m_hasBeenCompiledWithFTL : 1;
928
929
929
    // Internal methods for use by validation code. It would be private if it wasn't
930
    // Internal methods for use by validation code. It would be private if it wasn't
930
    // for the fact that we use it from anonymous namespaces.
931
    // for the fact that we use it from anonymous namespaces.
- Source/JavaScriptCore/dfg/DFGJITCode.cpp +1 lines
Lines 156-161 void JITCode::setOptimizationThresholdBa Source/JavaScriptCore/dfg/DFGJITCode.cpp_sec1
156
    switch (result) {
156
    switch (result) {
157
    case CompilationSuccessful:
157
    case CompilationSuccessful:
158
        optimizeNextInvocation(codeBlock);
158
        optimizeNextInvocation(codeBlock);
159
        codeBlock->baselineVersion()->m_hasBeenCompiledWithFTL = true;
159
        return;
160
        return;
160
    case CompilationFailed:
161
    case CompilationFailed:
161
        dontOptimizeAnytimeSoon(codeBlock);
162
        dontOptimizeAnytimeSoon(codeBlock);
- Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp +3 lines
Lines 77-82 void JITFinalizer::finalizeCommon() Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp_sec1
77
    
77
    
78
    if (m_plan.compilation)
78
    if (m_plan.compilation)
79
        m_plan.vm.m_perBytecodeProfiler->addCompilation(m_plan.compilation);
79
        m_plan.vm.m_perBytecodeProfiler->addCompilation(m_plan.compilation);
80
    
81
    if (!m_plan.willTryToTierUp)
82
        m_plan.codeBlock->baselineVersion()->m_didFailFTLCompilation = true;
80
}
83
}
81
84
82
} } // namespace JSC::DFG
85
} } // namespace JSC::DFG
- Source/JavaScriptCore/dfg/DFGPlan.cpp +1 lines
Lines 117-122 Plan::Plan( Source/JavaScriptCore/dfg/DFGPlan.cpp_sec1
117
    , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), profilerCompilationKindForMode(mode))) : 0)
117
    , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), profilerCompilationKindForMode(mode))) : 0)
118
    , identifiers(codeBlock.get())
118
    , identifiers(codeBlock.get())
119
    , weakReferences(codeBlock.get())
119
    , weakReferences(codeBlock.get())
120
    , willTryToTierUp(false)
120
    , isCompiled(false)
121
    , isCompiled(false)
121
{
122
{
122
}
123
}
- Source/JavaScriptCore/dfg/DFGPlan.h +2 lines
Lines 84-89 struct Plan : public ThreadSafeRefCounte Source/JavaScriptCore/dfg/DFGPlan.h_sec1
84
    DesiredWeakReferences weakReferences;
84
    DesiredWeakReferences weakReferences;
85
    DesiredWriteBarriers writeBarriers;
85
    DesiredWriteBarriers writeBarriers;
86
    DesiredTransitions transitions;
86
    DesiredTransitions transitions;
87
    
88
    bool willTryToTierUp;
87
89
88
    double beforeFTL;
90
    double beforeFTL;
89
    
91
    
- Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp -3 / +2 lines
Lines 55-64 public: Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp_sec1
55
        
55
        
56
#if ENABLE(FTL_JIT)
56
#if ENABLE(FTL_JIT)
57
        FTL::CapabilityLevel level = FTL::canCompile(m_graph);
57
        FTL::CapabilityLevel level = FTL::canCompile(m_graph);
58
        if (level == FTL::CannotCompile) {
58
        if (level == FTL::CannotCompile)
59
            m_graph.m_profiledBlock->m_didFailFTLCompilation = true;
60
            return false;
59
            return false;
61
        }
62
        
60
        
63
        InsertionSet insertionSet(m_graph);
61
        InsertionSet insertionSet(m_graph);
64
        for (BlockIndex blockIndex = m_graph.numBlocks(); blockIndex--;) {
62
        for (BlockIndex blockIndex = m_graph.numBlocks(); blockIndex--;) {
Lines 111-116 public: Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp_sec2
111
            insertionSet.execute(block);
109
            insertionSet.execute(block);
112
        }
110
        }
113
        
111
        
112
        m_graph.m_plan.willTryToTierUp = true;
114
        return true;
113
        return true;
115
#else // ENABLE(FTL_JIT)
114
#else // ENABLE(FTL_JIT)
116
        RELEASE_ASSERT_NOT_REACHED();
115
        RELEASE_ASSERT_NOT_REACHED();

Return to Bug 127163