Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1e80c1e3efb992a1ea34037a3b3a781ba32fb299
https://github.com/WebKit/WebKit/commit/1e80c1e3efb992a1ea34037a3b3a781ba32fb299
Author: Yusuke Suzuki <[email protected]>
Date: 2026-09-25 (Fri, 25 Sep 2026)
Changed paths:
A JSTests/stress/json-parse-object-key-branching-transitions.js
A JSTests/stress/json-parse-transition-cache-across-gc.js
A JSTests/stress/json-parse-transition-cache-structure-changes.js
M Source/JavaScriptCore/CMakeLists.txt
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
A Source/JavaScriptCore/runtime/JSONTransitionCache.h
A Source/JavaScriptCore/runtime/JSONTransitionCacheInlines.h
M Source/JavaScriptCore/runtime/LiteralParser.cpp
M Source/JavaScriptCore/runtime/VM.cpp
M Source/JavaScriptCore/runtime/VM.h
Log Message:
-----------
[JSC] Add JSONTransitionCache
https://bugs.webkit.org/show_bug.cgi?id=325249
rdar://188365530
Reviewed by Yijia Huang and Vassili Bykov.
321841@main improved object baking by using single transition. But this
optimization does not hit when starting from an empty object initially
since its Structure will have significant amount of transition
destination from that. But we can expect that similar shaped object will
appear repeatedly in JSON.parse.
This patch introduces JSONTransitionCache in VM. This is Structure ->
Structure two-level cache. It is storing from and to structures, and
when initial structure and adding property name are coming, we can check
with this.
structure == cacheEntry.to && cacheEntry.from->transitionPropertyName ==
name
as transition destination structure knows the original structure with
transition property name.
Tests: JSTests/stress/json-parse-object-key-branching-transitions.js
JSTests/stress/json-parse-transition-cache-across-gc.js
* JSTests/stress/json-parse-object-key-branching-transitions.js: Added.
(shouldBe):
* JSTests/stress/json-parse-transition-cache-across-gc.js: Added.
(shouldBe):
* JSTests/stress/json-parse-transition-cache-structure-changes.js: Added.
(shouldBe):
(makeSource):
(checkObject):
(parseAndCheck):
(step):
(step.victims.ReturnsArgument):
(step.victims.Branded.prototype.method):
(step.victims.Branded.call):
(step.victims.Branded):
(step.victims.WithField.get object):
(step.victims.WithField):
(step.victims.get return):
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/runtime/JSONTransitionCache.h: Added.
(JSC::JSONTransitionCache::ParsingScope::ParsingScope):
(JSC::JSONTransitionCache::ParsingScope::~ParsingScope):
(JSC::JSONTransitionCache::reconcileAtGCEnd):
* Source/JavaScriptCore/runtime/JSONTransitionCacheInlines.h: Added.
(JSC::JSONTransitionCache::key):
(JSC::JSONTransitionCache::primaryIndex):
(JSC::JSONTransitionCache::secondaryIndex):
(JSC::JSONTransitionCache::transitionIfMatches):
(JSC::JSONTransitionCache::get):
(JSC::JSONTransitionCache::add):
(JSC::JSONTransitionCache::visitAggregate):
* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::requires):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::reconcileWeakReferencesAtGCEnd):
(JSC::VM::visitAggregateImpl):
* Source/JavaScriptCore/runtime/VM.h:
Canonical link: https://commits.webkit.org/321920@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications