Implement all JSOps supported by IonBuilder in WarpBuilder
Categories
(Core :: JavaScript Engine: JIT, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(31 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
Assignee | ||
Comment 1•5 years ago
|
||
BytecodeLocation contains just a pointer in non-debug builds so
passing it by value is a bit more efficient. It's also more readable
without the const&.
Assignee | ||
Comment 2•5 years ago
|
||
Depends on D64368
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 6•5 years ago
|
||
bugherder |
Comment 7•5 years ago
|
||
bugherder |
Assignee | ||
Comment 8•5 years ago
|
||
These ops are needed to support a typical for-loop. The next parts implement
the control flow ops for that.
Assignee | ||
Comment 9•5 years ago
|
||
We won't be sharing a lot of actual builder code, but sharing these data
structures is easy and prevents name conflicts.
Depends on D64760
Assignee | ||
Comment 10•5 years ago
|
||
This is mostly based on the IonBuilder code, but it's slightly simpler because
we don't have to handle loop restarts.
Depends on D64761
Comment 11•5 years ago
|
||
Assignee | ||
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Assignee | ||
Comment 14•5 years ago
|
||
This is based on the IonBuilder code that was tidied up last week in
bug 1380281 and bug 1478350.
Depends on D64975
Comment 15•5 years ago
|
||
bugherder |
Comment 16•5 years ago
|
||
Assignee | ||
Comment 17•5 years ago
|
||
Also:
- Adds some asserts to ensure we don't create TemporaryTypeSets, fixes issues.
- Makes some JSScript methods const so that BytecodeLocation can pass a const script.
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
bugherder |
Comment 20•5 years ago
|
||
bugherder |
Assignee | ||
Comment 21•5 years ago
|
||
For JSOp::Pow we now use an IC in Ion.
Assignee | ||
Comment 22•5 years ago
|
||
For JSOp::Arguments we need to look up the realm-specific template object on the
main thread. To support that, this patch adds a mechanism for snapshotting
op-specific data in WarpOracle. WarpScriptSnapshot contains a linked list of
WarpOpSnapshots that WarpBuilder can then iterate over.
JSOp::RegExp now uses a snapshot for the hasShared flag. Later we could use the
same mechanism for capturing Baseline IC data.
Comment 23•5 years ago
|
||
Comment 24•5 years ago
|
||
bugherder |
Comment 25•5 years ago
|
||
Comment 26•5 years ago
|
||
bugherder |
Assignee | ||
Comment 27•5 years ago
|
||
Assignee | ||
Comment 28•5 years ago
|
||
The previous patch introduced more jit-test failures because we didn't
initialize the environment chain yet (a good thing because it means we're
beginning to support non-trivial tests!).
WarpEnvironment is added to store information WarpBuilder needs to build the
environment chain. The goal is to make most of the decisions in WarpOracle so
that the WarpBuilder code can be as simple as possible.
Depends on D66386
Comment 29•5 years ago
|
||
Assignee | ||
Comment 30•5 years ago
|
||
Assignee | ||
Comment 31•5 years ago
|
||
For now this is the slowest possible implementation.
It reuses the CallInfo infrastructure. That class has some methods we probably
shouldn't use in WarpBuilder, but the class itself is still useful and we can
clean it up more when IonBuilder is gone.
This uncovered an issue with MCheckOverRecursed: IonBuilder gives this
instruction a resume point (it's not clear why) but WarpBuilder doesn't, so
DCE was eliminating it and some jit-test crashed with overrecursion.
Marking the instruction as guard fixes this.
Depends on D66738
Comment 32•5 years ago
|
||
bugherder |
Assignee | ||
Comment 33•5 years ago
|
||
Also deletes a comment in IonBuilder::jsop_getgname that no longer applies since
JitScript/BaselineInterpreter.
MBindNameCache had some unused fields.
Comment 34•5 years ago
|
||
Assignee | ||
Comment 35•5 years ago
|
||
Comment 36•5 years ago
|
||
bugherder |
Assignee | ||
Comment 37•5 years ago
|
||
The change in GetIntrinsicValue is necessary. IonBuilder adds a resume point
after MCallGetIntrinsicValue but in WarpBuilder that doesn't work: because the
instruction is not effectful, it would trigger an assertion failure in resumeAfter.
Without its own resume point, however, we can't look up the current pc in
GetIntrinsicValue (the pc comes from the last resume point) so disable that code
if WarpBuilder is enabled.
Comment 38•5 years ago
|
||
Assignee | ||
Comment 39•5 years ago
|
||
For JSOp::Object we call setSingletonsAsValues in WarpOracle. There's a comment
for CompileRealm::setSingletonsAsValues claiming it's safe to do that off-thread
but it's simpler and safer to just avoid it.
Assignee | ||
Comment 40•5 years ago
|
||
Comment 41•5 years ago
|
||
bugherder |
Comment 42•5 years ago
|
||
Assignee | ||
Comment 43•5 years ago
|
||
Comment 44•5 years ago
|
||
bugherder |
Assignee | ||
Comment 45•5 years ago
|
||
This adds buildInitPropOp instead of reusing buildSetPropOp because there are
some subtle differences between Init and Set. Longer term we should consider
splitting the MIR and CacheIR code as well so it becomes easier to reason about.
Assignee | ||
Comment 46•5 years ago
|
||
This requires some changes to LambdaFunctionInfo:
- Don't use LambdaFunctionInfo for MFunctionWithProto as the JSFunction is just passed to a C++ call.
- Make the callers pass the values to the constructor so that WarpBuilder can construct LambdaFunctionInfo from the snapshot.
- Use better static types now that we have FunctionFlags and BaseScript.
- Move the assert in LambdaFunctionInfo's constructor to CodeGenerator::visitLambda.
It's not clear if LambdaFunctionInfo is still required now that the function's
BaseScript* pointer is a constant, but long-term we probably want to move to a
model like this for all template objects anyway.
Assignee | ||
Comment 47•5 years ago
|
||
This needs more work to make it fast, especially JSOp::OptimizeSpreadCall.
Comment 48•5 years ago
|
||
Comment 49•5 years ago
|
||
bugherder |
Assignee | ||
Comment 50•5 years ago
|
||
Note that the resumeAt in IonBuilder for JSOp::Debugger made little sense: MDebugger
bails out if an onDebuggerStatement hook is active but that uses the previous resume
point and not the one attached there. Strictly speaking MDebugger isn't effectful
at all so it doesn't need a resume point, but changing getAliasSet is probably not
worth it.
Unfortunately the instrumentation callback can be nursery allocated. For now
WarpOracle aborts compilation in this case, I think that's fine considering the
instrumentation machinery isn't really used anymore.
Finally, maybe in the future WarpOracle should allocate WarpScriptSnapshot upfront
so we don't need a constructor with many parameters.
Comment 51•5 years ago
|
||
Assignee | ||
Comment 52•5 years ago
|
||
This follows the IonBuilder code but the WarpBuilder design makes this come out
a bit simpler and nicer.
Also cleans up BytecodeLocation to not conflate jump targets and TableSwitch's
default-target. It worked, but it's an implementation detail and BytecodeLocation
should be explicit about the difference.
Comment 53•5 years ago
|
||
bugherder |
Comment 54•5 years ago
|
||
Assignee | ||
Comment 55•5 years ago
|
||
Also folds MRestCommon into MRest. The MRestCommon base class was added for the
PJS version of MRest but PJS was removed a long time ago.
Assignee | ||
Comment 56•5 years ago
|
||
Note that JSOp::Pos used to be very hot because it was used to implement the
increment and decrement operators, but for BigInt these were changed to use
JSOp::ToNumeric. JSOp::Pos is now only used for the +x operator.
IonBuilder compiles +x as x * 1, but that results in complexity elsewhere (ICs
and CacheIR inlining for example).
It's simpler to follow JSOp::ToNumeric/MToNumeric with an MToNumber instruction.
The patch adds the most basic implementation of this (still reasonably fast
because it checks for numbers inline). This also nicely matches what Baseline does.
Comment 57•5 years ago
|
||
bugherder |
Assignee | ||
Comment 58•5 years ago
|
||
Assignee | ||
Comment 59•5 years ago
|
||
At this point WarpBuilder supports the same JSOps as IonBuilder.
We now get a compiler warning in WarpOracle and WarpBuilder when a new JSOp is
added but not handled in WarpOracle/WarpBuilder.
WarpOracle is slightly more efficient now because it has one switch-statement
instead of two.
Assignee | ||
Updated•5 years ago
|
Comment 60•5 years ago
|
||
Comment 61•5 years ago
|
||
bugherder |
Comment 62•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 63•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4750f4a68ad1
https://hg.mozilla.org/mozilla-central/rev/b085cf5490fe
Description
•