10x faster new Buffer (#1717)

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2023-01-04 03:30:15 -08:00
committed by GitHub
parent 021331f154
commit 4a328609b9
19 changed files with 488 additions and 528 deletions

View File

@@ -364,8 +364,8 @@ static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastChar, (JSGlobalObject * lexi
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSStringDecoder* thisObject = jsCast<JSStringDecoder*>(JSValue::decode(thisValue));
auto buffer = ArrayBuffer::createFromBytes(thisObject->m_lastChar, 4, nullptr);
JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, lexicalGlobalObject->typedArrayStructure(JSC::TypeUint8, true), WTFMove(buffer), 0, 4);
toBuffer(lexicalGlobalObject, uint8Array);
auto* globalObject = reinterpret_cast<Zig::GlobalObject*>(lexicalGlobalObject);
JSC::JSUint8Array* uint8Array = JSC::JSUint8Array::create(lexicalGlobalObject, globalObject->JSBufferSubclassStructure(), WTFMove(buffer), 0, 4);
RELEASE_AND_RETURN(throwScope, JSC::JSValue::encode(uint8Array));
}
static JSC_DEFINE_CUSTOM_GETTER(jsStringDecoder_lastNeed, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))