Skip to content

Wpe 2.38 backport java script core jsc scoped arguments set index quickly#1668

Merged
aoikonomopoulos merged 3 commits intoWebPlatformForEmbedded:wpe-2.38from
aoikonomopoulos:wpe-2.38-backport-JavaScriptCore_-JSC__ScopedArguments__setIndexQuickly
May 7, 2026
Merged

Wpe 2.38 backport java script core jsc scoped arguments set index quickly#1668
aoikonomopoulos merged 3 commits intoWebPlatformForEmbedded:wpe-2.38from
aoikonomopoulos:wpe-2.38-backport-JavaScriptCore_-JSC__ScopedArguments__setIndexQuickly

Conversation

@aoikonomopoulos
Copy link
Copy Markdown

@aoikonomopoulos aoikonomopoulos commented May 6, 2026

Pull Request Template

File a Bug

All changes should be associated with a bug. The WebKit project is currently using Bugzilla as our bug tracker. Note that multiple changes may be associated with a single bug.

Provided Tooling

The WebKit Project strongly recommends contributors use Tools/Scripts/git-webkit to generate pull requests. See Setup and Contributing Code for how to do this.

Template

If a contributor wishes to file a pull request manually, the template is below. Manually-filed pull requests should contain their commit message as the pull request description, and their commit message should be formatted like the template below.

Additionally, the pull request should be mentioned on Bugzilla, labels applied to the pull request matching the component and version of the Bugzilla associated with the pull request and the pull request assigned to its author.

< bug title >
https://bugs.webkit.org/show_bug.cgi?id=#####

Reviewed by NOBODY (OOPS!).

Explanation of why this fixes the bug (OOPS!).

* path/changed.ext:
(function):
(class.function):

d0b956b

Build-Tests Layout-Tests
✅ 🛠 wpe-238-amd64-build ✅ 🧪 wpe-238-amd64-layout
✅ 🛠 wpe-238-arm32-build ✅ 🧪 wpe-238-arm32-layout

msaboff and others added 3 commits May 6, 2026 08:40
…d across nested scopes https://bugs.webkit.org/show_bug.cgi?id=261934 rdar://114925088 rdar://117838992

Reviewed by Yusuke Suzuki.

Fixed issue where an access to a named argument and a seperate access via its argument[i] counterpart weren't recognized throughout
all JIT tiers as accesses to the same scoped value.  The DFG bytecode parser can unknowingly constant fold the read access.
Added aliasing via the SymbolTable and its ScopedArgumentsTable for both types of accesses of such values.
related objects

Added watchpoints for scoped arguments, and shared the watchpoint from the SymbolTableEntry for the named parameter with the
ScopedArgument entry for the matching index.  Tagged op_put_to_scope bytecodes with a new ScopedArgumentInitialization
initialization type in GetPutInfo to signify this shared watchpoint case.  Since currently all tiers write to scoped arguments
via ScopedArguments::setIndexQuickly(), that is where we fire its watchpoint.

Added a new test.

* JSTests/stress/arrow-function-captured-arguments-aliased.js: Added.
(createOptAll):
(createOpt500):
(createOpt2000):
(createOpt5000):
(main):
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/runtime/GetPutInfo.h:
(JSC::initializationModeName):
(JSC::isInitialization):
* Source/JavaScriptCore/runtime/ScopedArguments.cpp:
(JSC::ScopedArguments::unmapArgument):
* Source/JavaScriptCore/runtime/ScopedArguments.h:
* Source/JavaScriptCore/runtime/ScopedArgumentsTable.cpp:
(JSC::ScopedArgumentsTable::tryCreate):
(JSC::ScopedArgumentsTable::tryClone):
(JSC::ScopedArgumentsTable::trySetLength):
(JSC::ScopedArgumentsTable::trySetWatchpointSet):
* Source/JavaScriptCore/runtime/ScopedArgumentsTable.h:
* Source/JavaScriptCore/runtime/SymbolTable.cpp:
(JSC::SymbolTable::cloneScopePart):
* Source/JavaScriptCore/runtime/SymbolTable.h:

Originally-landed-as: 272448.5@safari-7618-branch (97894699773c). rdar://124557495
Canonical link: https://commits.webkit.org/276437@main
… memory https://bugs.webkit.org/show_bug.cgi?id=255881 rdar://108438866

Reviewed by Yusuke Suzuki and Justin Michaud.

It's intend to crash when a worker exhausting memory when constructing a VM.
Use RELEASE_ASSERT_RESOURCE_AVAILABLE instead for these types of resource
exhaustion to unblock fuzzer.

* Source/JavaScriptCore/runtime/ResourceExhaustion.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::VM):

Canonical link: https://commits.webkit.org/263328@main
…ps://bugs.webkit.org/show_bug.cgi?id=268409 rdar://121748005

Reviewed by Yusuke Suzuki.

A code inspection of the symbol table and scoped arguments code revealed that SymbolTable::cloneScopePart() doesn't
properly copy the ScopedArgumentsTable from the source.  Since ScopedArguments point to the WatchpointSets in the
related SymbolTable, we need to create new WatchpointSets in the cloned SymbolTable and have the ScopedArguments
point to the related new WatchpointSets.

This is a speculative fix.

* Source/JavaScriptCore/runtime/ScopedArguments.h:
* Source/JavaScriptCore/runtime/SymbolTable.cpp:
(JSC::SymbolTable::cloneScopePart):
(JSC::SymbolTable::hasScopedWatchpointSet):
* Source/JavaScriptCore/runtime/SymbolTable.h:

Originally-landed-as: 272448.422@safari-7618-branch (5bc92c9d5253). rdar://124554329
Canonical link: https://commits.webkit.org/276646@main
@aoikonomopoulos aoikonomopoulos merged commit 6f286b9 into WebPlatformForEmbedded:wpe-2.38 May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants