[webkit-changes] [WebKit/WebKit] f5cf4d: [JSC] Add fallback FastStringifier for 16-bit strings

Yusuke Suzuki noreply at github.com
Wed Aug 30 20:15:20 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f5cf4d7dd0874c15e293967d0f368e0cd303d997
      https://github.com/WebKit/WebKit/commit/f5cf4d7dd0874c15e293967d0f368e0cd303d997
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    A JSTests/stress/json-undefined-prop-skip.js
    M Source/JavaScriptCore/runtime/JSONObject.cpp

  Log Message:
  -----------
  [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




More information about the webkit-changes mailing list