Skip to content

Commit 26b40ba

Browse files
iknoomaduh95
authored andcommitted
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 ba00875 commit 26b40ba

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
@@ -52,8 +52,7 @@ void Realm::CreateProperties() {
5252
CHECK(primordials->IsObject());
5353
set_primordials(primordials.As<Object>());
5454

55-
Local<String> prototype_string =
56-
FIXED_ONE_BYTE_STRING(isolate(), "prototype");
55+
Local<String> prototype_string = env_->prototype_string();
5756

5857
#define V(EnvPropertyName, PrimordialsPropertyName) \
5958
{ \

src/node_sqlite.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,9 +1215,7 @@ void DatabaseSync::CustomFunction(const FunctionCallbackInfo<Value>& args) {
12151215
argc = -1;
12161216
} else {
12171217
Local<Value> js_len;
1218-
if (!fn->Get(env->context(),
1219-
FIXED_ONE_BYTE_STRING(env->isolate(), "length"))
1220-
.ToLocal(&js_len)) {
1218+
if (!fn->Get(env->context(), env->length_string()).ToLocal(&js_len)) {
12211219
return;
12221220
}
12231221
argc = js_len.As<Int32>()->Value();
@@ -1448,7 +1446,7 @@ void DatabaseSync::CreateSession(const FunctionCallbackInfo<Value>& args) {
14481446

14491447
Local<Object> options = args[0].As<Object>();
14501448

1451-
Local<String> table_key = FIXED_ONE_BYTE_STRING(env->isolate(), "table");
1449+
Local<String> table_key = env->table_string();
14521450
bool hasIt;
14531451
if (!options->HasOwnProperty(env->context(), table_key).To(&hasIt)) {
14541452
return;

src/node_webstorage.cc

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

742742
Local<FunctionTemplate> length_getter =
743743
FunctionTemplate::New(isolate, StorageLengthGetter);
744-
ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(
745-
FIXED_ONE_BYTE_STRING(isolate, "length"),
746-
length_getter,
747-
Local<FunctionTemplate>(),
748-
DontDelete);
744+
ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(env->length_string(),
745+
length_getter,
746+
Local<FunctionTemplate>(),
747+
DontDelete);
749748

750749
SetProtoMethod(isolate, ctor_tmpl, "clear", Clear);
751750
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)