Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JSC] Add fallback FastStringifier for 16-bit strings
https://bugs.webkit.org/show_bug.cgi?id=260924 rdar://114723262 Reviewed by Mark Lam. This patch enhances FastStringifier to accept 16-bit strings. We make it FastStringifier<CharType>, and keep it the previous 8-bit strings fast path. And we fall back to FastStringifier<UChar> only when the following conditions are met. 1. We failed due to 16-bit string. 2. The content is filled less than 50% of the buffer. We also adjust bufferSize from 6000 to 8192. The previous value comes from Speedometer2.1. The new value comes from Speedometer3. And we also support undefined property skipping in the FastStringifier. * JSTests/stress/json-undefined-prop-skip.js: Added. (shouldBe): (shouldBe.JSON.stringify): * Source/JavaScriptCore/runtime/JSONObject.cpp: (JSC::JSONObject::JSONObject): (JSC::FastStringifier<CharType>::logOutcome): (JSC::logOutcomeImpl): (JSC::FastStringifier<CharType>::usableBufferSize): (JSC::FastStringifier<CharType>::FastStringifier): (JSC::FastStringifier<CharType>::haveFailure const): (JSC::FastStringifier<CharType>::result const): (JSC::FastStringifier<CharType>::recordFailure): (JSC::FastStringifier<CharType>::recordBufferFull): (JSC::FastStringifier<CharType>::hasRemainingCapacity): (JSC::FastStringifier<CharType>::hasRemainingCapacitySlow): (JSC::FastStringifier<CharType>::recordFastPropertyEnumerationFailure): (JSC::FastStringifier<CharType>::firstGetterSetterPropertyName const): (JSC::FastStringifier<CharType>::mayHaveToJSON const): (JSC::FastStringifier<CharType>::append): (JSC::FastStringifier<CharType>::stringify): (JSC::stringify): (JSC::FastStringifier::logOutcome): Deleted. (JSC::FastStringifier::usableBufferSize): Deleted. (JSC::FastStringifier::FastStringifier): Deleted. (JSC::FastStringifier::haveFailure const): Deleted. (JSC::FastStringifier::result const): Deleted. (JSC::FastStringifier::recordFailure): Deleted. (JSC::FastStringifier::recordBufferFull): Deleted. (JSC::FastStringifier::hasRemainingCapacity): Deleted. (JSC::FastStringifier::hasRemainingCapacitySlow): Deleted. (JSC::FastStringifier::recordFastPropertyEnumerationFailure): Deleted. (JSC::FastStringifier::firstGetterSetterPropertyName const): Deleted. (JSC::FastStringifier::mayHaveToJSON const): Deleted. (JSC::FastStringifier::append): Deleted. (JSC::FastStringifier::stringify): Deleted. Canonical link: https://commits.webkit.org/267481@main
- Loading branch information