[webkit-changes] [WebKit/WebKit] fa3090: [JSC] Stringifier should quickly get names even if...

Yusuke Suzuki noreply at github.com
Tue May 2 20:48:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fa309035221a7368ed9d2e4b4a139a3169c5c36a
      https://github.com/WebKit/WebKit/commit/fa309035221a7368ed9d2e4b4a139a3169c5c36a
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-05-02 (Tue, 02 May 2023)

  Changed paths:
    A JSTests/stress/json-stringify-getter-call-complex.js
    M Source/JavaScriptCore/runtime/JSONObject.cpp
    M Source/JavaScriptCore/runtime/JSObject.cpp
    M Source/JavaScriptCore/runtime/JSObjectInlines.h
    M Source/JavaScriptCore/runtime/ObjectConstructorInlines.h

  Log Message:
  -----------
  [JSC] Stringifier should quickly get names even if it involves accessors
https://bugs.webkit.org/show_bug.cgi?id=256231
rdar://108812378

Reviewed by Justin Michaud.

Even though the object has accessors, we can still enumerate properties quickly unless
structure is the same. This patch adds a fast path for object including accessors to
collect property names and offsets. Then we can use these information to get GetterSetter,
and even continue using these information so long as structure is not changed.

* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::isArray const):
(JSC::Stringifier::Holder::appendNextProperty):
(JSC::Stringifier::Holder::hasFastObjectProperties const): Deleted.
* Source/JavaScriptCore/runtime/JSObjectInlines.h:
(JSC::JSObject::fastForEachPropertyWithSideEffectFreeFunctor):
* Source/JavaScriptCore/runtime/ObjectConstructorInlines.h:
(JSC::canPerformFastPropertyNameEnumerationForJSONStringifyWithSideEffect):
(JSC::canPerformFastPropertyNameAndOffsetEnumerationForJSONStringifyWithSideEffect):

Canonical link: https://commits.webkit.org/263619@main




More information about the webkit-changes mailing list