File tree Expand file tree Collapse file tree 5 files changed +64
-30
lines changed Expand file tree Collapse file tree 5 files changed +64
-30
lines changed Original file line number Diff line number Diff line change 636636 'src/node_report_module.cc' ,
637637 'src/node_report_utils.cc' ,
638638 'src/node_serdes.cc' ,
639+ 'src/node_snapshotable.cc' ,
639640 'src/node_sockaddr.cc' ,
640641 'src/node_stat_watcher.cc' ,
641642 'src/node_symbols.cc' ,
738739 'src/node_report.h' ,
739740 'src/node_revert.h' ,
740741 'src/node_root_certs.h' ,
742+ 'src/node_snapshotable.h' ,
741743 'src/node_sockaddr.h' ,
742744 'src/node_sockaddr-inl.h' ,
743745 'src/node_stat_watcher.h' ,
Original file line number Diff line number Diff line change 55#include " node_external_reference.h"
66#include " node_internals.h"
77#include " node_options-inl.h"
8+ #include " node_snapshotable.h"
89#include " node_v8_platform-inl.h"
910#include " util-inl.h"
1011#if defined(LEAK_SANITIZER)
@@ -22,7 +23,6 @@ using v8::HandleScope;
2223using v8::Isolate;
2324using v8::Local;
2425using v8::Locker;
25- using v8::Object;
2626
2727std::unique_ptr<ExternalReferenceRegistry> NodeMainInstance::registry_ =
2828 nullptr ;
@@ -167,18 +167,6 @@ int NodeMainInstance::Run(const EnvSerializeInfo* env_info) {
167167 return exit_code;
168168}
169169
170- void DeserializeNodeInternalFields (Local<Object> holder,
171- int index,
172- v8::StartupData payload,
173- void * env) {
174- if (payload.raw_size == 0 ) {
175- holder->SetAlignedPointerInInternalField (index, nullptr );
176- return ;
177- }
178- // No embedder object in the builtin snapshot yet.
179- UNREACHABLE ();
180- }
181-
182170DeleteFnPtr<Environment, FreeEnvironment>
183171NodeMainInstance::CreateMainEnvironment (int * exit_code,
184172 const EnvSerializeInfo* env_info) {
Original file line number Diff line number Diff line change 1+
2+ #include " node_snapshotable.h"
3+ #include " base_object-inl.h"
4+
5+ namespace node {
6+
7+ using v8::Local;
8+ using v8::Object;
9+ using v8::StartupData;
10+
11+ void DeserializeNodeInternalFields (Local<Object> holder,
12+ int index,
13+ v8::StartupData payload,
14+ void * env) {
15+ if (payload.raw_size == 0 ) {
16+ holder->SetAlignedPointerInInternalField (index, nullptr );
17+ return ;
18+ }
19+ // No embedder object in the builtin snapshot yet.
20+ UNREACHABLE ();
21+ }
22+
23+ StartupData SerializeNodeContextInternalFields (Local<Object> holder,
24+ int index,
25+ void * env) {
26+ void * ptr = holder->GetAlignedPointerFromInternalField (index);
27+ if (ptr == nullptr || ptr == env) {
28+ return StartupData{nullptr , 0 };
29+ }
30+ if (ptr == env && index == ContextEmbedderIndex::kEnvironment ) {
31+ return StartupData{nullptr , 0 };
32+ }
33+
34+ // No embedder objects in the builtin snapshot yet.
35+ UNREACHABLE ();
36+ return StartupData{nullptr , 0 };
37+ }
38+
39+ } // namespace node
Original file line number Diff line number Diff line change 1+
2+ #ifndef SRC_NODE_SNAPSHOTABLE_H_
3+ #define SRC_NODE_SNAPSHOTABLE_H_
4+
5+ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6+
7+ #include " v8.h"
8+ namespace node {
9+
10+ v8::StartupData SerializeNodeContextInternalFields (v8::Local<v8::Object> holder,
11+ int index,
12+ void * env);
13+ void DeserializeNodeInternalFields (v8::Local<v8::Object> holder,
14+ int index,
15+ v8::StartupData payload,
16+ void * env);
17+ } // namespace node
18+
19+ #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
20+
21+ #endif // SRC_NODE_SNAPSHOTABLE_H_
Original file line number Diff line number Diff line change 66#include " node_external_reference.h"
77#include " node_internals.h"
88#include " node_main_instance.h"
9+ #include " node_snapshotable.h"
910#include " node_v8_platform-inl.h"
1011
1112namespace node {
@@ -14,7 +15,6 @@ using v8::Context;
1415using v8::HandleScope;
1516using v8::Isolate;
1617using v8::Local;
17- using v8::Object;
1818using v8::SnapshotCreator;
1919using v8::StartupData;
2020
@@ -75,22 +75,6 @@ const EnvSerializeInfo* NodeMainInstance::GetEnvSerializeInfo() {
7575 return ss.str ();
7676}
7777
78- static StartupData SerializeNodeContextInternalFields (Local<Object> holder,
79- int index,
80- void * env) {
81- void * ptr = holder->GetAlignedPointerFromInternalField (index);
82- if (ptr == nullptr || ptr == env) {
83- return StartupData{nullptr , 0 };
84- }
85- if (ptr == env && index == ContextEmbedderIndex::kEnvironment ) {
86- return StartupData{nullptr , 0 };
87- }
88-
89- // No embedder objects in the builtin snapshot yet.
90- UNREACHABLE ();
91- return StartupData{nullptr , 0 };
92- }
93-
9478std::string SnapshotBuilder::Generate (
9579 const std::vector<std::string> args,
9680 const std::vector<std::string> exec_args) {
You can’t perform that action at this time.
0 commit comments