Implement CanonicalNumericIndexString and use it for typed arrays
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: evilpie, Assigned: anba)
References
(Blocks 2 open bugs)
Details
Attachments
(10 files, 1 obsolete file)
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 |
ES6 imposes all sorts of stuff on array indexes in typed arrays. See for example [[HasProperty]] If IsDetachedBuffer(buffer) is true, throw a TypeError exception. If IsInteger(index) is false then return false If index = −0, return false. We have IsTypedArrayIndex, but that doesn't accept doubles, like CanonicalNumericIndexString After this is implemented the MOP needs to be audited and corrected.
Updated•8 years ago
|
Comment 1•8 years ago
|
||
By my reading this should be a valid test case: let a = new Int8Array([1]); assertEq(Object.getOwnPropertyDescriptor(a, "-0"), a[-0]); assertEq(Object.getOwnPropertyDescriptor(a, "0.0"), a[0.0]);
Comment 2•8 years ago
|
||
arg, two problems: * Object.getOwnPropertyDescriptor(a, x).value and these test cases are not valid because of step 4. in CanonicalNumericIndexString
Updated•8 years ago
|
Assignee | ||
Updated•7 years ago
|
Comment 3•6 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Assignee | ||
Updated•6 years ago
|
Reporter | ||
Comment 4•6 years ago
|
||
Search for (String)IsTypedArrayIndex should find a lot of relevant places that need to be replaced by CanonicalNumericIndexString.
Updated•6 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
The assertion should make it easier to see why no length checks are used and
will make it easier to remember updating this code if we ever remove flat
strings.
Assignee | ||
Comment 7•5 years ago
|
||
Depends on D39034
Assignee | ||
Comment 8•5 years ago
|
||
Part 5 will call this function.
Depends on D39035
Assignee | ||
Comment 9•5 years ago
|
||
The next patch adds code which may fail on OOM, so StringIsTypedArrayIndex's
interface needs to be updated to allow passing on errors.
Depends on D39036
Assignee | ||
Comment 10•5 years ago
|
||
Depends on D39037
Assignee | ||
Comment 11•5 years ago
|
||
Depends on D39038
Assignee | ||
Comment 12•5 years ago
|
||
The next parts use this constant in static_asserts.
Depends on D39039
Assignee | ||
Comment 13•5 years ago
|
||
The definition of canonical numeric index strings means that any access into a TypedArray
with a Double index never reads from the prototype chain. Instead if the Double is not
representable as an Int32, the access is equivalent to an out-of-bounds access. That
means we can substitute any non-Int32 Double index with an arbitrary index which is OOB.
This helps to avoid deoptimising TypedArray accesses with non-Int32 Double values by
handling them as normal out-of-bounds accesses, which are already optimisable.
Depends on D39040
Assignee | ||
Comment 14•5 years ago
|
||
Handle and report out-of-bounds accesses in SetPropIRGenerator to ensure Ion won't
repeatedly bailout when out-of-bounds accesses happen.
Depends on D39041
Assignee | ||
Comment 15•5 years ago
|
||
That way CacheIR can still attach an IC and Baseline/Ion don't need to take the
slow path when a TypedArray access happens through a Double not representable as
an Int32.
Depends on D39043
Assignee | ||
Comment 16•5 years ago
|
||
That way CacheIR can still attach an IC and Baseline/Ion don't need to take the
slow path when a TypedArray access happens through a Double not representable as
an Int32.
Depends on D39044
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 17•5 years ago
|
||
Filed bug 1573803 for Phabricator not displaying the change sets.
Updated•5 years ago
|
Comment 18•5 years ago
|
||
Hey I'm seeing this stack for the first time now because the patches are in draft state! Let me know if you want me to review :)
Assignee | ||
Comment 19•5 years ago
|
||
I'll probably request review when the BigInt CacheIR changes have landed.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 20•5 years ago
|
||
Pushed by archaeopteryx@coole-files.de: https://hg.mozilla.org/integration/autoland/rev/eafcc6ace2fb Part 1: Allow "Infinity" and "NaN" for canonical numeric index strings. r=jandem https://hg.mozilla.org/integration/autoland/rev/2c9bedcdac37 Part 2: Move IsInteger to jsnum.h to allow reusing it. r=jandem https://hg.mozilla.org/integration/autoland/rev/041413289d85 Part 3: Change StringIsTypedArrayIndex's return type to allow passing an error. r=jandem https://hg.mozilla.org/integration/autoland/rev/77c80b5f79ea Part 4: Allow numbers with fractional parts or exponents for canonical numeric indices. r=jandem https://hg.mozilla.org/integration/autoland/rev/055d1cad290a Part 5: Enable now passing test262 tests. r=jandem https://hg.mozilla.org/integration/autoland/rev/288125d24d23 Part 6: Add constant for maximum TypedArray length. r=jandem https://hg.mozilla.org/integration/autoland/rev/825e8843d0b1 Part 7: Add MTypedArrayIndexToInt32 for accessing TypedArrays with any Double index. r=jandem https://hg.mozilla.org/integration/autoland/rev/371d2efe156c Part 8: Handle TypedArray non-int32 indices in SetPropIRGenerator. r=jandem https://hg.mozilla.org/integration/autoland/rev/cbeae82d295c Part 9: Handle TypedArray non-int32 indices in HasPropIRGenerator. r=jandem https://hg.mozilla.org/integration/autoland/rev/7b07bb35e7b2 Part 10: Handle TypedArray non-int32 indices in GetPropIRGenerator. r=jandem
Comment 21•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/eafcc6ace2fb
https://hg.mozilla.org/mozilla-central/rev/2c9bedcdac37
https://hg.mozilla.org/mozilla-central/rev/041413289d85
https://hg.mozilla.org/mozilla-central/rev/77c80b5f79ea
https://hg.mozilla.org/mozilla-central/rev/055d1cad290a
https://hg.mozilla.org/mozilla-central/rev/288125d24d23
https://hg.mozilla.org/mozilla-central/rev/825e8843d0b1
https://hg.mozilla.org/mozilla-central/rev/371d2efe156c
https://hg.mozilla.org/mozilla-central/rev/cbeae82d295c
https://hg.mozilla.org/mozilla-central/rev/7b07bb35e7b2
Description
•