buffer: avoid creating unnecessary environment

PR-URL: https://github.com/nodejs/node/pull/58053
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Yagiz Nizipli authored and Antoine du Hamel committed 2025-05-19 12:14:04 +02:00
1 parent 66f2c605a8
commit e7e8256d35
1 file changed
+2 -2
+2 -2
View File
@@ -736,11 +736,11 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) {
}
void SlowByteLengthUtf8(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK(args[0]->IsString());
// Fast case: avoid StringBytes on UTF8 string. Jump to v8.
args.GetReturnValue().Set(args[0].As<String>()->Utf8Length(env->isolate()));
args.GetReturnValue().Set(
args[0].As<String>()->Utf8Length(args.GetIsolate()));
}
uint32_t FastByteLengthUtf8(Local<Value> receiver,