fs: move fs_use_promises_symbol to per-isolate symbols

PR-URL: https://github.com/nodejs/node/pull/47768
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
This commit is contained in:
Joyee Cheung 2023-04-28 18:11:45 +02:00 committed by Node.js GitHub Bot
parent f82606a727
commit 19366066e1
3 changed files with 12 additions and 11 deletions

View File

@ -347,6 +347,11 @@ void IsolateData::DeserializeProperties(const IsolateDataSerializeInfo* info) {
size_t i = 0;
HandleScope handle_scope(isolate_);
if (per_process::enabled_debug_list.enabled(DebugCategory::MKSNAPSHOT)) {
fprintf(stderr, "deserializing IsolateDataSerializeInfo...\n");
std::cerr << *info << "\n";
}
#define VP(PropertyName, StringValue) V(Private, PropertyName)
#define VY(PropertyName, StringValue) V(Symbol, PropertyName)
#define VS(PropertyName, StringValue) V(String, PropertyName)
@ -1704,6 +1709,11 @@ void Environment::RunDeserializeRequests() {
void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
Local<Context> ctx = context();
if (enabled_debug_list_.enabled(DebugCategory::MKSNAPSHOT)) {
fprintf(stderr, "deserializing EnvSerializeInfo...\n");
std::cerr << *info << "\n";
}
RunDeserializeRequests();
async_hooks_.Deserialize(ctx);
@ -1716,11 +1726,6 @@ void Environment::DeserializeProperties(const EnvSerializeInfo* info) {
should_abort_on_uncaught_toggle_.Deserialize(ctx);
principal_realm_->DeserializeProperties(&info->principal_realm);
if (enabled_debug_list_.enabled(DebugCategory::MKSNAPSHOT)) {
fprintf(stderr, "deserializing...\n");
std::cerr << *info << "\n";
}
}
uint64_t GuessMemoryAvailableToTheProcess() {

View File

@ -30,6 +30,7 @@
// Symbols are per-isolate primitives but Environment proxies them
// for the sake of convenience.
#define PER_ISOLATE_SYMBOL_PROPERTIES(V) \
V(fs_use_promises_symbol, "fs_use_promises_symbol") \
V(async_id_symbol, "async_id_symbol") \
V(handle_onclose_symbol, "handle_onclose") \
V(no_message_symbol, "no_message_symbol") \
@ -390,7 +391,6 @@
V(domexception_function, v8::Function) \
V(enhance_fatal_stack_after_inspector, v8::Function) \
V(enhance_fatal_stack_before_inspector, v8::Function) \
V(fs_use_promises_symbol, v8::Symbol) \
V(get_source_map_error_source, v8::Function) \
V(host_import_module_dynamically_callback, v8::Function) \
V(host_initialize_import_meta_object_callback, v8::Function) \

View File

@ -2939,13 +2939,9 @@ void Initialize(Local<Object> target,
fdcloset->SetInternalFieldCount(FSReqBase::kInternalFieldCount);
env->set_fdclose_constructor_template(fdcloset);
Local<Symbol> use_promises_symbol =
Symbol::New(isolate,
FIXED_ONE_BYTE_STRING(isolate, "use promises"));
env->set_fs_use_promises_symbol(use_promises_symbol);
target->Set(context,
FIXED_ONE_BYTE_STRING(isolate, "kUsePromises"),
use_promises_symbol).Check();
env->fs_use_promises_symbol()).Check();
}
BindingData* FSReqBase::binding_data() {