[webkit-changes] [WebKit/WebKit] 0a95f7: [JSC] Simplify constructEmptyObject

Yusuke Suzuki noreply at github.com
Mon May 8 13:03:22 PDT 2023


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

  Changed paths:
    M Source/JavaScriptCore/runtime/JSObject.h
    M Source/JavaScriptCore/runtime/JSObjectInlines.h
    M Source/JavaScriptCore/runtime/ObjectConstructor.h

  Log Message:
  -----------
  [JSC] Simplify constructEmptyObject
https://bugs.webkit.org/show_bug.cgi?id=256478
rdar://109049306

Reviewed by Alexey Shvayka and Keith Miller.

This patch simplifies constructEmptyObject because this is super hot code in JSON.parse.

1. gcSafeZeroMemory is not necessary in JSFinalObject's constructor. memset is OK since
   this object is not exposed to GC yet.
2. We use constant defaultInlineCapacity in constructEmptyObject's fast path to make
   the above constant assignment instead of loop.

* Source/JavaScriptCore/runtime/JSObject.h:
(JSC::JSFinalObject::createWithButterfly):
* Source/JavaScriptCore/runtime/JSObjectInlines.h:
(JSC::JSFinalObject::createDefaultEmptyObject):
* Source/JavaScriptCore/runtime/ObjectConstructor.h:
(JSC::constructEmptyObject):

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




More information about the webkit-changes mailing list