File tree 5 files changed +64
-30
lines changed
5 files changed +64
-30
lines changed Original file line number Diff line number Diff line change 641
641
'src/node_report_module.cc' ,
642
642
'src/node_report_utils.cc' ,
643
643
'src/node_serdes.cc' ,
644
+ 'src/node_snapshotable.cc' ,
644
645
'src/node_sockaddr.cc' ,
645
646
'src/node_stat_watcher.cc' ,
646
647
'src/node_symbols.cc' ,
743
744
'src/node_report.h' ,
744
745
'src/node_revert.h' ,
745
746
'src/node_root_certs.h' ,
747
+ 'src/node_snapshotable.h' ,
746
748
'src/node_sockaddr.h' ,
747
749
'src/node_sockaddr-inl.h' ,
748
750
'src/node_stat_watcher.h' ,
Original file line number Diff line number Diff line change 5
5
#include " node_external_reference.h"
6
6
#include " node_internals.h"
7
7
#include " node_options-inl.h"
8
+ #include " node_snapshotable.h"
8
9
#include " node_v8_platform-inl.h"
9
10
#include " util-inl.h"
10
11
#if defined(LEAK_SANITIZER)
@@ -22,7 +23,6 @@ using v8::HandleScope;
22
23
using v8::Isolate;
23
24
using v8::Local;
24
25
using v8::Locker;
25
- using v8::Object;
26
26
27
27
std::unique_ptr<ExternalReferenceRegistry> NodeMainInstance::registry_ =
28
28
nullptr ;
@@ -167,18 +167,6 @@ int NodeMainInstance::Run(const EnvSerializeInfo* env_info) {
167
167
return exit_code;
168
168
}
169
169
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
-
182
170
DeleteFnPtr<Environment, FreeEnvironment>
183
171
NodeMainInstance::CreateMainEnvironment (int * exit_code,
184
172
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_SERIALIZABLE_H_
3
+ #define SRC_NODE_SERIALIZABLE_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_SERIALIZABLE_H_
Original file line number Diff line number Diff line change 6
6
#include " node_external_reference.h"
7
7
#include " node_internals.h"
8
8
#include " node_main_instance.h"
9
+ #include " node_snapshotable.h"
9
10
#include " node_v8_platform-inl.h"
10
11
11
12
namespace node {
@@ -14,7 +15,6 @@ using v8::Context;
14
15
using v8::HandleScope;
15
16
using v8::Isolate;
16
17
using v8::Local;
17
- using v8::Object;
18
18
using v8::SnapshotCreator;
19
19
using v8::StartupData;
20
20
@@ -75,22 +75,6 @@ const EnvSerializeInfo* NodeMainInstance::GetEnvSerializeInfo() {
75
75
return ss.str ();
76
76
}
77
77
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
-
94
78
std::string SnapshotBuilder::Generate (
95
79
const std::vector<std::string> args,
96
80
const std::vector<std::string> exec_args) {
You can’t perform that action at this time.
0 commit comments