Skip to content

process: refactor the bootstrap mode branching for readability

This patch refactors the branches for choosing the mode to run Node.js in internal/bootstrap/node.js. Instead of inlining the decision making all in startup, we create a startExecution() function which either detects and start the non-user-code mode, or prepares for user code execution (worker setup, preloading modules) and starts user code execution. We use early returns when we decide the mode to run Node.js in for fewer indentations and better readability.

This patch also adds a few comments about the command-line switches and a few TODOs to remove underscore properties on process that are mainly used for bootstrap mode branching. It also includes a few other refactoring such as inlining functions/variables that are not reused and removing the default argument of evalScript for better clarity.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading