From ad43278dbc2022529328e4822e8be5ef995a8a63 Mon Sep 17 00:00:00 2001 From: iknoom Date: Mon, 15 Sep 2025 15:07:45 +0900 Subject: [PATCH] src: replace FIXED_ONE_BYTE_STRING with Environment-cached strings --- src/node_realm.cc | 3 +-- src/node_sqlite.cc | 6 ++---- src/node_webstorage.cc | 9 ++++----- src/stream_wrap.cc | 3 +-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/node_realm.cc b/src/node_realm.cc index b7ac5d74c3b7cc..2a5fe9fe501d1f 100644 --- a/src/node_realm.cc +++ b/src/node_realm.cc @@ -72,8 +72,7 @@ void Realm::CreateProperties() { CHECK(primordials->IsObject()); set_primordials(primordials.As()); - Local prototype_string = - FIXED_ONE_BYTE_STRING(isolate(), "prototype"); + Local prototype_string = env_->prototype_string(); #define V(EnvPropertyName, PrimordialsPropertyName) \ { \ diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc index 9140c63440c88a..87e33861cc46b0 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc @@ -1240,9 +1240,7 @@ void DatabaseSync::CustomFunction(const FunctionCallbackInfo& args) { argc = -1; } else { Local js_len; - if (!fn->Get(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "length")) - .ToLocal(&js_len)) { + if (!fn->Get(env->context(), env->length_string()).ToLocal(&js_len)) { return; } argc = js_len.As()->Value(); @@ -1473,7 +1471,7 @@ void DatabaseSync::CreateSession(const FunctionCallbackInfo& args) { Local options = args[0].As(); - Local table_key = FIXED_ONE_BYTE_STRING(env->isolate(), "table"); + Local table_key = env->table_string(); bool hasIt; if (!options->HasOwnProperty(env->context(), table_key).To(&hasIt)) { return; diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc index 4d796e6df90c58..cc90af827a3fbd 100644 --- a/src/node_webstorage.cc +++ b/src/node_webstorage.cc @@ -738,11 +738,10 @@ static void Initialize(Local target, Local length_getter = FunctionTemplate::New(isolate, StorageLengthGetter); - ctor_tmpl->PrototypeTemplate()->SetAccessorProperty( - FIXED_ONE_BYTE_STRING(isolate, "length"), - length_getter, - Local(), - DontDelete); + ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(env->length_string(), + length_getter, + Local(), + DontDelete); SetProtoMethod(isolate, ctor_tmpl, "clear", Clear); SetProtoMethodNoSideEffect(isolate, ctor_tmpl, "getItem", GetItem); diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index d7fa2bb48b5883..1508cc097fbf24 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -84,8 +84,7 @@ void LibuvStreamWrap::Initialize(Local target, sw->InstanceTemplate()->Set(env->oncomplete_string(), v8::Null(isolate)); sw->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "callback"), v8::Null(isolate)); - sw->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "handle"), - v8::Null(isolate)); + sw->InstanceTemplate()->Set(env->handle_string(), v8::Null(isolate)); sw->Inherit(AsyncWrap::GetConstructorTemplate(env));