src: flip Atomics.notify alias

PR-URL: https://github.com/nodejs/node/pull/22844
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
This commit is contained in:
Gus Caplan 2018-09-13 12:03:17 -05:00
parent 8d7aa2167f
commit a7b59d6204
No known key found for this signature in database
GPG Key ID: F00BD11880E82F0E

View File

@ -8,20 +8,18 @@
// 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 AtomicsWake = global.Atomics.wake;
const AtomicsNotify = global.Atomics.notify;
const ReflectApply = global.Reflect.apply;
// wrap for function.name
function notify(...args) {
return ReflectApply(AtomicsWake, this, args);
}
const warning = 'Atomics.wake will be removed in a future version, ' +
'use Atomics.notify instead.';
let wakeWarned = false;
function wake(...args) {
function wake(typedArray, index, count) {
if (!wakeWarned) {
wakeWarned = true;
@ -32,16 +30,10 @@
}
}
return ReflectApply(AtomicsWake, this, args);
return ReflectApply(AtomicsNotify, this, arguments);
}
global.Object.defineProperties(global.Atomics, {
notify: {
value: notify,
writable: true,
enumerable: false,
configurable: true,
},
wake: {
value: wake,
writable: true,