2018-11-26 14:50:19 +01:00
|
|
|
// arguments: global
|
|
|
|
|
2018-06-25 09:08:27 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// node::NewContext calls this script
|
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
// https://github.com/nodejs/node/issues/14909
|
|
|
|
if (global.Intl) delete global.Intl.v8BreakIterator;
|
2018-06-25 09:08:27 +02:00
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
// 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.
|
2018-06-25 09:14:59 +02:00
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
const AtomicsNotify = global.Atomics.notify;
|
|
|
|
const ReflectApply = global.Reflect.apply;
|
2018-06-25 09:14:59 +02:00
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
const warning = 'Atomics.wake will be removed in a future version, ' +
|
|
|
|
'use Atomics.notify instead.';
|
2018-06-25 09:14:59 +02:00
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
let wakeWarned = false;
|
|
|
|
function wake(typedArray, index, count) {
|
|
|
|
if (!wakeWarned) {
|
|
|
|
wakeWarned = true;
|
2018-06-25 09:14:59 +02:00
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
if (global.process !== undefined) {
|
|
|
|
global.process.emitWarning(warning, 'Atomics');
|
|
|
|
} else {
|
|
|
|
global.console.error(`Atomics: ${warning}`);
|
2018-06-25 09:14:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-26 14:50:19 +01:00
|
|
|
return ReflectApply(AtomicsNotify, this, arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
global.Object.defineProperties(global.Atomics, {
|
|
|
|
wake: {
|
|
|
|
value: wake,
|
|
|
|
writable: true,
|
|
|
|
enumerable: false,
|
|
|
|
configurable: true,
|
|
|
|
},
|
|
|
|
});
|