Closed Bug 1355554 Opened 5 years ago Closed 2 years ago

Atomics don't support wrapped TypedArrays

Categories

(Core :: JavaScript: Standard Library, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox55 --- wontfix
firefox78 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(7 files, 7 obsolete files)

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
Test case:
---
var g = newGlobal();
var ta = g.eval("new Int32Array(new SharedArrayBuffer(4))");
Atomics.add(ta, 0, 1);
---

Expected: No TypeError
Actual: Throws TypeError
Priority: -- → P3

Taking this bug, so I can use it for an Atomics overhaul to improve spec-compatibility.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

This is a bit faster, because it only requires a range check and not a
"is this double an integer" check.

Depends on D24074

Variable names were not updated to follow the spec when the spec uses single
letter names, for example if the current name is "timeout", but the spec uses
"t", the name was left unchanged for better code readability.

Depends on D24075

These methods were previously used for atomic operations on Uint8ClampedArray, but
this feature was removed some time ago.

Depends on D24076

And update Atomics.exchange to use AtomicReadModifyWrite per spec.

Depends on D24077

  • GetSharedTypedArray is ValidateSharedIntegerTypedArray in the spec
  • and GetTypedArrayIndex is ValidateAtomicAccess.

Depends on D24079

Depends on D24081

The switch-statements in CompareExchange, atomics_load, atomics_store, and
AtomicReadModifyWrite repeat the same type casts for each scalar type. Add
helper functions to reduce this code duplication.

Depends on D24086

Anba, do you want to land these?

Flags: needinfo?(andrebargull)

The patches need to be rewritten, because they no longer apply after the BigInt integration for Atomics.

Flags: needinfo?(andrebargull)
Attachment #9052077 - Attachment is obsolete: true
Attachment #9052079 - Attachment is obsolete: true
Attachment #9052081 - Attachment is obsolete: true
Attachment #9052083 - Attachment is obsolete: true
Attachment #9052085 - Attachment is obsolete: true
Attachment #9052089 - Attachment is obsolete: true
Attachment #9052090 - Attachment is obsolete: true
Attachment #9052078 - Attachment description: Bug 1355554 - Part 3: Add step comments and update some variable names to follow spec. r=jorendorff! → Bug 1355554 - Part 2: Add step comments and update some variable names to follow spec. r=jorendorff!
Attachment #9052080 - Attachment description: Bug 1355554 - Part 5: Rename AtomicsBinop to AtomicReadModifyWrite and remove macros. r=jorendorff! → Bug 1355554 - Part 3: Rename AtomicsBinop to AtomicReadModifyWrite and remove macros. r=jorendorff!
Attachment #9052082 - Attachment description: Bug 1355554 - Part 7: Rename GetSharedTypedArray and GetTypedArrayIndex per spec. r=jorendorff! → Bug 1355554 - Part 4: Rename GetSharedTypedArray and GetTypedArrayIndex per spec. r=jorendorff!
Attachment #9052086 - Attachment description: Bug 1355554 - Part 10: Replace byte-offset computation with call to TypedArrayObject::byteOffset(). r=jorendorff! → Bug 1355554 - Part 5: Replace byte-offset computation with call to TypedArrayObject::byteOffset(). r=jorendorff!
Attachment #9052087 - Attachment description: Bug 1355554 - Part 11: Remove Atomics functions from header file. r=jorendorff! → Bug 1355554 - Part 6: Remove Atomics functions from header file. r=jorendorff!
Attachment #9052088 - Attachment description: Bug 1355554 - Part 12: Remove outdated comments about atomics implementation details. r=jorendorff! → Bug 1355554 - Part 7: Remove outdated comments about atomics implementation details. r=jorendorff!
Pushed by abutkovits@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f81d65748d1f
Part 1: Handle cross-compartment wrappers in AtomicsObject. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/986b2ba8582f
Part 2: Add step comments and update some variable names to follow spec. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/bd174ee04205
Part 3: Rename AtomicsBinop to AtomicReadModifyWrite and remove macros. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/4f297a91c4cb
Part 4: Rename GetSharedTypedArray and GetTypedArrayIndex per spec. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/5ef0fd33df8f
Part 5: Replace byte-offset computation with call to TypedArrayObject::byteOffset(). r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/646b52cf410f
Part 6: Remove Atomics functions from header file. r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/b4607c8f4661
Part 7: Remove outdated comments about atomics implementation details. r=jorendorff
You need to log in before you can comment on or make changes to this bug.