Skip to content

Commit a0da234

Browse files
joyeecheungtargos
authored andcommitted
fs: move fs_use_promises_symbol to per-isolate symbols
PR-URL: #47768 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent d6d12bf commit a0da234

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/env.cc

+10-5
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ void IsolateData::DeserializeProperties(const IsolateDataSerializeInfo* info) {
347347
size_t i = 0;
348348
HandleScope handle_scope(isolate_);
349349

350+
if (per_process::enabled_debug_list.enabled(DebugCategory::MKSNAPSHOT)) {
351+
fprintf(stderr, "deserializing IsolateDataSerializeInfo...\n");
352+
std::cerr << *info << "\n";
353+
}
354+
350355
#define VP(PropertyName, StringValue) V(Private, PropertyName)
351356
#define VY(PropertyName, StringValue) V(Symbol, PropertyName)
352357
#define VS(PropertyName, StringValue) V(String, PropertyName)
@@ -1704,6 +1709,11 @@ void Environment::RunDeserializeRequests() {
17041709
void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
17051710
Local<Context> ctx = context();
17061711

1712+
if (enabled_debug_list_.enabled(DebugCategory::MKSNAPSHOT)) {
1713+
fprintf(stderr, "deserializing EnvSerializeInfo...\n");
1714+
std::cerr << *info << "\n";
1715+
}
1716+
17071717
RunDeserializeRequests();
17081718

17091719
async_hooks_.Deserialize(ctx);
@@ -1716,11 +1726,6 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
17161726
should_abort_on_uncaught_toggle_.Deserialize(ctx);
17171727

17181728
principal_realm_->DeserializeProperties(&info->principal_realm);
1719-
1720-
if (enabled_debug_list_.enabled(DebugCategory::MKSNAPSHOT)) {
1721-
fprintf(stderr, "deserializing...\n");
1722-
std::cerr << *info << "\n";
1723-
}
17241729
}
17251730

17261731
uint64_t GuessMemoryAvailableToTheProcess() {

src/env_properties.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
// Symbols are per-isolate primitives but Environment proxies them
3131
// for the sake of convenience.
3232
#define PER_ISOLATE_SYMBOL_PROPERTIES(V) \
33+
V(fs_use_promises_symbol, "fs_use_promises_symbol") \
3334
V(async_id_symbol, "async_id_symbol") \
3435
V(handle_onclose_symbol, "handle_onclose") \
3536
V(no_message_symbol, "no_message_symbol") \
@@ -390,7 +391,6 @@
390391
V(domexception_function, v8::Function) \
391392
V(enhance_fatal_stack_after_inspector, v8::Function) \
392393
V(enhance_fatal_stack_before_inspector, v8::Function) \
393-
V(fs_use_promises_symbol, v8::Symbol) \
394394
V(get_source_map_error_source, v8::Function) \
395395
V(host_import_module_dynamically_callback, v8::Function) \
396396
V(host_initialize_import_meta_object_callback, v8::Function) \

src/node_file.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -2939,13 +2939,9 @@ void Initialize(Local<Object> target,
29392939
fdcloset->SetInternalFieldCount(FSReqBase::kInternalFieldCount);
29402940
env->set_fdclose_constructor_template(fdcloset);
29412941

2942-
Local<Symbol> use_promises_symbol =
2943-
Symbol::New(isolate,
2944-
FIXED_ONE_BYTE_STRING(isolate, "use promises"));
2945-
env->set_fs_use_promises_symbol(use_promises_symbol);
29462942
target->Set(context,
29472943
FIXED_ONE_BYTE_STRING(isolate, "kUsePromises"),
2948-
use_promises_symbol).Check();
2944+
env->fs_use_promises_symbol()).Check();
29492945
}
29502946

29512947
BindingData* FSReqBase::binding_data() {

0 commit comments

Comments
 (0)