Skip to content

Commit

Permalink
dont create JSString for ASCIILiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Dec 14, 2024
1 parent 9201b88 commit 8b17029
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/bun.js/bindings/NodeValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,10 @@ JSC_DEFINE_HOST_FUNCTION(jsFunction_validateBuffer, (JSC::JSGlobalObject * globa
auto name = callFrame->argument(1);
return V::validateBuffer(scope, globalObject, buffer, name);
}
JSC::EncodedJSValue V::validateBuffer(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, JSValue buffer, JSValue name)
JSC::EncodedJSValue V::validateBuffer(JSC::ThrowScope& scope, JSC::JSGlobalObject* globalObject, JSValue buffer, JSValue nameValue)
{
JSC::VM& vm = globalObject->vm();

if (name.isUndefined()) name = jsString(vm, String("buffer"_s));
auto name = nameValue.isUndefined() ? "buffer"_s : nameValue.toWTFString(globalObject);
RETURN_IF_EXCEPTION(scope, {});

if (!buffer.isCell()) return JSValue::encode(jsUndefined());
auto ty = buffer.asCell()->type();
Expand Down

0 comments on commit 8b17029

Please sign in to comment.