Atomics.load() and friends should check the TypedArray type before coercing the `index` argument
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: jorendorff, Assigned: lth)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
The first two steps of AtomicReadModifyWrite are:
- Let buffer be ? ValidateSharedIntegerTypedArray(typedArray).
- Let i be ? ValidateAtomicAccess(typedArray, index).
We fail some test262 tests checking the order of these two steps.
Reporter | ||
Comment 1•5 years ago
|
||
I don't know if this really blocks shipping SAB, but adding the dep so it gets looked at.
Reporter | ||
Comment 2•5 years ago
|
||
The tests that fail are:
test262/built-ins/Atomics/add/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/and/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/compareExchange/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/exchange/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/load/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/or/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/store/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/sub/validate-arraytype-before-index-coercion.js
test262/built-ins/Atomics/xor/validate-arraytype-before-index-coercion.js
Assignee | ||
Comment 3•5 years ago
|
||
That's weird, because the code in builtins/AtomicsObject.cpp has these tests in the right order, as does the code in MCallOptimize.cpp...
Assignee | ||
Comment 4•5 years ago
|
||
I see, the problem is that in order to avoid dispatching on type twice, we first check whether it's a shared TypedArray, then convert the index, and only then filter for the element type of the array. The filtering for the element type needs to happen during the first step.
This totally does not block shipping SAB, but it's not a problem for it to hang off that bug, I think. I'll fix it this week.
Assignee | ||
Comment 5•5 years ago
|
||
Spec compliance requires us to check the element type of the TypedArray at the same time
as we check it's a shared TypedArray, not later. This results in some tests being done
twice, but only for the slow C++ path.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
bugherder |
Description
•