1

[JSC] Add fallback FastStringifier for 16-bit strings · WebKit/WebKit@f5cf4d7 ·...

 4 weeks ago
source link: https://github.com/WebKit/WebKit/commit/f5cf4d7dd0874c15e293967d0f368e0cd303d997
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Commit

Permalink

[JSC] Add fallback FastStringifier for 16-bit strings

Browse files Browse the repository at this point in the history

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
Constellation committed Aug 31, 2023
1 parent 3088454 commit f5cf4d7

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK