From 44a5fe145759a2fa43247da2f40a55df23572944 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 3 Dec 2018 00:49:12 +0800 Subject: process: specialize building and storage of process.config Instead of treating config.gypi as a JavaScript file, specialize the processing in js2c and make the serialized result a real JSON string (with 'true' and 'false' converted to boolean values) so we don't have to use a custom deserializer during bootstrap. In addition, store the JSON string separately in NativeModuleLoader, and keep it separate from the map of the builtin source code, so we don't have to put it onto `NativeModule._source` and delete it later, though we still preserve it in `process.binding('natives')`, which we don't use anymore. This patch also makes the map of builtin source code and the config.gypi string available through side-effect-free getters in C++. PR-URL: https://github.com/nodejs/node/pull/24816 Reviewed-By: Gus Caplan --- src/env.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/env.h') diff --git a/src/env.h b/src/env.h index ec0368e040..b46f45a0d2 100644 --- a/src/env.h +++ b/src/env.h @@ -138,6 +138,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(channel_string, "channel") \ V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite") \ V(code_string, "code") \ + V(config_string, "config") \ V(constants_string, "constants") \ V(cwd_string, "cwd") \ V(dest_string, "dest") \ @@ -307,7 +308,7 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2; V(write_host_object_string, "_writeHostObject") \ V(write_queue_size_string, "writeQueueSize") \ V(x_forwarded_string, "x-forwarded-for") \ - V(zero_return_string, "ZERO_RETURN") \ + V(zero_return_string, "ZERO_RETURN") #define ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) \ V(as_external, v8::External) \ -- cgit v1.2.3