`Atomics` 对象提供了一组静态方法用来对 `SharedArrayBuffer` 对象进行原子操作。

这些原子操作属于 `Atomics` 模块。与一般的全局对象不同，`Atomics` 不是构造函数，因此不能使用 new 操作符调用，也不能将其当作函数直接调用。`Atomics` 的所有属性和方法都是静态的（与 `Math` 对象一样）。

## 属性

`Atomics[Symbol.toStringTag]`
  该属性的值为“Atomics”。

## 方法

### 原子操作

多个共享内存的线程能够同时读写同一位置上的数据。原子操作会确保正在读或写的数据的值是符合预期的，即下一个原子操作一定会在上一个原子操作结束后才会开始，其操作过程不会中断。

`Atomics.add()`
  将指定位置上的数组元素与给定的值相加，并返回相加前该元素的值。
`Atomics.and()`
  将指定位置上的数组元素与给定的值相与，并返回与操作前该元素的值。
`Atomics.compareExchange()`
  如果数组中指定的元素与给定的值相等，则将其更新为新的值，并返回该元素原先的值。
`Atomics.exchange()`
  将数组中指定的元素更新为给定的值，并返回该元素更新前的值。
`Atomics.load()`
  返回数组中指定元素的值。
`Atomics.or()`
  将指定位置上的数组元素与给定的值相或，并返回或操作前该元素的值。
`Atomics.store()`
  将数组中指定的元素设置为给定的值，并返回该值。
`Atomics.sub()`
  将指定位置上的数组元素与给定的值相减，并返回相减前该元素的值。
`Atomics.xor()`
  将指定位置上的数组元素与给定的值相异或，并返回异或操作前该元素的值。

### 等待和唤醒

`wait()` 和 `wake()` 方法采用的是 Linux 上的 futexes 模型（fast user-space mutex，快速用户空间互斥量），可以让进程一直等待直到某个特定的条件为真，主要用于实现阻塞。

`Atomics.wait()`
  检测数组中某个指定位置上的值是否仍然是给定值，是则保持挂起直到被唤醒或超时。返回值为 "`ok`"、"`not-equal`" 或 "`time-out`"。调用时，如果当前线程不允许阻塞，则会抛出异常（大多数浏览器都不允许在主线程中调用 `wait()`）。
`Atomics.wake()`
  唤醒等待队列中正在数组指定位置的元素上等待的线程。返回值为成功唤醒的线程数量。
`Atomics.isLockFree(size)`
  可以用来检测当前系统是否支持硬件级的原子操作。对于指定大小的数组，如果当前系统支持硬件级的原子操作，则返回 `true`；否则就意味着对于该数组，`Atomics` 对象中的各原子操作都只能用锁来实现。此函数面向的是技术专家。

## 规范

规范 | 状态 | 说明
--- | --- | ---
ECMAScript Latest Draft (ECMA-262) Atomics | Draft | ES2017 中的初始定义
ECMAScript 2017 (ECMA-262) Atomics | Standard |

## 浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

| Desktop | Mobile | Server
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | Node.js
`Atomics` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`add` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`and` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`compareExchange` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`exchange` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`isLockFree` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`load` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`notify` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Alternate Name Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. Alternate Name Uses the non-standard name: `wake` | Edge No support No Notes Alternate Name No support No Notes Alternate Name Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). Alternate Name Uses the non-standard name: `wake` | Firefox Full support 63 Notes Disabled Full support 63 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 63: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. Full support 57 Notes Alternate Name Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Alternate Name Uses the non-standard name: `wake` Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 48 — 55 Disabled Disabled From version 48 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 46 — 48 Notes Alternate Name Disabled Notes The `count` parameter defaults to `0` instead of the later-specified `+Infinity`. Alternate Name Uses the non-standard name: `futexWake` Disabled From version 46 until version 48 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? Alternate Name No support 10.1 — ? Alternate Name Alternate Name Uses the non-standard name: `wake` | WebView Android No support 60 — 63 Notes Alternate Name No support 60 — 63 Notes Alternate Name Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. Alternate Name Uses the non-standard name: `wake` | Chrome Android No support 60 — 63 Notes Alternate Name No support 60 — 63 Notes Alternate Name Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. Alternate Name Uses the non-standard name: `wake` | Edge Mobile ? | Firefox Android Full support 63 Notes Disabled Full support 63 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 63: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. Full support 57 Notes Alternate Name Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Alternate Name Uses the non-standard name: `wake` Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 48 — 55 Disabled Disabled From version 48 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 46 — 48 Notes Alternate Name Disabled Notes The `count` parameter defaults to `0` instead of the later-specified `+Infinity`. Alternate Name Uses the non-standard name: `futexWake` Disabled From version 46 until version 48 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0 Alternate Name Full support 8.10.0 Alternate Name Alternate Name Uses the non-standard name: `wake`
`or` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`store` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`sub` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled SharedArrayBuffer on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`wait` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 48 — 55 Disabled Disabled From version 48 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 46 — 48 Notes Alternate Name Disabled Notes The method returns values `Atomics.OK`, `Atomics.TIMEDOUT`, and `Atomics.NOTEQUAL`, instead of the later-specified strings. Alternate Name Uses the non-standard name: `futexWait` Disabled From version 46 until version 48 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 48 — 55 Disabled Disabled From version 48 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 46 — 48 Notes Alternate Name Disabled Notes The method returns values `Atomics.OK`, `Atomics.TIMEDOUT`, and `Atomics.NOTEQUAL`, instead of the later-specified strings. Alternate Name Uses the non-standard name: `futexWait` Disabled From version 46 until version 48 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0
`xor` | Chrome Full support 68 Full support 68 No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This was a temporary removal while mitigations were put in place. | Edge No support 16 — 17 Notes No support 16 — 17 Notes Notes Support was removed to mitigate speculative execution side-channel attacks (Windows blog). | Firefox Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | IE No support No | Opera No support No | Safari No support 10.1 — ? | WebView Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Chrome Android No support 60 — 63 Notes No support 60 — 63 Notes Notes Chrome disabled `SharedArrayBuffer` on January 5, 2018 to help reduce the efficacy of speculative side-channel attacks. This is intended as a temporary measure until other mitigations are in place. | Edge Mobile ? | Firefox Android Full support 57 Notes Disabled Full support 57 Notes Disabled Notes Support was disabled by default to mitigate speculative execution side-channel attacks (Mozilla Security Blog). Disabled From version 57: this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. No support 55 — 57 No support 46 — 55 Disabled Disabled From version 46 until version 55 (exclusive): this feature is behind the `javascript.options.shared_memory` preference (needs to be set to `true`). To change preferences in Firefox, visit about:config. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs Full support 8.10.0

### Legend

Full support
  Full support
No support
  No support
Compatibility unknown
  Compatibility unknown
See implementation notes.
  See implementation notes.
User must explicitly enable this feature.
  User must explicitly enable this feature.
Uses a non-standard name.
  Uses a non-standard name.

## 兼容性提示

直到 Firefox 48，最新的 API 名称和语意都还没有实现。FirFox 46 到 FireFox 48 之间主要有以下变化:

- 移除了方法 `Atomics.futexWakeOrRequeue()` 和 `Atomics.fence()` （bug(1259544)、bug(1225028)）。
- `Atomics.wait()` 和 `Atomics.wake()` 方法名称已改为 `Atomics.futexWait()` 和 `Atomics.futexWake()`（bug 1260910）。注意：之前的名称在 49 版本之后已被移除（bug 1262062）
- 移除了属性 `Atomics.OK`、 `Atomics.TIMEDOUT`、 `Atomics.NOTEQUAL`。`Atomics.wait()` 方法现在返回字符串 "ok"、"timed-out" 和 "not-equal" （bug 1260835）。

- `Atomics.wake()` 方法的 `count` 参数的默认值从 `0` 变为 `+Infinity`（bug 1253350）。

## 相关链接

- `ArrayBuffer`
- JavaScript typed arrays
- Web Workers
- parlib-simple – a simple library providing synchronization and work distribution abstractions.
- Shared Memory – a brief tutorial
- A Taste of JavaScript’s New Parallel Primitives – Mozilla Hacks