Skip to content

Commit 8461269

Browse files
committed
[JSC] DEFINE_VISIT_AGGREGATE for StringReplaceaCache should be used in source file
https://bugs.webkit.org/show_bug.cgi?id=290251 Reviewed by Yusuke Suzuki. `DEFINE_VISIT_AGGREGATE` defines not-ininlined functions[1], so it should be used in source file. However, it is used in `StringReplaceCacheInlines.h`. This patch fixes it. [1]: https://github.com/WebKit/WebKit/blob/b12ed39572951123a4b5a99c471e0262e9481001/Source/JavaScriptCore/heap/SlotVisitorMacros.h#L54-L60 * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/Sources.txt: * Source/JavaScriptCore/runtime/StringReplaceCache.cpp: Added. (JSC::StringReplaceCache::visitAggregateImpl): * Source/JavaScriptCore/runtime/StringReplaceCacheInlines.h: (JSC::StringReplaceCache::visitAggregateImpl): Deleted. Canonical link: https://commits.webkit.org/292554@main
1 parent 409c930 commit 8461269

4 files changed

Lines changed: 45 additions & 11 deletions

File tree

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4817,6 +4817,7 @@
48174817
8BC064901E1AD6AC00B2B8CA /* AsyncGeneratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncGeneratorPrototype.h; sourceTree = "<group>"; };
48184818
8BC064931E1D828B00B2B8CA /* AsyncIteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncIteratorPrototype.cpp; sourceTree = "<group>"; };
48194819
8BC064941E1D828B00B2B8CA /* AsyncIteratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncIteratorPrototype.h; sourceTree = "<group>"; };
4820+
8C469C292D8EBC8A008C6403 /* StringReplaceCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StringReplaceCache.cpp; sourceTree = "<group>"; };
48204821
8CB955C92C8AF8D000282DA2 /* JSAsyncFromSyncIterator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAsyncFromSyncIterator.cpp; sourceTree = "<group>"; };
48214822
8CB955CA2C8AF8E100282DA2 /* JSAsyncFromSyncIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAsyncFromSyncIterator.h; sourceTree = "<group>"; };
48224823
8CB955CC2C8AF8F500282DA2 /* JSAsyncFromSyncIteratorInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAsyncFromSyncIteratorInlines.h; sourceTree = "<group>"; };
@@ -8895,6 +8896,7 @@
88958896
E325A35F2221158A007349A1 /* StringPrototypeInlines.h */,
88968897
93345A8712D838C400302BE3 /* StringRecursionChecker.cpp */,
88978898
93345A8812D838C400302BE3 /* StringRecursionChecker.h */,
8899+
8C469C292D8EBC8A008C6403 /* StringReplaceCache.cpp */,
88988900
E35B36062A2E981E004EC264 /* StringReplaceCache.h */,
88998901
E35B36052A2E981E004EC264 /* StringReplaceCacheInlines.h */,
89008902
E36706292A2705DB00CF892F /* StringSplitCache.h */,

Source/JavaScriptCore/Sources.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,7 @@ runtime/StringIteratorPrototype.cpp
10591059
runtime/StringObject.cpp
10601060
runtime/StringPrototype.cpp
10611061
runtime/StringRecursionChecker.cpp
1062+
runtime/StringReplaceCache.cpp
10621063
runtime/Structure.cpp
10631064
runtime/StructureCache.cpp
10641065
runtime/StructureChain.cpp
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (C) 2025 Sosuke Suzuki <aosukeke@gmail.com>.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#include "config.h"
27+
#include "StringReplaceCache.h"
28+
29+
namespace JSC {
30+
31+
DEFINE_VISIT_AGGREGATE(StringReplaceCache);
32+
33+
template<typename Visitor>
34+
void StringReplaceCache::visitAggregateImpl(Visitor& visitor)
35+
{
36+
for (auto& entry : m_entries) {
37+
visitor.appendUnbarriered(entry.m_regExp);
38+
visitor.appendUnbarriered(entry.m_result);
39+
}
40+
}
41+
42+
}

Source/JavaScriptCore/runtime/StringReplaceCacheInlines.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,4 @@ inline void StringReplaceCache::set(const String& subject, RegExp* regExp, JSImm
8989
}
9090
}
9191

92-
template<typename Visitor>
93-
inline void StringReplaceCache::visitAggregateImpl(Visitor& visitor)
94-
{
95-
for (auto& entry : m_entries) {
96-
visitor.appendUnbarriered(entry.m_regExp);
97-
visitor.appendUnbarriered(entry.m_result);
98-
}
99-
}
100-
101-
DEFINE_VISIT_AGGREGATE(StringReplaceCache);
102-
10392
} // namespace JSC

0 commit comments

Comments
 (0)