IonMonkey: Fast path for typeof x == y
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox95 | --- | fixed |
People
(Reporter: jandem, Assigned: anba)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [ion:t])
Attachments
(11 files, 4 obsolete files)
41.29 KB,
patch
|
Details | Diff | Splinter Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 725966 - Part 9: Add `MacroAssembler::test{Number,Boolean,String,Symbol,BigInt}Set()`. r=jandem!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Updated•13 years ago
|
Comment 1•13 years ago
|
||
Comment 2•13 years ago
|
||
Comment 3•13 years ago
|
||
Comment 4•13 years ago
|
||
Reporter | ||
Comment 5•13 years ago
|
||
Comment 6•13 years ago
|
||
Comment 7•13 years ago
|
||
Comment 8•13 years ago
|
||
![]() |
||
Updated•13 years ago
|
Comment 9•13 years ago
|
||
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
Updated•11 years ago
|
Comment 13•11 years ago
|
||
Comment 14•5 years ago
|
||
André I thought you had written a patch for this in bug 1655465. Did it not work?
Assignee | ||
Comment 15•5 years ago
|
||
The (obsoleted) patches in bug 1655465 relied on using GVN for MLoadValueTag
, but unfortunately that approach doesn't work on ARM64, because masm.extractTag
doesn't return a JSValueTag
on that platform.
Assignee | ||
Comment 16•4 years ago
|
||
Using EnumSet
simplifies the code and makes it faster, for example the
constructor is inlined at "-02" and set operations are all constant time.
Updated•4 years ago
|
Assignee | ||
Comment 17•4 years ago
|
||
This isn't currently an issue, because the number of observed types is
restricted to six, which means JSVAL_TYPE_OBJECT
currently can't be last,
but it seems nicer to explicitly handle this case, because otherwise it might
confuse the reader and if we ever support seven or more types in the
observed types set, we could introduce a subtle bug here.
Depends on D128069
Assignee | ||
Comment 18•4 years ago
|
||
Only because I noticed this while working on the next patch in this stack.
Depends on D128070
Assignee | ||
Comment 19•4 years ago
|
||
JSTYPE_NULL
was added for e4x.
Depends on D128071
Assignee | ||
Comment 20•4 years ago
|
||
Split MTypeOf
in two separate instructions so it's easier to further
optimise it in comparison contexts, see part 8.
Depends on D128072
Assignee | ||
Comment 21•4 years ago
|
||
Moves the typeof
equality comparison detection into a separate function, so
we can reuse it in part 8. Additionally it was updated to handle all possible
JSType
constants.
Depends on D128073
Assignee | ||
Comment 22•4 years ago
|
||
JSTYPE_UNDEFINED
is similar toJSTYPE_OBJECT
and has to handle both
undefined and objects inputs.JSTYPE_FUNCTION
can never occur when the input isn't an object.JSTYPE_LIMIT
means the string constant isn't a valid type name.
Depends on D128074
Assignee | ||
Comment 23•4 years ago
|
||
This optimisation folds away string comparisons when typeof
appears in
equality comparison contexts:
MTypeOfName(MTypeOf(input)) == MConstant(string)
is now optimised to:
MTypeOf(input) == MConstant(int32).
Depends on D128075
Assignee | ||
Comment 24•4 years ago
|
||
Add testThingSet
methods in preparation for the next part.
MIPS doesn't support MacroAssembler::emitSet()
, so we have to introduce this
additional abstraction.
Depends on D128076
Assignee | ||
Comment 25•4 years ago
|
||
This is based on Tom's original patch in bug 725966.
As the last optimisation in this stack, optimise typeof in simple comparison
contexts. For example:
if (typeof thing === "number") { ... }
is now optimised into:
if (IsNumber(thing)) { ... }
This optimisation is only used when there's a single user of the MTypeOfName
instruction to avoid slowing down the case when typeof
is used in switch
statements.
For example consider:
switch (typeof thing) {
case "object":
case "undefined":
case "number":
case "boolean":
case "string":
case "symbol":
case "bigint":
case "function":
}
If thing
was a function, using the MTypeOfIs
optimisation would mean that
the type tag is split eight times (for each case
statement), possibly even
two OOL calls when the function is a proxy (for the "object" and "undefined"
cases).
Depends on D128077
Comment 26•4 years ago
|
||
Comment 27•4 years ago
|
||
Backed out 10 changesets (Bug 725966) for causing build bustages on CodeGenerator.cpp.
Backout link
Push with failures
Failure Log
Assignee | ||
Comment 28•4 years ago
|
||
I'll look into it, seems like some GCC specific issue.
Comment 29•4 years ago
|
||
Comment 30•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2faf162d473a
https://hg.mozilla.org/mozilla-central/rev/2406b5231307
https://hg.mozilla.org/mozilla-central/rev/f34552d29d22
https://hg.mozilla.org/mozilla-central/rev/3aac3ca5cdbb
https://hg.mozilla.org/mozilla-central/rev/2198d91bb27c
https://hg.mozilla.org/mozilla-central/rev/5798488e85bb
https://hg.mozilla.org/mozilla-central/rev/0b43bb2f2d8b
https://hg.mozilla.org/mozilla-central/rev/e419b06ed3d4
https://hg.mozilla.org/mozilla-central/rev/a490916980ca
https://hg.mozilla.org/mozilla-central/rev/4cc431f61ab0
Comment 31•4 years ago
|
||
Very cool. Thanks André for finally getting this done.
Description
•