Improve generated code for EqualChars and some further clean-ups
Categories
(Core :: JavaScript Engine, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox104 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(12 files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
EqualChars
generates sub-optimal code when comparing Latin1Char*
against char*
: https://godbolt.org/z/5oG6hhd9G.
Also perform some additional clean-ups around EqualChars
callers. For example:
- Use
std::string_view
where applicable. - Replace
sizeof
where applicable.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Compilers don't emit memcmp
when the both inputs aren't exactly the same type.
Assignee | ||
Comment 2•2 years ago
|
||
This makes the code a bit more uniform.
The previous part should make bug 1589591 obsolete, so it seems useful to make
the code more uniform.
Depends on D152040
Assignee | ||
Comment 3•2 years ago
|
||
Part 1 ensures we generate fast code when comparing against constant char*
strings, so we no longer need the more complicated code.
Depends on D152042
Assignee | ||
Comment 4•2 years ago
|
||
std::string_view
stores a pointer and its length, so we no longer have to
use two different variables. std::string_view
methods are also const_expr
,
so the compiler will inline them at compile-time.
Depends on D152043
Assignee | ||
Comment 5•2 years ago
|
||
builtin/Object.cpp:
- Using
string_view
avoids the call tostrlen
whenConsume
isn't inlined.
jsapi-tests/testCompileNonSyntactic.cpp:
shell/jsoptparse.cpp:
xpconnect/src/XPCWrappedNativeJSOps.cpp:
- Using
string_view
avoids thesizeof - 1
pattern.
Depends on D152044
Assignee | ||
Comment 6•2 years ago
|
||
std::char_traits<char>::length
is longer than sizeof - 1
, but avoids knowing
how the sizeof - 1
pattern works.
Depends on D152045
Assignee | ||
Comment 7•2 years ago
|
||
Depends on D152047
Assignee | ||
Comment 8•2 years ago
|
||
Depends on D152048
Assignee | ||
Comment 9•2 years ago
|
||
Depends on D152049
Assignee | ||
Comment 10•2 years ago
|
||
Noticed while checking for more sizeof
uses across the code base.
Depends on D152051
Assignee | ||
Comment 11•2 years ago
|
||
Noticed because the last part changed memset
callers.
Depends on D152052
Updated•2 years ago
|
Assignee | ||
Comment 13•2 years ago
|
||
Updated•2 years ago
|
Comment 14•2 years ago
|
||
Comment 15•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/de03ad94fa30
https://hg.mozilla.org/mozilla-central/rev/03deb487524f
https://hg.mozilla.org/mozilla-central/rev/caec1c0fd0cf
https://hg.mozilla.org/mozilla-central/rev/4617fbe2c524
https://hg.mozilla.org/mozilla-central/rev/253fba58019e
https://hg.mozilla.org/mozilla-central/rev/effe68106173
https://hg.mozilla.org/mozilla-central/rev/d5a41f935dc1
https://hg.mozilla.org/mozilla-central/rev/eb4437561337
https://hg.mozilla.org/mozilla-central/rev/ee6bcfc78607
https://hg.mozilla.org/mozilla-central/rev/d66a2324bd75
https://hg.mozilla.org/mozilla-central/rev/6c88654690bf
https://hg.mozilla.org/mozilla-central/rev/18d92d17a23b
Description
•