lib: remove Atomics.wake
PR-URL: https://github.com/nodejs/node/pull/27033 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
9dba96dc1a
commit
15c0947fee
@ -5,40 +5,11 @@
|
||||
'use strict';
|
||||
|
||||
// https://github.com/nodejs/node/issues/14909
|
||||
if (global.Intl) delete global.Intl.v8BreakIterator;
|
||||
|
||||
// https://github.com/nodejs/node/issues/21219
|
||||
// Adds Atomics.notify and warns on first usage of Atomics.wake
|
||||
// https://github.com/v8/v8/commit/c79206b363 adds Atomics.notify so
|
||||
// now we alias Atomics.wake to notify so that we can remove it
|
||||
// semver major without worrying about V8.
|
||||
|
||||
const AtomicsNotify = global.Atomics.notify;
|
||||
const ReflectApply = global.Reflect.apply;
|
||||
|
||||
const warning = 'Atomics.wake will be removed in a future version, ' +
|
||||
'use Atomics.notify instead.';
|
||||
|
||||
let wakeWarned = false;
|
||||
function wake(typedArray, index, count) {
|
||||
if (!wakeWarned) {
|
||||
wakeWarned = true;
|
||||
|
||||
if (global.process !== undefined) {
|
||||
global.process.emitWarning(warning, 'Atomics');
|
||||
} else {
|
||||
global.console.error(`Atomics: ${warning}`);
|
||||
}
|
||||
}
|
||||
|
||||
return ReflectApply(AtomicsNotify, this, arguments);
|
||||
if (global.Intl) {
|
||||
delete global.Intl.v8BreakIterator;
|
||||
}
|
||||
|
||||
global.Object.defineProperties(global.Atomics, {
|
||||
wake: {
|
||||
value: wake,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
},
|
||||
});
|
||||
// https://github.com/nodejs/node/issues/21219
|
||||
if (global.Atomics) {
|
||||
delete global.Atomics.wake;
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const { expectWarning } = require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const { runInNewContext } = require('vm');
|
||||
|
||||
assert.strictEqual(typeof Atomics.wake, 'function');
|
||||
assert.strictEqual(typeof Atomics.notify, 'function');
|
||||
|
||||
assert.strictEqual(runInNewContext('typeof Atomics.wake'), 'function');
|
||||
assert.strictEqual(runInNewContext('typeof Atomics.notify'), 'function');
|
||||
|
||||
expectWarning(
|
||||
'Atomics',
|
||||
'Atomics.wake will be removed in a future version, ' +
|
||||
'use Atomics.notify instead.');
|
||||
|
||||
Atomics.wake(new Int32Array(new SharedArrayBuffer(4)), 0, 0);
|
Loading…
x
Reference in New Issue
Block a user