https://bugs.webkit.org/show_bug.cgi?id=192190
<rdar://problem/
46375715>
Reviewed by Keith Miller.
JSTests:
* stress/simple-module.mjs: Added.
* stress/simple-script.js: Added.
Source/JavaScriptCore:
Treat files with a .mjs extension as a module, regardless
of whether or not the --module-file argument was given.
* jsc.cpp:
(printUsageStatement): Update usage.
(isMJSFile): Helper to look for .mjs extensions.
(CommandLine::parseArguments): Pick the appropriate script type.
Tools:
Add .mjs files to the regexp looking for all JS files.
* Scripts/run-jsc-stress-tests:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238753
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-11-30 Dean Jackson <dino@apple.com>
+
+ Add first-class support for .mjs files in jsc binary
+ https://bugs.webkit.org/show_bug.cgi?id=192190
+ <rdar://problem/46375715>
+
+ Reviewed by Keith Miller.
+
+ * stress/simple-module.mjs: Added.
+ * stress/simple-script.js: Added.
+
2018-11-30 Caio Lima <ticaiolima@gmail.com>
[BigInt] Implement ValueBitXor into DFG
--- /dev/null
+if (this !== undefined)
+ throw new Error("this === undefined in module code");
--- /dev/null
+if (this === undefined)
+ throw new Error("this !== undefined in script code");
+2018-11-30 Dean Jackson <dino@apple.com>
+
+ Add first-class support for .mjs files in jsc binary
+ https://bugs.webkit.org/show_bug.cgi?id=192190
+ <rdar://problem/46375715>
+
+ Reviewed by Keith Miller.
+
+ Treat files with a .mjs extension as a module, regardless
+ of whether or not the --module-file argument was given.
+
+ * jsc.cpp:
+ (printUsageStatement): Update usage.
+ (isMJSFile): Helper to look for .mjs extensions.
+ (CommandLine::parseArguments): Pick the appropriate script type.
+
2018-11-30 Caio Lima <ticaiolima@gmail.com>
[BigInt] Implement ValueBitXor into DFG
fprintf(stderr, " --dumpOptions Dumps all non-default JSC VM options before continuing\n");
fprintf(stderr, " --<jsc VM option>=<value> Sets the specified JSC VM option\n");
fprintf(stderr, "\n");
+ fprintf(stderr, "Files with a .mjs extension will always be evaluated as modules.\n");
+ fprintf(stderr, "\n");
jscExit(help ? EXIT_SUCCESS : EXIT_FAILURE);
}
+static bool isMJSFile(char *filename)
+{
+ filename = strrchr(filename, '.');
+
+ if (filename)
+ return !strcasecmp(filename, ".mjs");
+
+ return false;
+}
+
void CommandLine::parseArguments(int argc, char** argv)
{
Options::initialize();
// This arg is not recognized by the VM nor by jsc. Pass it on to the
// script.
- m_scripts.append(Script(Script::StrictMode::Sloppy, Script::CodeSource::File, Script::ScriptType::Script, argv[i]));
+ Script::ScriptType scriptType = isMJSFile(argv[i]) ? Script::ScriptType::Module : Script::ScriptType::Script;
+ m_scripts.append(Script(Script::StrictMode::Sloppy, Script::CodeSource::File, scriptType, argv[i]));
}
if (hasBadJSCOptions && JSC::Options::validateOptions())
+2018-11-30 Dean Jackson <dino@apple.com>
+
+ Add first-class support for .mjs files in jsc binary
+ https://bugs.webkit.org/show_bug.cgi?id=192190
+ <rdar://problem/46375715>
+
+ Reviewed by Keith Miller.
+
+ Add .mjs files to the regexp looking for all JS files.
+
+ * Scripts/run-jsc-stress-tests:
+
2018-11-30 Jonathan Bedard <jbedard@apple.com>
webkitpy: Use DeviceType instead of str to represent device class
result = []
Dir.foreach(path) {
| filename |
- next unless filename =~ /\.js$/
+ next unless filename =~ /\.m?js$/
next unless (path + filename).file?
result << path + filename
}