[webkit-changes] [WebKit/WebKit] e7acfe: Avoid unnecessary call to toJS() in willCreatePoss...

Chris Dumez noreply at github.com
Fri Mar 17 11:37:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e7acfe5b0dbf8aeab78bfe29db98a86bb94a5c49
      https://github.com/WebKit/WebKit/commit/e7acfe5b0dbf8aeab78bfe29db98a86bb94a5c49
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-03-17 (Fri, 17 Mar 2023)

  Changed paths:
    M Source/WebCore/bindings/js/JSNodeCustom.cpp

  Log Message:
  -----------
  Avoid unnecessary call to toJS() in willCreatePossiblyOrphanedTreeByRemovalSlowCase()
https://bugs.webkit.org/show_bug.cgi?id=254056

Reviewed by Yusuke Suzuki.

willCreatePossiblyOrphanedTreeByRemoval() calls the slow path if root has no JS
wrapper and has child nodes. In the slow path, we were calling toJS() to
construct the JS wrapper. This was unnecessarily inefficient since toJS() first
has to check if there is an existing JS wrapper before calling createWrapper()
to create one. We don't need these checks since we know there is no wrapper at
this point. As a result, we should call createWrapper() directly.

* Source/WebCore/bindings/js/JSNodeCustom.cpp:
(WebCore::willCreatePossiblyOrphanedTreeByRemovalSlowCase):

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




More information about the webkit-changes mailing list