module: inline try catch
Moving `try / catch` into separate functions is not necessary anymore due to V8 optimizations. PR-URL: https://github.com/nodejs/node/pull/26970 Refs: https://github.com/nodejs/node/pull/25362 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
ae9fae813e
commit
be577615c8
@ -595,13 +595,7 @@ Module._load = function(request, parent, isMain) {
|
|||||||
|
|
||||||
Module._cache[filename] = module;
|
Module._cache[filename] = module;
|
||||||
|
|
||||||
tryModuleLoad(module, filename);
|
let threw = true;
|
||||||
|
|
||||||
return module.exports;
|
|
||||||
};
|
|
||||||
|
|
||||||
function tryModuleLoad(module, filename) {
|
|
||||||
var threw = true;
|
|
||||||
try {
|
try {
|
||||||
module.load(filename);
|
module.load(filename);
|
||||||
threw = false;
|
threw = false;
|
||||||
@ -610,7 +604,9 @@ function tryModuleLoad(module, filename) {
|
|||||||
delete Module._cache[filename];
|
delete Module._cache[filename];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return module.exports;
|
||||||
|
};
|
||||||
|
|
||||||
Module._resolveFilename = function(request, parent, isMain, options) {
|
Module._resolveFilename = function(request, parent, isMain, options) {
|
||||||
if (NativeModule.canBeRequiredByUsers(request)) {
|
if (NativeModule.canBeRequiredByUsers(request)) {
|
||||||
|
@ -16,4 +16,3 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
|
@ -7,4 +7,3 @@ Trace: foo
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
|
@ -9,7 +9,6 @@ RangeError: Invalid input
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*:*)
|
at Module.load (internal/modules/cjs/loader.js:*:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
at internal/main/run_main_module.js:*:*
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -11,7 +11,6 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*:*)
|
at Module.load (internal/modules/cjs/loader.js:*:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
at internal/main/run_main_module.js:*:*
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -9,7 +9,6 @@ Error: foo:bar
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*:*)
|
at Module.load (internal/modules/cjs/loader.js:*:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
at internal/main/run_main_module.js:*:*
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -7,7 +7,6 @@ Error
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*:*)
|
at Module.load (internal/modules/cjs/loader.js:*:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
at internal/main/run_main_module.js:*:*
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -7,7 +7,6 @@ Error
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*:*)
|
at Module.load (internal/modules/cjs/loader.js:*:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
at internal/main/run_main_module.js:*:*
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -14,6 +14,6 @@ AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
at Module._compile (internal/modules/cjs/loader.js:*:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*:*)
|
at Module.load (internal/modules/cjs/loader.js:*:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -12,5 +12,5 @@ ReferenceError: foo is not defined
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at *..js (internal/modules/cjs/loader.js:*)
|
at *..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*:*)
|
||||||
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
(node:*) Error: This was rejected
|
(node:*) Error: This was rejected
|
||||||
at * (*test*message*unhandled_promise_trace_warnings.js:*)
|
at * (*test*message*unhandled_promise_trace_warnings.js:*)
|
||||||
at *
|
at *
|
||||||
@ -21,7 +20,6 @@
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
(node:*) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
|
(node:*) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
nested:
|
nested:
|
||||||
{ err:
|
{ err:
|
||||||
Error: foo
|
Error: foo
|
||||||
@ -20,7 +19,6 @@
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
{
|
{
|
||||||
err: Error: foo
|
err: Error: foo
|
||||||
bar
|
bar
|
||||||
@ -31,7 +29,6 @@
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
nested: {
|
nested: {
|
||||||
err: Error: foo
|
err: Error: foo
|
||||||
bar
|
bar
|
||||||
@ -42,7 +39,6 @@
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ Error: foo
|
{ Error: foo
|
||||||
@ -54,5 +50,4 @@ bar
|
|||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
at *
|
||||||
at *
|
|
||||||
foo: 'bar' }
|
foo: 'bar' }
|
||||||
|
@ -11,9 +11,9 @@ Error: boo!
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
test.vm:1
|
test.vm:1
|
||||||
throw new Error("spooky!")
|
throw new Error("spooky!")
|
||||||
^
|
^
|
||||||
@ -26,6 +26,6 @@ Error: spooky!
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -10,9 +10,9 @@ SyntaxError: Unexpected number
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
test.vm:1
|
test.vm:1
|
||||||
var 5;
|
var 5;
|
||||||
^
|
^
|
||||||
@ -24,6 +24,6 @@ SyntaxError: Unexpected number
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -12,6 +12,6 @@ Error: boo!
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
|
@ -12,6 +12,6 @@ SyntaxError: Unexpected number
|
|||||||
at Module._compile (internal/modules/cjs/loader.js:*)
|
at Module._compile (internal/modules/cjs/loader.js:*)
|
||||||
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
at Object.Module._extensions..js (internal/modules/cjs/loader.js:*)
|
||||||
at Module.load (internal/modules/cjs/loader.js:*)
|
at Module.load (internal/modules/cjs/loader.js:*)
|
||||||
at tryModuleLoad (internal/modules/cjs/loader.js:*:*)
|
|
||||||
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
at Function.Module._load (internal/modules/cjs/loader.js:*)
|
||||||
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
at Function.Module.runMain (internal/modules/cjs/loader.js:*)
|
||||||
|
at internal/main/run_main_module.js:*:*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user