Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 0e3fcb9531e248c468366393fd4f2127ea5dcb56 https://github.com/WebKit/WebKit/commit/0e3fcb9531e248c468366393fd4f2127ea5dcb56 Author: Yusuke Suzuki <ysuz...@apple.com> Date: 2023-06-07 (Wed, 07 Jun 2023)
Changed paths: A JSTests/stress/v8-regexp-results-cache.js A JSTests/stress/v8-string-replace-cache.js A JSTests/stress/v8-string-replace.js M Source/JavaScriptCore/CMakeLists.txt M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj M Source/JavaScriptCore/heap/Heap.cpp M Source/JavaScriptCore/runtime/ArgList.h M Source/JavaScriptCore/runtime/JSImmutableButterfly.cpp M Source/JavaScriptCore/runtime/JSImmutableButterfly.h M Source/JavaScriptCore/runtime/OptionsList.h M Source/JavaScriptCore/runtime/RegExpGlobalData.h M Source/JavaScriptCore/runtime/RegExpGlobalDataInlines.h M Source/JavaScriptCore/runtime/StringPrototype.cpp A Source/JavaScriptCore/runtime/StringReplaceCache.h A Source/JavaScriptCore/runtime/StringReplaceCacheInlines.h M Source/JavaScriptCore/runtime/VM.h Log Message: ----------- [JSC] Add global replace caching https://bugs.webkit.org/show_bug.cgi?id=257826 rdar://110417641 Reviewed by Michael Saboff. This patch adds String.replace(/regexp-global/g, func) result cache, which is in the same fashion to V8's cache. We cache the result only when the subject string length is >= 0x1000, aligned to V8's behavior. This cache is cleared on every GC, so it does not affect on memory usage in practice: once GC happens, everything gets cleared, so it is not retaining things. * JSTests/stress/v8-regexp-results-cache.js: Added. * JSTests/stress/v8-string-replace-cache.js: Added. (replaceTest): (r): (i.r): (string_appeared_here.string_appeared_here.replace_obj.toString): (search_obj.toString): (replace_obj_side_effects.toString): (testIndices99): (testIndices59): (const.fake_replacer.Symbol.toPrimitive): * JSTests/stress/v8-string-replace.js: Added. (replaceTest): (r): (i.r): (string_appeared_here.string_appeared_here.replace_obj.toString): (search_obj.toString): (replace_obj_side_effects.toString): (testIndices99): (testIndices59): (const.fake_replacer.Symbol.toPrimitive): * Source/JavaScriptCore/CMakeLists.txt: * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/heap/Heap.cpp: (JSC::Heap::finalize): * Source/JavaScriptCore/runtime/ArgList.h: * Source/JavaScriptCore/runtime/JSImmutableButterfly.cpp: (JSC::JSImmutableButterfly::tryCreateFromArgList): * Source/JavaScriptCore/runtime/JSImmutableButterfly.h: * Source/JavaScriptCore/runtime/OptionsList.h: * Source/JavaScriptCore/runtime/RegExpGlobalData.h: (JSC::RegExpGlobalData::ovector const): * Source/JavaScriptCore/runtime/RegExpGlobalDataInlines.h: (JSC::RegExpGlobalData::resetResultFromCache): * Source/JavaScriptCore/runtime/StringPrototype.cpp: (JSC::replaceUsingRegExpSearchWithCache): (JSC::replaceUsingRegExpSearch): * Source/JavaScriptCore/runtime/StringReplaceCache.h: Copied from Source/JavaScriptCore/runtime/RegExpGlobalData.h. (JSC::StringReplaceCache::clear): * Source/JavaScriptCore/runtime/StringReplaceCacheInlines.h: Added. (JSC::StringReplaceCache::get): (JSC::StringReplaceCache::set): * Source/JavaScriptCore/runtime/VM.h: Canonical link: https://commits.webkit.org/264967@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes