Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit abecdcb

Browse files
iknoomtargos
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 213188e commit abecdcb

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
@@ -1232,9 +1232,7 @@ void DatabaseSync::CustomFunction(const FunctionCallbackInfo<Value>& args) {
12321232
argc = -1;
12331233
} else {
12341234
Local<Value> js_len;
1235-
if (!fn->Get(env->context(),
1236-
FIXED_ONE_BYTE_STRING(env->isolate(), "length"))
1237-
.ToLocal(&js_len)) {
1235+
if (!fn->Get(env->context(), env->length_string()).ToLocal(&js_len)) {
12381236
return;
12391237
}
12401238
argc = js_len.As<Int32>()->Value();
@@ -1465,7 +1463,7 @@ void DatabaseSync::CreateSession(const FunctionCallbackInfo<Value>& args) {
14651463

14661464
Local<Object> options = args[0].As<Object>();
14671465

1468-
Local<String> table_key = FIXED_ONE_BYTE_STRING(env->isolate(), "table");
1466+
Local<String> table_key = env->table_string();
14691467
bool hasIt;
14701468
if (!options->HasOwnProperty(env->context(), table_key).To(&hasIt)) {
14711469
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)