Skip to content

lib: prefer Atomics primordials #58577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/internal/test_runner/mock/loader.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';
const {
AtomicsNotify,
AtomicsStore,
JSONStringify,
SafeMap,
globalThis: {
Atomics: {
notify: AtomicsNotify,
store: AtomicsStore,
},
},
} = primordials;
const {
kBadExportsMessage,
Expand Down
6 changes: 2 additions & 4 deletions lib/internal/test_runner/mock/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
const {
ArrayPrototypePush,
ArrayPrototypeSlice,
AtomicsStore,
AtomicsWait,
Error,
FunctionPrototypeBind,
FunctionPrototypeCall,
Expand All @@ -18,10 +20,6 @@ const {
StringPrototypeSlice,
StringPrototypeStartsWith,
globalThis: {
Atomics: {
store: AtomicsStore,
wait: AtomicsWait,
},
SharedArrayBuffer,
},
} = primordials;
Expand Down
13 changes: 13 additions & 0 deletions typings/primordials.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ declare namespace primordials {
export import decodeURIComponent = globalThis.decodeURIComponent;
export import encodeURI = globalThis.encodeURI;
export import encodeURIComponent = globalThis.encodeURIComponent;
export const AtomicsAdd: typeof Atomics.add
export const AtomicsAnd: typeof Atomics.and
export const AtomicsCompareExchange: typeof Atomics.compareExchange
export const AtomicsExchange: typeof Atomics.exchange
export const AtomicsIsLockFree: typeof Atomics.isLockFree
export const AtomicsLoad: typeof Atomics.load
export const AtomicsNotify: typeof Atomics.notify
export const AtomicsOr: typeof Atomics.or
export const AtomicsStore: typeof Atomics.store
export const AtomicsSub: typeof Atomics.sub
export const AtomicsWait: typeof Atomics.wait
export const AtomicsWaitAsync: typeof Atomics.waitAsync
export const AtomicsXor: typeof Atomics.xor
export const JSONParse: typeof JSON.parse
export const JSONStringify: typeof JSON.stringify
export const MathAbs: typeof Math.abs
Expand Down
Loading