mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
src: replace FIXED_ONE_BYTE_STRING with Environment-cached strings
PR-URL: https://github.com/nodejs/node/pull/59891 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
This commit is contained in:
parent
1ebe88f87c
commit
db926dc1fc
@ -72,8 +72,7 @@ void Realm::CreateProperties() {
|
||||
CHECK(primordials->IsObject());
|
||||
set_primordials(primordials.As<Object>());
|
||||
|
||||
Local<String> prototype_string =
|
||||
FIXED_ONE_BYTE_STRING(isolate(), "prototype");
|
||||
Local<String> prototype_string = env_->prototype_string();
|
||||
|
||||
#define V(EnvPropertyName, PrimordialsPropertyName) \
|
||||
{ \
|
||||
|
||||
@ -1240,9 +1240,7 @@ void DatabaseSync::CustomFunction(const FunctionCallbackInfo<Value>& args) {
|
||||
argc = -1;
|
||||
} else {
|
||||
Local<Value> 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<Int32>()->Value();
|
||||
@ -1473,7 +1471,7 @@ void DatabaseSync::CreateSession(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
Local<Object> options = args[0].As<Object>();
|
||||
|
||||
Local<String> table_key = FIXED_ONE_BYTE_STRING(env->isolate(), "table");
|
||||
Local<String> table_key = env->table_string();
|
||||
bool hasIt;
|
||||
if (!options->HasOwnProperty(env->context(), table_key).To(&hasIt)) {
|
||||
return;
|
||||
|
||||
@ -738,11 +738,10 @@ static void Initialize(Local<Object> target,
|
||||
|
||||
Local<FunctionTemplate> length_getter =
|
||||
FunctionTemplate::New(isolate, StorageLengthGetter);
|
||||
ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(
|
||||
FIXED_ONE_BYTE_STRING(isolate, "length"),
|
||||
length_getter,
|
||||
Local<FunctionTemplate>(),
|
||||
DontDelete);
|
||||
ctor_tmpl->PrototypeTemplate()->SetAccessorProperty(env->length_string(),
|
||||
length_getter,
|
||||
Local<FunctionTemplate>(),
|
||||
DontDelete);
|
||||
|
||||
SetProtoMethod(isolate, ctor_tmpl, "clear", Clear);
|
||||
SetProtoMethodNoSideEffect(isolate, ctor_tmpl, "getItem", GetItem);
|
||||
|
||||
@ -84,8 +84,7 @@ void LibuvStreamWrap::Initialize(Local<Object> 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));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user