Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2022-03-15 12:30:12 +0300
committerJoyee Cheung <joyeec9h3@gmail.com>2022-03-23 15:20:14 +0300
commitbfb4ca8e94b2fda66c8adf048b9ac36c3c432e7f (patch)
treebe8afac219fd3ce01363a3369fa93166b658bb4e /src/node.cc
parentc37fdacb348fa8f735f0c01fdfb0eefe6152dd34 (diff)
bootstrap: use SnapshotData to pass snapshot data around
Instead of passing the snapshot blob, the per-isolate data indices and the EnvSerializeInfo separately, use the aggregate type Snapshot to carry these around, and refactor NodeMainInstance so that it owns the v8::Isolate::CreateParams when it owns its isolate. This also gets rid of the owns_isolate_ and deserialize_mode_ booleans in NodeMainInstance since NodeMainInstance can compute these by just checking if it has pointers to the CreateParams or the SnapshotData. PR-URL: https://github.com/nodejs/node/pull/42360 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/node.cc b/src/node.cc
index a85a5f63259..e503fd9f5b4 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1154,28 +1154,19 @@ int Start(int argc, char** argv) {
}
{
- Isolate::CreateParams params;
- const std::vector<size_t>* indices = nullptr;
- const EnvSerializeInfo* env_info = nullptr;
bool use_node_snapshot =
per_process::cli_options->per_isolate->node_snapshot;
- if (use_node_snapshot) {
- v8::StartupData* blob = NodeMainInstance::GetEmbeddedSnapshotBlob();
- if (blob != nullptr) {
- params.snapshot_blob = blob;
- indices = NodeMainInstance::GetIsolateDataIndices();
- env_info = NodeMainInstance::GetEnvSerializeInfo();
- }
- }
+ const SnapshotData* snapshot_data =
+ use_node_snapshot ? NodeMainInstance::GetEmbeddedSnapshotData()
+ : nullptr;
uv_loop_configure(uv_default_loop(), UV_METRICS_IDLE_TIME);
- NodeMainInstance main_instance(&params,
+ NodeMainInstance main_instance(snapshot_data,
uv_default_loop(),
per_process::v8_platform.Platform(),
result.args,
- result.exec_args,
- indices);
- result.exit_code = main_instance.Run(env_info);
+ result.exec_args);
+ result.exit_code = main_instance.Run();
}
TearDownOncePerProcess();