Rewrite array allocation code to be based on the per-global array shape
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox93 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(12 files)
|
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 | |
|
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 |
The code in NewArray is optimized using the NewObjectCache. This cache is brittle outside of micro-benchmarks (we'd like to remove it eventually), and there's a lot of complexity, for example to handle defining the length-property.
We can now rewrite this code to be based on a shape that gets passed in. In most cases this will be the array shape cached in the global object. This gives us more predictable performance and is also a lot simpler.
| Assignee | ||
Comment 1•4 years ago
|
||
All callers just want Array.prototype as proto. This lets us optimize more in
later patches.
| Assignee | ||
Comment 2•4 years ago
|
||
Depends on D122421
| Assignee | ||
Comment 3•4 years ago
|
||
Depends on D122422
| Assignee | ||
Comment 4•4 years ago
|
||
Depends on D122423
| Assignee | ||
Comment 5•4 years ago
|
||
A nullptr proto is already interpreted as "use the builtin Array.prototype" by
the constructing path, so we can rely on this also for the non-constructing case.
Depends on D122424
| Assignee | ||
Comment 6•4 years ago
|
||
This is more robust and simpler than the NewObjectCache.
Change AddLengthProperty to add the property directly to the shape, instead of
defining the property on the object and then getting its shape.
Depends on D122425
| Assignee | ||
Comment 7•4 years ago
|
||
This requires moving some code around because of the function definition order.
Depends on D122426
| Assignee | ||
Comment 8•4 years ago
|
||
This is more descriptive and more consistent with code added in the previous patch.
Depends on D122427
| Assignee | ||
Comment 9•4 years ago
|
||
Depends on D122428
| Assignee | ||
Comment 10•4 years ago
|
||
Depends on D122429
| Assignee | ||
Comment 11•4 years ago
|
||
Rename to just "create" and add missing call to debugCheckNewObject for consistency
with JSFunction, NativeObject, TypedObject.
Depends on D122430
| Assignee | ||
Comment 12•4 years ago
|
||
Depends on D122431
Comment 13•4 years ago
|
||
Comment 14•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/a206f62950d1
https://hg.mozilla.org/mozilla-central/rev/9e97aae394d9
https://hg.mozilla.org/mozilla-central/rev/36f23bd84226
https://hg.mozilla.org/mozilla-central/rev/b4d45fca754d
https://hg.mozilla.org/mozilla-central/rev/9c26c077837b
https://hg.mozilla.org/mozilla-central/rev/5efae97ecff4
https://hg.mozilla.org/mozilla-central/rev/1a867a5dadda
https://hg.mozilla.org/mozilla-central/rev/f1938f3d0a49
https://hg.mozilla.org/mozilla-central/rev/c1f94239d8b1
https://hg.mozilla.org/mozilla-central/rev/e74a2be001f2
https://hg.mozilla.org/mozilla-central/rev/a0ec11ff5ceb
https://hg.mozilla.org/mozilla-central/rev/793d0261e6bf
Description
•