Skip to content

Commit edf46c1

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 629fc77 commit edf46c1

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/env.cc

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

333+
if (per_process::enabled_debug_list.enabled(DebugCategory::MKSNAPSHOT)) {
334+
fprintf(stderr, "deserializing IsolateDataSerializeInfo...\n");
335+
std::cerr << *info << "\n";
336+
}
337+
333338
#define VP(PropertyName, StringValue) V(Private, PropertyName)
334339
#define VY(PropertyName, StringValue) V(Symbol, PropertyName)
335340
#define VS(PropertyName, StringValue) V(String, PropertyName)
@@ -1648,6 +1653,11 @@ void Environment::RunDeserializeRequests() {
16481653
void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
16491654
Local<Context> ctx = context();
16501655

1656+
if (enabled_debug_list_.enabled(DebugCategory::MKSNAPSHOT)) {
1657+
fprintf(stderr, "deserializing EnvSerializeInfo...\n");
1658+
std::cerr << *info << "\n";
1659+
}
1660+
16511661
RunDeserializeRequests();
16521662

16531663
builtins_in_snapshot = info->builtins;
@@ -1661,11 +1671,6 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
16611671
should_abort_on_uncaught_toggle_.Deserialize(ctx);
16621672

16631673
principal_realm_->DeserializeProperties(&info->principal_realm);
1664-
1665-
if (enabled_debug_list_.enabled(DebugCategory::MKSNAPSHOT)) {
1666-
fprintf(stderr, "deserializing...\n");
1667-
std::cerr << *info << "\n";
1668-
}
16691674
}
16701675

16711676
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") \
@@ -386,7 +387,6 @@
386387
V(domexception_function, v8::Function) \
387388
V(enhance_fatal_stack_after_inspector, v8::Function) \
388389
V(enhance_fatal_stack_before_inspector, v8::Function) \
389-
V(fs_use_promises_symbol, v8::Symbol) \
390390
V(get_source_map_error_source, v8::Function) \
391391
V(host_import_module_dynamically_callback, v8::Function) \
392392
V(host_initialize_import_meta_object_callback, v8::Function) \

src/node_file.cc

+1-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ using v8::Object;
7070
using v8::ObjectTemplate;
7171
using v8::Promise;
7272
using v8::String;
73-
using v8::Symbol;
7473
using v8::Undefined;
7574
using v8::Value;
7675

@@ -2792,13 +2791,9 @@ void Initialize(Local<Object> target,
27922791
fdcloset->SetInternalFieldCount(FSReqBase::kInternalFieldCount);
27932792
env->set_fdclose_constructor_template(fdcloset);
27942793

2795-
Local<Symbol> use_promises_symbol =
2796-
Symbol::New(isolate,
2797-
FIXED_ONE_BYTE_STRING(isolate, "use promises"));
2798-
env->set_fs_use_promises_symbol(use_promises_symbol);
27992794
target->Set(context,
28002795
FIXED_ONE_BYTE_STRING(isolate, "kUsePromises"),
2801-
use_promises_symbol).Check();
2796+
env->fs_use_promises_symbol()).Check();
28022797
}
28032798

28042799
BindingData* FSReqBase::binding_data() {

0 commit comments

Comments
 (0)