[webkit-changes] [WebKit/WebKit] 373b5f: style.display setter should be fast

Yusuke Suzuki noreply at github.com
Fri Nov 17 14:11:17 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 373b5f1310c1d92cb0aef4b501a3bef651d07bf1
      https://github.com/WebKit/WebKit/commit/373b5f1310c1d92cb0aef4b501a3bef651d07bf1
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-11-17 (Fri, 17 Nov 2023)

  Changed paths:
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSParserFastPaths.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/process-css-properties.py

  Log Message:
  -----------
  style.display setter should be fast
https://bugs.webkit.org/show_bug.cgi?id=265009
rdar://118548941

Reviewed by Chris Dumez.

While `style.display` setter can be called frequently, this isn't optimized well.
This patch optimizes it in three ways.

1. We should have CSSParserFastPaths for display with simple one keyword, like, `style.display = "none"`.
2. We found that JSCSSStyleDeclaration::put is completely disabling IC and using the slowest path.
   Since JSCSSStyleDeclaration does not have any named getters / setters, we should use JSObject::put when
   we access to named property. We add a path which uses JSObject::put when propertyName is not index.
3. CSSParserContext is frequently created. We should use bitfields to make it much smaller (from 110 => 64).

* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GeneratePut):
(InstanceOverridesIndexedDefineOwnProperty):
(InstanceOverridesNamedDefineOwnProperty):
(InstanceOverridesDefineOwnProperty):
* Source/WebCore/css/parser/CSSParserFastPaths.cpp:
(WebCore::parseDisplay):
(WebCore::CSSParserFastPaths::maybeParseValue):

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




More information about the webkit-changes mailing list