[webkit-changes] [WebKit/WebKit] 7fa813: [JSC] Enhance NumericStrings cache and reduce stre...
Yusuke Suzuki
noreply at github.com
Thu Jun 22 01:41:46 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7fa8139936ced01652670507cf68153def53ca3b
https://github.com/WebKit/WebKit/commit/7fa8139936ced01652670507cf68153def53ca3b
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2023-06-22 (Thu, 22 Jun 2023)
Changed paths:
M JSTests/stress/delete-property-check-structure-transition.js
M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
M Source/JavaScriptCore/heap/Heap.cpp
M Source/JavaScriptCore/runtime/NumberPrototype.cpp
M Source/JavaScriptCore/runtime/NumericStrings.h
M Source/JavaScriptCore/runtime/VM.cpp
M Source/JavaScriptCore/tools/JSDollarVM.cpp
M Source/WTF/wtf/MathExtras.h
Log Message:
-----------
[JSC] Enhance NumericStrings cache and reduce strength of StrCat for Int32
https://bugs.webkit.org/show_bug.cgi?id=258387
rdar://problem/111140791
Reviewed by Mark Lam.
We found that ToString(Int32) happens very frequently. This patch does two things.
1. We convert StrCat(Int32, ...) to MakeRope(ToString(Int32), ...). MakeRope is much faster than StrCat.
And Int32 stringifying does not have side effect. Doing this in FixupPhase based on speculations.
2. Enhance NumericStrings size to 256 (smallest size in V8). We also make smallIntCache accessible from
DFG and FTL so small int strings are loaded without C++ function calls. We also mark cached strings
during eden collections, and clear them in full collection time.
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::attemptToMakeFastStringAdd):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileToStringOrCallStringConstructorOrStringValueOf):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/heap/Heap.cpp:
(JSC::Heap::finalize):
* Source/JavaScriptCore/runtime/NumberPrototype.cpp:
(JSC::NumericStrings::initializeSmallIntCache):
(JSC::int32ToStringInternal):
* Source/JavaScriptCore/runtime/NumericStrings.h:
(JSC::NumericStrings::StringWithJSString::offsetOfJSString):
(JSC::NumericStrings::clearOnGarbageCollection):
(JSC::NumericStrings::visitAggregateImpl):
(JSC::NumericStrings::smallIntCache):
(JSC::NumericStrings::lookup):
(JSC::NumericStrings::lookupSmallString):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::visitAggregateImpl):
Canonical link: https://commits.webkit.org/265397@main
More information about the webkit-changes
mailing list