Bug 226207 - Merge all the JIT worklists into a shared worklist
Summary: Merge all the JIT worklists into a shared worklist
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tadeu Zagallo
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-24 19:25 PDT by Tadeu Zagallo
Modified: 2021-05-26 15:56 PDT (History)
10 users (show)

See Also:


Attachments
Patch (241.94 KB, patch)
2021-05-24 20:01 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
Patch (245.37 KB, patch)
2021-05-25 16:57 PDT, Tadeu Zagallo
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (245.78 KB, patch)
2021-05-25 17:16 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
Patch (245.81 KB, patch)
2021-05-25 17:50 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tadeu Zagallo 2021-05-24 19:25:27 PDT
...
Comment 1 Tadeu Zagallo 2021-05-24 20:01:09 PDT
Created attachment 429617 [details]
Patch
Comment 2 Saam Barati 2021-05-25 13:14:41 PDT
Comment on attachment 429617 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429617&action=review

r=me

> Source/JavaScriptCore/ChangeLog:13
> +        on uper tiers when all lower tiers have no pending tasks or have exceeded the maximum

uper => upper

> Source/JavaScriptCore/dfg/DFGPlan.cpp:138
> +        : JITPlan(mode, passedCodeBlock)
> +        , m_profiledDFGCodeBlock(profiledDFGCodeBlock)
> +        , m_mustHandleValues(mustHandleValues)
> +        , m_osrEntryBytecodeIndex(osrEntryBytecodeIndex)
> +        , m_compilation(UNLIKELY(m_vm->m_perBytecodeProfiler) ? adoptRef(new Profiler::Compilation(m_vm->m_perBytecodeProfiler->ensureBytecodesFor(m_codeBlock), profilerCompilationKindForMode(mode))) : nullptr)
> +        , m_inlineCallFrames(adoptRef(new InlineCallFrameSet()))
> +        , m_identifiers(m_codeBlock)
> +        , m_weakReferences(m_codeBlock)
> +        , m_transitions(m_codeBlock)

indentation looks off here, but not sure if it's real or it's bugzilla

> Source/JavaScriptCore/dfg/DFGPlan.cpp:169
> +    JITPlan::cancel();

nit: I find it a bit more elegant to define JITPlan as Base in the class definition in the header, and use Base instead of JITPlan in the various places

> Source/JavaScriptCore/heap/Heap.cpp:-1661
> -            setGCDidJIT();

let's now remove this function and anything using `gcDidJITBit`, like handleGCDidJIT, etc

> Source/JavaScriptCore/jit/JITBaselinePlan.cpp:33
> +JITBaselinePlan::JITBaselinePlan(CodeBlock* codeBlock, BytecodeIndex loopOSREntryBytecodeIndex)

nit: I think I'd name this BaselineJITPlan

> Source/JavaScriptCore/jit/JITPlan.cpp:148
> +    MonotonicTime before { };

don't think you need the "{ }"

> Source/JavaScriptCore/jit/JITPlan.h:75
> +    virtual void notifyCompiling();

why virtual? From what I can tell, only one implementation.

> Source/JavaScriptCore/jit/JITWorklist.cpp:79
> +CompilationResult JITWorklist::enqueue(Ref<JITPlan>&& plan)

nit: can this just be a Ref<JITPlan> instead of Ref<JITPlan>&&? That way, this function just takes ownership over the ref, and it can happily still WTFMove it in the CJIT case

> Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:381
> +    if (codeBlock->jitType() == JITType::BaselineJIT || worklistState == JITWorklist::Compiled) {

why do we need both these conditions? Won't Compiled imply we installed the new code?
Comment 3 Tadeu Zagallo 2021-05-25 14:03:19 PDT
Comment on attachment 429617 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429617&action=review

Thanks for the review

>> Source/JavaScriptCore/dfg/DFGPlan.cpp:138
>> +        , m_transitions(m_codeBlock)
> 
> indentation looks off here, but not sure if it's real or it's bugzilla

I agree, but that's what check-webkit-style wanted

>> Source/JavaScriptCore/dfg/DFGPlan.cpp:169
>> +    JITPlan::cancel();
> 
> nit: I find it a bit more elegant to define JITPlan as Base in the class definition in the header, and use Base instead of JITPlan in the various places

Will do

>> Source/JavaScriptCore/heap/Heap.cpp:-1661
>> -            setGCDidJIT();
> 
> let's now remove this function and anything using `gcDidJITBit`, like handleGCDidJIT, etc

👍

>> Source/JavaScriptCore/jit/JITBaselinePlan.cpp:33
>> +JITBaselinePlan::JITBaselinePlan(CodeBlock* codeBlock, BytecodeIndex loopOSREntryBytecodeIndex)
> 
> nit: I think I'd name this BaselineJITPlan

That's a good point, I got hung up on the JIT prefix, but that's better

>> Source/JavaScriptCore/jit/JITPlan.cpp:148
>> +    MonotonicTime before { };
> 
> don't think you need the "{ }"

will update, this was just moved from DFGPlan

>> Source/JavaScriptCore/jit/JITPlan.h:75
>> +    virtual void notifyCompiling();
> 
> why virtual? From what I can tell, only one implementation.

will remove

>> Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:381
>> +    if (codeBlock->jitType() == JITType::BaselineJIT || worklistState == JITWorklist::Compiled) {
> 
> why do we need both these conditions? Won't Compiled imply we installed the new code?

Yes, but I think I ran into issues with this, I'll double check.
Comment 4 Tadeu Zagallo 2021-05-25 16:57:23 PDT
Created attachment 429711 [details]
Patch
Comment 5 Tadeu Zagallo 2021-05-25 17:16:03 PDT
Created attachment 429713 [details]
Patch
Comment 6 Tadeu Zagallo 2021-05-25 17:50:43 PDT
Created attachment 429719 [details]
Patch
Comment 7 EWS 2021-05-26 08:15:29 PDT
Committed r278082 (238161@main): <https://commits.webkit.org/238161@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429719 [details].
Comment 8 Radar WebKit Bug Importer 2021-05-26 08:16:16 PDT
<rdar://problem/78513094>