Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9f9370cc729f0e035aa09416b3ca84e6ac8a69c5
https://github.com/WebKit/WebKit/commit/9f9370cc729f0e035aa09416b3ca84e6ac8a69c5
Author: Yusuke Suzuki <[email protected]>
Date: 2026-07-28 (Tue, 28 Jul 2026)
Changed paths:
A JSTests/stress/json-stringify-enumerable-to-json.js
M Source/JavaScriptCore/runtime/JSONObject.cpp
Log Message:
-----------
[JSC] Fix JSON stringify regression due to toJSON check
https://bugs.webkit.org/show_bug.cgi?id=320437
rdar://183400665
Reviewed by Sosuke Suzuki.
316941@main becomes performance regression in JSON.stringify because we
insert toJSON name check in the one of the hottest loop listing
properties. But we do not need this check for enumerable properties.
When it is enumerable, we check this field later anyway, and we fail if
it is callable one and otherwise it is just handled as a normal object.
So we only need to check this name when a property is non-enumerable.
This patch fixes it by moving the check to make this loop fast.
Test: JSTests/stress/json-stringify-enumerable-to-json.js
* JSTests/stress/json-stringify-enumerable-to-json.js: Added.
(shouldBe):
(shouldThrow):
(shouldBe.JSON.stringify.toJSON):
(shouldBe.JSON.stringify.key.toJSON):
(shouldBe.JSON.stringify.nested.toJSON):
(shouldBe.JSON.stringify.toJSON.new.Proxy):
(shouldThrow.JSON.stringify.toJSON):
(shouldThrow.JSON.stringify):
(i.shouldBe.JSON.stringify.toJSON):
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::bufferMode>::append):
Canonical link: https://commits.webkit.org/318072@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications