From 15c0947fee2078bae4af1404e64448bf959a53bb Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sun, 31 Mar 2019 15:02:29 -0500 Subject: [PATCH] lib: remove Atomics.wake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/27033 Reviewed-By: Anatoli Papirovski Reviewed-By: Michaƫl Zasso Reviewed-By: Ruben Bridgewater Reviewed-By: Joyee Cheung --- lib/internal/per_context/setup.js | 39 ++++------------------------ test/parallel/test-atomics-notify.js | 19 -------------- 2 files changed, 5 insertions(+), 53 deletions(-) delete mode 100644 test/parallel/test-atomics-notify.js diff --git a/lib/internal/per_context/setup.js b/lib/internal/per_context/setup.js index 725ba403df2348..16bd7db586b156 100644 --- a/lib/internal/per_context/setup.js +++ b/lib/internal/per_context/setup.js @@ -5,40 +5,11 @@ 'use strict'; // https://github.com/nodejs/node/issues/14909 -if (global.Intl) delete global.Intl.v8BreakIterator; +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.Atomics) { + delete global.Atomics.wake; } - -global.Object.defineProperties(global.Atomics, { - wake: { - value: wake, - writable: true, - enumerable: false, - configurable: true, - }, -}); diff --git a/test/parallel/test-atomics-notify.js b/test/parallel/test-atomics-notify.js deleted file mode 100644 index 16dd1bb0c7dac1..00000000000000 --- a/test/parallel/test-atomics-notify.js +++ /dev/null @@ -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);