worker: remove --experimental-worker flag

Having an experimental feature behind a flag makes change
if we are expecting significant breaking changes to its API.

Since the Worker API has been essentially stable since
its initial introduction, and no noticeable doubt about
possibly not keeping the feature around has been voiced,
removing the flag and thereby reducing the barrier to experimentation,
and consequently receiving feedback on the implementation,
seems like a good idea.

PR-URL: https://github.com/nodejs/node/pull/25361
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
Anna Henningsen 2019-01-06 01:52:16 +01:00
parent 8ec3c350f5
commit 63d4cae009
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
59 changed files with 19 additions and 89 deletions

View File

@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
script: ['benchmark/fixtures/require-cachable', 'test/fixtures/semicolon'],
mode: ['process', 'worker']
}, {
flags: ['--expose-internals', '--experimental-worker'] // for workers
flags: ['--expose-internals']
});
function spawnProcess(script) {

View File

@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
payload: ['string', 'object'],
sendsPerBroadcast: [1, 10],
n: [1e5]
}, { flags: ['--experimental-worker'] });
});
const workerPath = path.resolve(__dirname, '..', 'fixtures', 'echo.worker.js');

View File

@ -104,13 +104,6 @@ added: v9.6.0
Enable experimental ES Module support in the `vm` module.
### `--experimental-worker`
<!-- YAML
added: v10.5.0
-->
Enable experimental worker threads using the `worker_threads` module.
### `--force-fips`
<!-- YAML
added: v6.0.0
@ -620,7 +613,6 @@ Node.js options that are allowed are:
- `--experimental-modules`
- `--experimental-repl-await`
- `--experimental-vm-modules`
- `--experimental-worker`
- `--force-fips`
- `--icu-data-dir`
- `--inspect`

View File

@ -6,7 +6,7 @@
The `worker` module provides a way to create multiple environments running
on independent threads, and to create message channels between them. It
can be accessed using the `--experimental-worker` flag and:
can be accessed using:
```js
const worker = require('worker_threads');

View File

@ -94,9 +94,6 @@ keyword support in REPL.
.It Fl -experimental-vm-modules
Enable experimental ES module support in VM module.
.
.It Fl -experimental-worker
Enable experimental worker threads using worker_threads module.
.
.It Fl -force-fips
Force FIPS-compliant crypto on startup
(Cannot be disabled from script code).

View File

@ -253,8 +253,7 @@ if (config.exposeInternals) {
};
NativeModule.isInternal = function(id) {
return id.startsWith('internal/') ||
(id === 'worker_threads' && !config.experimentalWorker);
return id.startsWith('internal/');
};
}

View File

@ -187,9 +187,7 @@ function startup() {
setupQueueMicrotask();
}
if (getOptionValue('--experimental-worker')) {
setupDOMException();
}
setupDOMException();
// On OpenBSD process.execPath will be relative unless we
// get the full path before process.execPath is used.

View File

@ -9,8 +9,6 @@ const {
CHAR_HASH,
} = require('internal/constants');
const { getOptionValue } = require('internal/options');
// Invoke with makeRequireFunction(module) where |module| is the Module object
// to use as the context for the require() function.
function makeRequireFunction(mod) {
@ -100,14 +98,9 @@ const builtinLibs = [
'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'http2', 'https', 'net',
'os', 'path', 'perf_hooks', 'punycode', 'querystring', 'readline', 'repl',
'stream', 'string_decoder', 'tls', 'trace_events', 'tty', 'url', 'util',
'v8', 'vm', 'zlib'
'v8', 'vm', 'worker_threads', 'zlib'
];
if (getOptionValue('--experimental-worker')) {
builtinLibs.push('worker_threads');
builtinLibs.sort();
}
if (typeof internalBinding('inspector').open === 'function') {
builtinLibs.push('inspector');
builtinLibs.sort();

View File

@ -85,9 +85,6 @@ static void Initialize(Local<Object> target,
if (env->options()->experimental_vm_modules)
READONLY_TRUE_PROPERTY(target, "experimentalVMModules");
if (env->options()->experimental_worker)
READONLY_TRUE_PROPERTY(target, "experimentalWorker");
if (env->options()->experimental_repl_await)
READONLY_TRUE_PROPERTY(target, "experimentalREPLAwait");

View File

@ -109,10 +109,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"experimental ES Module support in vm module",
&EnvironmentOptions::experimental_vm_modules,
kAllowedInEnvironment);
AddOption("--experimental-worker",
"experimental threaded Worker support",
&EnvironmentOptions::experimental_worker,
kAllowedInEnvironment);
AddOption("--experimental-worker", "", NoOp{}, kAllowedInEnvironment);
AddOption("--expose-internals", "", &EnvironmentOptions::expose_internals);
AddOption("--http-parser",
"Select which HTTP parser to use; either 'legacy' or 'llhttp' "

View File

@ -96,7 +96,6 @@ class EnvironmentOptions : public Options {
bool experimental_modules = false;
bool experimental_repl_await = false;
bool experimental_vm_modules = false;
bool experimental_worker = false;
bool expose_internals = false;
std::string http_parser = "llhttp";
bool no_deprecation = false;

View File

@ -36,8 +36,7 @@ if (process.argv[2] === 'child') {
binding.leakHandle(0x42);
`, { eval: true });
} else {
const child = cp.spawnSync(process.execPath,
['--experimental-worker', __filename, 'child']);
const child = cp.spawnSync(process.execPath, [__filename, 'child']);
const stderr = child.stderr.toString();
assert.strictEqual(child.stdout.toString(), '');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../../common');
const assert = require('assert');
@ -11,7 +10,6 @@ if (process.argv[2] === 'child') {
new Worker(`require(${JSON.stringify(binding)});`, { eval: true });
} else {
const proc = child_process.spawnSync(process.execPath, [
'--experimental-worker',
__filename,
'child'
]);

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,4 @@
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
'use strict';
require('../common');
const { validateSnapshotNodes } = require('../common/heap');

View File

@ -1,5 +1,5 @@
'use strict';
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');
@ -15,8 +14,7 @@ if (isMainThread) {
process.chdir(tmpdir.path);
const proc = cp.spawn(process.execPath,
[ '--experimental-worker',
'--trace-event-categories', 'node',
[ '--trace-event-categories', 'node',
'-e', CODE ]);
proc.once('exit', common.mustCall(() => {
assert(fs.existsSync(FILE_NAME));

View File

@ -87,7 +87,6 @@ function nextdir() {
{
const coverageDirectory = path.join(tmpdir.path, nextdir());
const output = spawnSync(process.execPath, [
'--experimental-worker',
require.resolve('../fixtures/v8-coverage/worker')
], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } });
assert.strictEqual(output.status, 0);

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
@ -154,9 +153,9 @@ async function testBasicWorkerDebug(session, post) {
await workerSession.post('Debugger.enable');
await workerSession.post('Runtime.enable');
await workerSession.waitForBreakAfterCommand(
'Runtime.runIfWaitingForDebugger', __filename, 2);
'Runtime.runIfWaitingForDebugger', __filename, 1);
await workerSession.waitForBreakAfterCommand(
'Debugger.resume', __filename, 27); // V8 line number is zero-based
'Debugger.resume', __filename, 26); // V8 line number is zero-based
assert.strictEqual(await consolePromise, workerMessage);
workerSession.post('Debugger.resume');
await Promise.all([worker, detached, contextEvents]);

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');

View File

@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-modules
// Flags: --experimental-modules
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,4 @@
// Flags: --experimental-worker --experimental-wasm-threads
// Flags: --experimental-wasm-threads
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
require('../common');
const { Worker, MessageChannel } = require('worker_threads');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');

View File

@ -3,7 +3,6 @@
// listener from holding the event loop open. This test confirms that
// functionality.
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const { Worker, parentPort } = require('worker_threads');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const assert = require('assert');
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const path = require('path');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,4 +1,4 @@
// Flags: --expose-gc --experimental-worker
// Flags: --expose-gc
'use strict';
const common = require('../common');

View File

@ -1,4 +1,3 @@
// Flags: --experimental-worker
'use strict';
const common = require('../common');
const assert = require('assert');

View File

@ -1,6 +1,6 @@
'use strict';
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
require('../common');
const { WPTRunner } = require('../common/wpt');

View File

@ -1,6 +1,6 @@
'use strict';
// Flags: --expose-internals --experimental-worker
// Flags: --expose-internals
require('../common');
const { WPTRunner } = require('../common/wpt');

View File

@ -1588,7 +1588,6 @@ def Main():
if options.worker:
run_worker = join(workspace, "tools", "run-worker.js")
options.node_args.append('--experimental-worker')
options.node_args.append(run_worker)
shell = abspath(options.shell)