[webkit-changes] [WebKit/WebKit] 1e2385: [WTF] Shrink sizeof(JSON::Value)

Yusuke Suzuki noreply at github.com
Fri Jul 21 02:47:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1e2385d6ab1270307f31561a7f9ff2343f7b09a9
      https://github.com/WebKit/WebKit/commit/1e2385d6ab1270307f31561a7f9ff2343f7b09a9
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    M Source/WTF/wtf/JSONValues.cpp
    M Source/WTF/wtf/JSONValues.h
    M Tools/TestWebKitAPI/Tests/WTF/JSONValue.cpp

  Log Message:
  -----------
  [WTF] Shrink sizeof(JSON::Value)
https://bugs.webkit.org/show_bug.cgi?id=259384
rdar://112637340

Reviewed by Devin Rousso and Darin Adler.

It makes sizeof(JSON::Value) optimized, and wipe all virtual functions for that.
We would like to use this class more widely, for easy-to-use JSON without any JSC contexts.
One target is many toolings, and for example, JSC bytecode profiler is now using this.

* Source/WTF/wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::visitDerived):
(WTF::JSONImpl::Value::visitDerived const):
(WTF::JSONImpl::Value::operator delete):
(WTF::JSONImpl::Value::asObject):
(WTF::JSONImpl::Value::asObject const):
(WTF::JSONImpl::Value::asArray):
(WTF::JSONImpl::Value::writeJSON const):
(WTF::JSONImpl::Value::writeJSONImpl const):
(WTF::JSONImpl::Value::memoryCost const):
(WTF::JSONImpl::Value::memoryCostImpl const):
(WTF::JSONImpl::ObjectBase::memoryCostImpl const):
(WTF::JSONImpl::ObjectBase::writeJSONImpl const):
(WTF::JSONImpl::ArrayBase::writeJSONImpl const):
(WTF::JSONImpl::ArrayBase::memoryCostImpl const):
(WTF::JSONImpl::ObjectBase::~ObjectBase): Deleted.
(WTF::JSONImpl::ObjectBase::asObject): Deleted.
(WTF::JSONImpl::ObjectBase::asObject const): Deleted.
(WTF::JSONImpl::ObjectBase::memoryCost const): Deleted.
(WTF::JSONImpl::ObjectBase::writeJSON const): Deleted.
(WTF::JSONImpl::ArrayBase::~ArrayBase): Deleted.
(WTF::JSONImpl::ArrayBase::asArray): Deleted.
(WTF::JSONImpl::ArrayBase::writeJSON const): Deleted.
(WTF::JSONImpl::ArrayBase::memoryCost const): Deleted.
* Source/WTF/wtf/JSONValues.h:

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




More information about the webkit-changes mailing list