Skip to content

Commit

Permalink
fs: move fs_use_promises_symbol to per-isolate symbols
Browse files Browse the repository at this point in the history
PR-URL: #47768
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
  • Loading branch information
joyeecheung authored and targos committed Nov 10, 2023
1 parent 629fc77 commit edf46c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
15 changes: 10 additions & 5 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,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)
Expand Down Expand Up @@ -1648,6 +1653,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();

builtins_in_snapshot = info->builtins;
Expand All @@ -1661,11 +1671,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() {
Expand Down
2 changes: 1 addition & 1 deletion src/env_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") \
Expand Down Expand Up @@ -386,7 +387,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) \
Expand Down
7 changes: 1 addition & 6 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ using v8::Object;
using v8::ObjectTemplate;
using v8::Promise;
using v8::String;
using v8::Symbol;
using v8::Undefined;
using v8::Value;

Expand Down Expand Up @@ -2792,13 +2791,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() {
Expand Down

0 comments on commit edf46c1

Please sign in to comment.