WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
129355
Compilation policy management belongs in operationOptimize(), not the DFG Driver.
https://bugs.webkit.org/show_bug.cgi?id=129355
Summary
Compilation policy management belongs in operationOptimize(), not the DFG Dri...
Filip Pizlo
Reported
2014-02-25 18:40:38 PST
If you want to poll for an opportunity to compile code, then you should do that outside of the DFG::compile() driver. Such polling belongs in operationOptimize(). We already do such polling for shouldAlwaysBeInlined and for the execution counter itself.
Attachments
the patch.
(5.15 KB, patch)
2014-02-26 04:08 PST
,
Mark Lam
fpizlo
: review-
fpizlo
: commit-queue-
Details
Formatted Diff
Diff
patch 2: applied Filip’s feedback.
(8.03 KB, patch)
2014-02-26 11:38 PST
,
Mark Lam
fpizlo
: review-
Details
Formatted Diff
Diff
patch 3: applied more feedback.
(8.63 KB, patch)
2014-02-26 12:02 PST
,
Mark Lam
fpizlo
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-02-25 20:26:37 PST
<
rdar://problem/16169484
>
Mark Lam
Comment 2
2014-02-26 03:58:27 PST
Moving the previous title here for reference: "CompilationInvalidated is reserved for signaling concurrent JIT race conditions and should never be used to mean "I didn't feel like compiling right now so ask me again later”. By compilation policy, I mean the rules for determining whether to compile, when to compile, when to attempt compilation again, etc. The few of these policy decisions being made in the DFG driver are now moved to operationOptimize() where we keep the rest of the policy logic. Decisions that are based on the capabilities supported by the DFG are moved to DFG capabiliityLevel(). Patch coming.
Mark Lam
Comment 3
2014-02-26 04:08:50 PST
Created
attachment 225246
[details]
the patch.
Filip Pizlo
Comment 4
2014-02-26 09:50:23 PST
Comment on
attachment 225246
[details]
the patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=225246&action=review
> Source/JavaScriptCore/dfg/DFGCapabilities.cpp:232 > + > + if (!MacroAssembler::supportsFloatingPoint()) > + return CannotCompile; > + > + if (!Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount())) > + return CannotCompile; > +
I would put these checks into the mightCompile... and mightInline... methods. There are a handful of places that will call the mightInline() methods instead of calling capabilityLevel(). You could give them all a common helper function like "isSupported(CodeBlock*)" that will do checks like supportsFloatingPoint and the bytecodeRange.
> Source/JavaScriptCore/jit/JITOperations.cpp:1053 > + if (!Options::useDFGJIT()) { > + codeBlock->dontOptimizeAnytimeSoon(); > + return encodeResult(0, 0); > + } > + > + if (vm.enabledProfiler()) { > + codeBlock->optimizeAfterWarmUp(); > + return encodeResult(0, 0); > + } > + > + Debugger* debugger = codeBlock->globalObject()->debugger(); > + if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests())) { > + codeBlock->optimizeAfterWarmUp(); > + return encodeResult(0, 0); > + } > +
This should all be placed below the call to checkIfOptimizationThresholdReached(). That call must be the first thing you do on an ExecutionCounter slow path. Also, the !useDFGJIT() part should be in DFGCapabilities.
Mark Lam
Comment 5
2014-02-26 11:38:31 PST
Created
attachment 225270
[details]
patch 2: applied Filip’s feedback.
Filip Pizlo
Comment 6
2014-02-26 11:41:11 PST
Comment on
attachment 225270
[details]
patch 2: applied Filip’s feedback. View in context:
https://bugs.webkit.org/attachment.cgi?id=225270&action=review
Almost there.
> Source/JavaScriptCore/dfg/DFGCapabilities.cpp:45 > + if (!Options::useDFGJIT() > + || !MacroAssembler::supportsFloatingPoint() > + || !Options::bytecodeRangeToDFGCompile().isInRange(codeBlock->instructionCount())) > + return false; > + return true;
Why not just turn this into a single return statement?
> Source/JavaScriptCore/jit/JITOperations.cpp:1065 > + codeBlock->optimizeAfterWarmUp();
You could call updateAllPredictions() here.
> Source/JavaScriptCore/jit/JITOperations.cpp:1071 > + codeBlock->optimizeAfterWarmUp();
And here. You could even have a helper that calls both optimizeAfterWarmUp and updateAllPredictions.
Mark Lam
Comment 7
2014-02-26 12:02:37 PST
Created
attachment 225273
[details]
patch 3: applied more feedback.
Mark Lam
Comment 8
2014-02-26 12:09:21 PST
Thanks. Landed in
r164734
: <
http://trac.webkit.org/r164734
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug