[webkit-changes] [WebKit/WebKit] f82533: [JSC] Avoid calling setIsFunction() for function n...

Commit Queue noreply at github.com
Mon Oct 16 13:45:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f82533b7e079ad511df75a66c942f60ec73c145a
      https://github.com/WebKit/WebKit/commit/f82533b7e079ad511df75a66c942f60ec73c145a
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2023-10-16 (Mon, 16 Oct 2023)

  Changed paths:
    M Source/JavaScriptCore/parser/Parser.h

  Log Message:
  -----------
  [JSC] Avoid calling setIsFunction() for function name bindings
https://bugs.webkit.org/show_bug.cgi?id=263097
<rdar://problem/116891657>

Reviewed by Ross Kirsling.

Our implementations of GlobalDeclarationInstantiation / EvalDeclarationInstantiation
(ProgramExecutable::initializeGlobalProperties() / Interpreter::executeEval() respectively)
rely on IsFunction to detect bindings created via FunctionDeclaration & friends.

While calling setIsFunction() on a function name binding doesn't seem to affect any logic expect for
duplicate parameter SyntaxError, it's semantically more pure to reserve IsFunction bit only for
FunctionDeclaration & friends.

Since at the time of declareParameter() being called, only the function name binding and other
parameters can be declared, this change tweaks the SyntaxError condition to utilize isParameter()
instead, ensuring that it's checked before calling setIsParameter(), and refactors `isValidStrictMode`
to rely on that condition as well.

No new tests, no behavior change.

* Source/JavaScriptCore/parser/Parser.h:
(JSC::Scope::declareCallee):
(JSC::Scope::declareParameter):

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




More information about the webkit-changes mailing list