Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/postamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function stackCheckInit() {
#endif

#if MAIN_READS_PARAMS
function run(args = arguments_) {
function run(args = programArgs) {
#else
function run() {
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/postlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function processModuleArgs()
checkIncomingModuleAPI();
#endif

{{{ makeModuleReceive('arguments_', 'arguments') }}}
{{{ makeModuleReceive('programArgs', 'arguments') }}}
{{{ makeModuleReceive('thisProgram') }}}

#if ASSERTIONS
Expand Down
8 changes: 4 additions & 4 deletions src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ if (ENVIRONMENT_IS_NODE) {
// refer to Module (if they choose; they can also define Module)
{{{ preJS() }}}

var arguments_ = [];
var programArgs = [];
var thisProgram = './this.program';
var quit_ = (status, toThrow) => {
throw toThrow;
Expand Down Expand Up @@ -215,7 +215,7 @@ if (ENVIRONMENT_IS_NODE) {
thisProgram = process.argv[1].replace(/\\/g, '/');
}

arguments_ = process.argv.slice(2);
programArgs = process.argv.slice(2);

#if !MODULARIZE
// MODULARIZE will export the module in the proper place outside, we don't need to export here
Expand Down Expand Up @@ -255,8 +255,8 @@ if (ENVIRONMENT_IS_SHELL) {

globalThis.clearTimeout ??= (id) => {};

// v8 uses `arguments_` whereas spidermonkey uses `scriptArgs`
arguments_ = globalThis.arguments || globalThis.scriptArgs;
// v8 and jsc both use `arguments`. spidermonkey uses `scriptArgs`
programArgs = globalThis.arguments ?? globalThis.scriptArgs;

if (globalThis.quit) {
quit_ = (status, toThrow) => {
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_file_preload.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Module["expectedDataFileDownloads"]++;
})();

// end include: <FILENAME REPLACED>
var arguments_ = [];
var programArgs = [];

var thisProgram = "./this.program";

Expand Down Expand Up @@ -209,7 +209,7 @@ if (ENVIRONMENT_IS_NODE) {
if (process.argv.length > 1) {
thisProgram = process.argv[1].replace(/\\/g, "/");
}
arguments_ = process.argv.slice(2);
programArgs = process.argv.slice(2);
// MODULARIZE will export the module in the proper place outside, we don't need to export here
if (typeof module != "undefined") {
module["exports"] = Module;
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_minimal_O0.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIR
// refer to Module (if they choose; they can also define Module)


var arguments_ = [];
var programArgs = [];
var thisProgram = './this.program';
var quit_ = (status, toThrow) => {
throw toThrow;
Expand Down Expand Up @@ -132,7 +132,7 @@ readAsync = async (filename, binary = true) => {
thisProgram = process.argv[1].replace(/\\/g, '/');
}

arguments_ = process.argv.slice(2);
programArgs = process.argv.slice(2);

// MODULARIZE will export the module in the proper place outside, we don't need to export here
if (typeof module != 'undefined') {
Expand Down
16 changes: 8 additions & 8 deletions test/codesize/test_unoptimized_code_size.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"hello_world.js": 57033,
"hello_world.js.gz": 17750,
"hello_world.js": 57036,
"hello_world.js.gz": 17754,
"hello_world.wasm": 14850,
"hello_world.wasm.gz": 7314,
"no_asserts.js": 26622,
"no_asserts.js.gz": 8888,
"no_asserts.js": 26625,
"no_asserts.js.gz": 8892,
"no_asserts.wasm": 12010,
"no_asserts.wasm.gz": 5880,
"strict.js": 54815,
"strict.js.gz": 17049,
"strict.js": 54817,
"strict.js.gz": 17051,
"strict.wasm": 14850,
"strict.wasm.gz": 7310,
"total": 180180,
"total_gz": 64191
"total": 180188,
"total_gz": 64201
}
4 changes: 2 additions & 2 deletions test/pthread/test_pthread_mandelbrot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void main_tick()
var updatesPerFrame = (new RegExp("[\\?&]updates=([^&#]*)")).exec(location.href);
if (updatesPerFrame) return updatesPerFrame[1];
}
if (arguments_ && arguments_.length >= 1) return parseInt(arguments_[0]);
if (programArgs && programArgs.length >= 1) return parseInt(programArgs[0]);
if (globalThis.document?.getElementById('updates_per_frame')) return parseInt(document.getElementById('updates_per_frame').value);
return 50;
});
Expand Down Expand Up @@ -605,7 +605,7 @@ int main(int argc, char** argv)
if (ENVIRONMENT_IS_WEB) {
emscripten_set_main_loop(main_tick, 0, 0);
} else {
int numTotalFrames = EM_ASM_INT(return (arguments_ && arguments_.length >= 2) ? parseInt(arguments_[1]) : 1000);
int numTotalFrames = EM_ASM_INT(return (programArgs && programArgs.length >= 2) ? parseInt(programArgs[1]) : 1000);
printf("Rendering %d frames of Mandelbrot. Invoke \"node|js mandelbrot.js numItersPerFrame numFrames\" to configure.\n", numTotalFrames);
double t0 = emscripten_get_now();
for(int i = 0; i < numTotalFrames; ++i) {
Expand Down
Loading