[webkit-changes] [WebKit/WebKit] b55372: tryCacheArrayPutByVal should use the right ECMAMode.

Commit Queue noreply at github.com
Sun Oct 15 07:44:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b55372516a5c399ca427c87b393a7d6975a6c526
      https://github.com/WebKit/WebKit/commit/b55372516a5c399ca427c87b393a7d6975a6c526
  Author: Mark Lam <mark.lam at apple.com>
  Date:   2023-10-15 (Sun, 15 Oct 2023)

  Changed paths:
    A JSTests/stress/sloppy-mode-array-put-should-not-throw.js
    M Source/JavaScriptCore/bytecode/Repatch.cpp

  Log Message:
  -----------
  tryCacheArrayPutByVal should use the right ECMAMode.
https://bugs.webkit.org/show_bug.cgi?id=263169
rdar://114305344

Reviewed by Justin Michaud.

tryCacheArrayPutByVal() was always assuming that the array put is of type ECMAMode::strict().
Fixed it to determine the ECMAMode based on the putByKind.

Note: PutByKind::DefinePrivateNameById, PutByKind::DefinePrivateNameByVal, PutByKind::SetPrivateNameById,
and PutByKind::SetPrivateNameByVal are strict because according to 11.2.2 Strict Code Mode [1]:
"All parts of a ClassDeclaration or a ClassExpression are strict mode code.", and private names only
manifest in classes.

[1] https://tc39.es/ecma262/#sec-strict-mode-code

* JSTests/stress/sloppy-mode-array-put-should-not-throw.js: Added.
(array.__proto__.get x):
(opt):
(main):
* Source/JavaScriptCore/bytecode/Repatch.cpp:
(JSC::ecmaModeFor):
(JSC::tryCacheArrayPutByVal):
(JSC::repatchArrayPutByVal):

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




More information about the webkit-changes mailing list