Browse Source

module: avoid ArgumentsAdaptorTrampoline frame

Avoid an unneeded ArgumentsAdaptorTrampoline stack frame by passing the
the right number of arguments to Module._load() in Module.require().
Shortens the following stack trace with one frame:

    LazyCompile:~Module.load module.js:345
    LazyCompile:Module._load module.js:282
    Builtin:ArgumentsAdaptorTrampoline
    LazyCompile:*Module.require module.js:361
    LazyCompile:*require internal/module.js:11

PR-URL: https://github.com/nodejs/node/pull/4575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
process-exit-stdio-flushing
Ben Noordhuis 9 years ago
committed by James M Snell
parent
commit
038b636562
  1. 2
      lib/module.js

2
lib/module.js

@ -374,7 +374,7 @@ Module.prototype.load = function(filename) {
Module.prototype.require = function(path) { Module.prototype.require = function(path) {
assert(path, 'missing path'); assert(path, 'missing path');
assert(typeof path === 'string', 'path must be a string'); assert(typeof path === 'string', 'path must be a string');
return Module._load(path, this); return Module._load(path, this, /* isMain */ false);
}; };

Loading…
Cancel
Save