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>2020-04-21 23:10:10 +0300
committerJoyee Cheung <joyeec9h3@gmail.com>2020-07-18 06:23:13 +0300
commit7ecb285842361de721a9d7c7d2a0535170b132dd (patch)
tree6b9b4c90ec7cfd3c8b9e7cbe41461d1dc1258a74 /src/env.cc
parent1faf6f459f220bb67866f12b30626ef7856876ee (diff)
src: make code cache test work with snapshots
Keep track of snapshotted modules in JS land, and move bootstrap switches into StartExecution() so that they are not included into part of the environment-independent bootstrap process. PR-URL: https://github.com/nodejs/node/pull/32984 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'src/env.cc')
-rw-r--r--src/env.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/env.cc b/src/env.cc
index e30e7d6e1da..1cf37d4fa91 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -1208,6 +1208,11 @@ EnvSerializeInfo Environment::Serialize(SnapshotCreator* creator) {
EnvSerializeInfo info;
Local<Context> ctx = context();
+ // Currently all modules are compiled without cache in builtin snapshot
+ // builder.
+ info.native_modules = std::vector<std::string>(
+ native_modules_without_cache.begin(), native_modules_without_cache.end());
+
info.async_hooks = async_hooks_.Serialize(ctx, creator);
info.immediate_info = immediate_info_.Serialize(ctx, creator);
info.tick_info = tick_info_.Serialize(ctx, creator);
@@ -1257,11 +1262,24 @@ std::ostream& operator<<(std::ostream& output,
return output;
}
+std::ostream& operator<<(std::ostream& output,
+ const std::vector<std::string>& vec) {
+ output << "{\n";
+ for (const auto& info : vec) {
+ output << " \"" << info << "\",\n";
+ }
+ output << "}";
+ return output;
+}
+
std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
output << "{\n"
+ << "// -- native_modules begins --\n"
+ << i.native_modules << ",\n"
+ << "// -- native_modules ends --\n"
<< "// -- async_hooks begins --\n"
<< i.async_hooks << ",\n"
- << "// -- async_hooks begins --\n"
+ << "// -- async_hooks ends --\n"
<< i.tick_info << ", // tick_info\n"
<< i.immediate_info << ", // immediate_info\n"
<< "// -- performance_state begins --\n"
@@ -1284,6 +1302,7 @@ std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& i) {
void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
Local<Context> ctx = context();
+ native_modules_in_snapshot = info->native_modules;
async_hooks_.Deserialize(ctx);
immediate_info_.Deserialize(ctx);
tick_info_.Deserialize(ctx);