17
17
#include < openssl/rsa.h>
18
18
#include < openssl/rand.h>
19
19
#endif
20
+ #include < type_traits> // injected code may refer to std::underlying_type
20
21
21
22
using namespace node ;
22
23
using namespace v8 ;
@@ -33,6 +34,11 @@ using namespace v8;
33
34
#define NODE_VERSION_SUPPORTS_EMBEDDER_SNAPSHOT 1
34
35
#endif
35
36
37
+ // Snapshot config is supported since https://github.com/nodejs/node/pull/50453
38
+ #if NODE_VERSION_AT_LEAST(21, 6, 0) && !defined(BOXEDNODE_SNAPSHOT_CONFIG_FLAGS)
39
+ #define BOXEDNODE_SNAPSHOT_CONFIG_FLAGS (SnapshotFlags::kWithoutCodeCache )
40
+ #endif
41
+
36
42
// 18.1.0 is the current minimum version that has https://github.com/nodejs/node/pull/42809,
37
43
// which introduced crashes when using workers, and later 18.9.0 is the current
38
44
// minimum version to contain https://github.com/nodejs/node/pull/44252, which
@@ -167,7 +173,15 @@ static int RunNodeInstance(MultiIsolatePlatform* platform,
167
173
int exit_code = 0 ;
168
174
std::vector<std::string> errors;
169
175
std::unique_ptr<CommonEnvironmentSetup> setup =
170
- CommonEnvironmentSetup::CreateForSnapshotting (platform, &errors, args, exec_args);
176
+ CommonEnvironmentSetup::CreateForSnapshotting (
177
+ platform,
178
+ &errors,
179
+ args,
180
+ exec_args
181
+ #ifdef BOXEDNODE_SNAPSHOT_CONFIG_FLAGS
182
+ , SnapshotConfig { BOXEDNODE_SNAPSHOT_CONFIG_FLAGS, std::nullopt }
183
+ #endif
184
+ );
171
185
172
186
Isolate* isolate = setup->isolate ();
173
187
0 commit comments