Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 8ac6cfb4089ac722887e4ffd50be735ef56363b5 https://github.com/WebKit/WebKit/commit/8ac6cfb4089ac722887e4ffd50be735ef56363b5 Author: Yusuke Suzuki <ysuz...@apple.com> Date: 2024-08-20 (Tue, 20 Aug 2024)
Changed paths: A JSTests/stress/json-stringify-inspector-check.js A JSTests/stress/self-reference-json-stringify-overflow.js M Source/JavaScriptCore/runtime/JSONObject.cpp M Source/WTF/WTF.xcodeproj/project.pbxproj M Source/WTF/wtf/CMakeLists.txt M Source/WTF/wtf/text/StringBuilderJSON.cpp A Source/WTF/wtf/text/StringBuilderJSON.h Log Message: ----------- [JSC] Add DynamicBuffer version of JSON FastStringifier https://bugs.webkit.org/show_bug.cgi?id=278372 rdar://134322432 Reviewed by Keith Miller. This patch extends JSON FastStringifier. 1. We add DynamicBuffer mode. Previously we are only supporting StaticBuffer version so that if the generated string becomes too long, we fallback. But this patch adds Vector<> backing dynamic buffer version so that FastStringifier can work with very long output too. 2. Use currentStackPointer based stack overflow detection for DynamicBuffer mode in JSON stringifier. StaticBuffer mode relies on static buffer's fullfillment for stack overflow detection. For DynamicBuffer mode, we just check stack pointer to detect stack overflow and going to the slow path when it happens. 3. We support escaped strings generation in JSON FastStringifier. When the fast path detects that the output string can contain escaped strings, we go to the slow path code generating escaped strings. * Source/JavaScriptCore/runtime/JSONObject.cpp: (JSC::FastStringifier::recordFailure): (JSC::bufferMode>::logOutcome): (JSC::bufferMode>::buffer): (JSC::bufferMode>::buffer const): (JSC::bufferMode>::usableBufferSize): (JSC::bufferMode>::FastStringifier): (JSC::bufferMode>::haveFailure const): (JSC::bufferMode>::result const): (JSC::bufferMode>::recordFailure): (JSC::bufferMode>::recordBufferFull): (JSC::bufferMode>::hasRemainingCapacity): (JSC::bufferMode>::hasRemainingCapacitySlow): (JSC::bufferMode>::recordFastPropertyEnumerationFailure): (JSC::bufferMode>::firstGetterSetterPropertyName const): (JSC::bufferMode>::mayHaveToJSON const): (JSC::bufferMode>::append): (JSC::bufferMode>::stringify): (JSC::stringify): (JSC::FastStringifier<CharType>::logOutcome): Deleted. (JSC::FastStringifier<CharType>::usableBufferSize): Deleted. (JSC::FastStringifier<CharType>::FastStringifier): Deleted. (JSC::FastStringifier<CharType>::haveFailure const): Deleted. (JSC::FastStringifier<CharType>::result const): Deleted. (JSC::FastStringifier<CharType>::recordFailure): Deleted. (JSC::FastStringifier<CharType>::recordBufferFull): Deleted. (JSC::FastStringifier<CharType>::hasRemainingCapacity): Deleted. (JSC::FastStringifier<CharType>::hasRemainingCapacitySlow): Deleted. (JSC::FastStringifier<CharType>::recordFastPropertyEnumerationFailure): Deleted. (JSC::FastStringifier<CharType>::firstGetterSetterPropertyName const): Deleted. (JSC::FastStringifier<CharType>::mayHaveToJSON const): Deleted. (JSC::FastStringifier<CharType>::append): Deleted. (JSC::FastStringifier<CharType>::stringify): Deleted. * Source/WTF/WTF.xcodeproj/project.pbxproj: * Source/WTF/wtf/CMakeLists.txt: * Source/WTF/wtf/text/StringBuilderJSON.cpp: (WTF::appendQuotedJSONStringInternal): Deleted. * Source/WTF/wtf/text/StringBuilderJSON.h: Copied from Source/WTF/wtf/text/StringBuilderJSON.cpp. (WTF::appendQuotedJSONStringInternal): Canonical link: https://commits.webkit.org/282502@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes