Skip to content

Commit db926dc

Browse files
authored
src: replace FIXED_ONE_BYTE_STRING with Environment-cached strings
PR-URL: #59891 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
1 parent 1ebe88f commit db926dc

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

src/node_realm.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ void Realm::CreateProperties() {
7272
CHECK(primordials->IsObject());
7373
set_primordials(primordials.As<Object>());
7474

75-
Local<String> prototype_string =
76-
FIXED_ONE_BYTE_STRING(isolate(), "prototype");
75+
Local<String> prototype_string = env_->prototype_string();
7776

7877
#define V(EnvPropertyName, PrimordialsPropertyName) \
7978
{ \

src/node_sqlite.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,9 +1240,7 @@ void DatabaseSync::CustomFunction(const FunctionCallbackInfo<Value>& args) {
12401240
argc = -1;
12411241
} else {
12421242
Local<Value> js_len;
1243-
if (!fn->Get(env->context(),
1244-
FIXED_ONE_BYTE_STRING(env->isolate(), "length"))
1245-
.ToLocal(&js_len)) {
1243+
if (!fn->Get(env->context(), env->length_string()).ToLocal(&js_len)) {
12461244
return;
12471245
}
12481246
argc = js_len.As<Int32>()->Value();
@@ -1473,7 +1471,7 @@ void DatabaseSync::CreateSession(const FunctionCallbackInfo<Value>& args) {
14731471

14741472
Local<Object> options = args[0].As<Object>();
14751473

1476-
Local<String> table_key = FIXED_ONE_BYTE_STRING(env->isolate(), "table");
1474+
Local<String> table_key = env->table_string();
14771475
bool hasIt;
14781476
if (!options->HasOwnProperty(env->context(), table_key).To(&hasIt)) {
14791477
return;

src/node_webstorage.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,10 @@ static void Initialize(Local<Object> target,
738738

739739
Local<FunctionTemplate> length_getter =
740740
FunctionTemplate::New(isolate, StorageLengthGetter);
741-
ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(
742-
FIXED_ONE_BYTE_STRING(isolate, "length"),
743-
length_getter,
744-
Local<FunctionTemplate>(),
745-
DontDelete);
741+
ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(env->length_string(),
742+
length_getter,
743+
Local<FunctionTemplate>(),
744+
DontDelete);
746745

747746
SetProtoMethod(isolate, ctor_tmpl, "clear", Clear);
748747
SetProtoMethodNoSideEffect(isolate, ctor_tmpl, "getItem", GetItem);

src/stream_wrap.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ void LibuvStreamWrap::Initialize(Local<Object> target,
8484
sw->InstanceTemplate()->Set(env->oncomplete_string(), v8::Null(isolate));
8585
sw->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "callback"),
8686
v8::Null(isolate));
87-
sw->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "handle"),
88-
v8::Null(isolate));
87+
sw->InstanceTemplate()->Set(env->handle_string(), v8::Null(isolate));
8988

9089
sw->Inherit(AsyncWrap::GetConstructorTemplate(env));
9190

0 commit comments

Comments
 (0)