Skip to content

Commit 7d2f95f

Browse files
committed
[CMake] Unified-source hygiene fixes for larger bundles
https://bugs.webkit.org/show_bug.cgi?id=315878 rdar://178278128 Reviewed by David Kilzer and Mike Wyrzykowski. Fix name collisions and ODR issues that surface when the unified-source bundle size grows beyond 8. No behavior change at the current bundle size; prepares for a follow-up that raises bundle size to speed up clean builds (without regressing incremental builds). - Fixed missing includes (for files that move between bundles) - Resolved conflicts from file-scoped "using namespace": * Removed "using namespace" in some cases * Added namespace qualifications in other cases - Resolved SoftLinking conflicts: * Class -> ::Class * Un-forwarded *_FOR_SOURCE macros so legacy and per-framework-source soft-link macros coexist in one TU * Guarded duplicate use of SOFT_LINK - TestWebKitAPI: uniquify file-static globals - WebKit::PDFDisplayMode -> PDFPluginDisplayMode (shadows SDK type) - Qualified WTF::toNSData - Qualified MathMLNames:: - WorldMap -> DOMWrapperWorldMap - WeakMapImpl.h: forward-declare takeSnapshot specializations - HTMLMediaElement.h: remove bogus MachSendRightAnnotated forward declaration Canonical link: https://commits.webkit.org/314190@main
1 parent b65c1e5 commit 7d2f95f

139 files changed

Lines changed: 1174 additions & 1017 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/b3/air/opcode_generator.rb‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -939,13 +939,12 @@ def endArchs(outp, archs)
939939
outp.puts "#include \"CCallHelpers.h\""
940940
outp.puts "#include \"wtf/PrintStream.h\""
941941
outp.puts "namespace WTF {"
942-
outp.puts "using namespace JSC::B3::Air;"
943-
outp.puts "void printInternal(PrintStream& out, Opcode opcode)"
942+
outp.puts "void printInternal(PrintStream& out, JSC::B3::Air::Opcode opcode)"
944943
outp.puts "{"
945944
outp.puts " switch (opcode) {"
946945
$opcodes.keys.each {
947946
| opcode |
948-
outp.puts " case Opcode::#{opcode}:"
947+
outp.puts " case JSC::B3::Air::Opcode::#{opcode}:"
949948
outp.puts " out.print(\"#{opcode}\");"
950949
outp.puts " return;"
951950
}

‎Source/JavaScriptCore/dfg/DFGNode.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ void printInternal(PrintStream& out, SwitchKind kind)
535535
RELEASE_ASSERT_NOT_REACHED();
536536
}
537537

538-
void printInternal(PrintStream& out, Node* node)
538+
void printInternal(PrintStream& out, JSC::DFG::Node* node)
539539
{
540540
if (!node) {
541541
out.print("-");

‎Source/JavaScriptCore/ftl/FTLCapabilities.cpp‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static bool NODELETE verboseCapabilities()
3737
return verboseCompilationEnabled() || Options::verboseFTLFailure();
3838
}
3939

40-
inline CapabilityLevel canCompile(Node* node)
40+
inline CapabilityLevel canCompile(DFG::Node* node)
4141
{
4242
// NOTE: If we ever have phantom arguments, we can compile them but we cannot
4343
// OSR enter.
@@ -59,7 +59,7 @@ inline CapabilityLevel canCompile(Node* node)
5959
case ExtractFromTuple:
6060
case SetArgumentDefinitely:
6161
case SetArgumentMaybe:
62-
case Return:
62+
case DFG::Return:
6363
case ArithBitNot:
6464
case ArithBitAnd:
6565
case ArithBitOr:
@@ -132,10 +132,10 @@ inline CapabilityLevel canCompile(Node* node)
132132
case ArithNegate:
133133
case ArithUnary:
134134
case UInt32ToNumber:
135-
case Jump:
135+
case DFG::Jump:
136136
case ForceOSRExit:
137-
case Phi:
138-
case Upsilon:
137+
case DFG::Phi:
138+
case DFG::Upsilon:
139139
case ExtractOSREntryLocal:
140140
case ExtractCatchLocal:
141141
case ClearCatchLocals:
@@ -215,14 +215,14 @@ inline CapabilityLevel canCompile(Node* node)
215215
case VarargsLength:
216216
case LoadVarargs:
217217
case ValueToInt32:
218-
case Branch:
218+
case DFG::Branch:
219219
case ToBoolean:
220220
case LogicalNot:
221221
case AssertInBounds:
222222
case CheckInBounds:
223223
case CheckInBoundsInt52:
224224
case ConstantStoragePointer:
225-
case Check:
225+
case DFG::Check:
226226
case CheckVarargs:
227227
case CheckArray:
228228
case CheckArrayOrEmpty:
@@ -340,9 +340,9 @@ inline CapabilityLevel canCompile(Node* node)
340340
case InstanceOfMegamorphic:
341341
case InstanceOfCustom:
342342
case DoubleRep:
343-
case ValueRep:
343+
case DFG::ValueRep:
344344
case Int52Rep:
345-
case PurifyNaN:
345+
case DFG::PurifyNaN:
346346
case DoubleConstant:
347347
case Int52Constant:
348348
case BooleanToNumber:
@@ -383,8 +383,8 @@ inline CapabilityLevel canCompile(Node* node)
383383
case GetMyArgumentByVal:
384384
case GetMyArgumentByValOutOfBounds:
385385
case ForwardVarargs:
386-
case EntrySwitch:
387-
case Switch:
386+
case DFG::EntrySwitch:
387+
case DFG::Switch:
388388
case TypeOf:
389389
case PutById:
390390
case PutByIdDirect:
@@ -532,7 +532,7 @@ inline CapabilityLevel canCompile(Node* node)
532532
// These are OK.
533533
break;
534534

535-
case Identity:
535+
case DFG::Identity:
536536
// No backend handles this because it will be optimized out. But we may check
537537
// for capabilities before optimization. It would be a deep error to remove this
538538
// case because it would prevent us from catching bugs where the FTL backend
@@ -568,7 +568,7 @@ CapabilityLevel canCompile(Graph& graph)
568568
CapabilityLevel result = CanCompileAndOSREnter;
569569

570570
for (BlockIndex blockIndex = graph.numBlocks(); blockIndex--;) {
571-
BasicBlock* block = graph.block(blockIndex);
571+
DFG::BasicBlock* block = graph.block(blockIndex);
572572
if (!block)
573573
continue;
574574

@@ -577,8 +577,8 @@ CapabilityLevel canCompile(Graph& graph)
577577
continue;
578578

579579
for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
580-
Node* node = block->at(nodeIndex);
581-
580+
DFG::Node* node = block->at(nodeIndex);
581+
582582
for (unsigned childIndex = graph.numChildren(node); childIndex--;) {
583583
Edge edge = graph.child(node, childIndex);
584584
if (!edge)

‎Source/JavaScriptCore/ftl/FTLCompile.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void compile(State& state, Safepoint::Result& safepointResult)
356356

357357
DumpContext dumpContext;
358358
StringPrintStream out;
359-
Node* lastNode = nullptr;
359+
DFG::Node* lastNode = nullptr;
360360
for (size_t blockIndex = 0; blockIndex < graph.numBlocks(); ++blockIndex) {
361361
DFG::BasicBlock* block = graph.block(blockIndex);
362362
if (!block)
@@ -367,7 +367,7 @@ void compile(State& state, Safepoint::Result& safepointResult)
367367
out.reset();
368368

369369
for (size_t nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
370-
Node* node = block->at(nodeIndex);
370+
DFG::Node* node = block->at(nodeIndex);
371371

372372
Profiler::OriginStack stack;
373373

@@ -398,7 +398,7 @@ void compile(State& state, Safepoint::Result& safepointResult)
398398
compilation->addDescription(Profiler::OriginStack(), out.toCString());
399399
out.reset();
400400

401-
state.dumpDisassembly(out, *state.b3CodeLinkBuffer, scopedLambda<void(Node*)>([&] (Node*) {
401+
state.dumpDisassembly(out, *state.b3CodeLinkBuffer, scopedLambda<void(DFG::Node*)>([&] (DFG::Node*) {
402402
compilation->addDescription({ }, out.toCString());
403403
out.reset();
404404
}));

‎Source/JavaScriptCore/ftl/FTLExitTimeObjectMaterialization.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace JSC { namespace FTL {
3434

3535
using namespace JSC::DFG;
3636

37-
ExitTimeObjectMaterialization::ExitTimeObjectMaterialization(Node* node, CodeOrigin codeOrigin)
37+
ExitTimeObjectMaterialization::ExitTimeObjectMaterialization(DFG::Node* node, CodeOrigin codeOrigin)
3838
: m_type(node->op())
3939
, m_indexingType(node->hasIndexingType() ? node->indexingType() : NoIndexingShape)
4040
, m_origin(codeOrigin)

‎Source/JavaScriptCore/ftl/FTLState.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ void State::dumpDisassembly(PrintStream& out, LinkBuffer& linkBuffer, const Scop
9393
out.print("Generated ", graph.m_plan.mode(), " code for ", CodeBlockWithJITType(graph.m_codeBlock, JITType::FTLJIT), ", instructions size = ", graph.m_codeBlock->instructionsSize(), ":\n");
9494

9595
B3::Value* currentB3Value = nullptr;
96-
Node* currentDFGNode = nullptr;
96+
DFG::Node* currentDFGNode = nullptr;
9797

9898
UncheckedKeyHashSet<B3::Value*> printedValues;
99-
UncheckedKeyHashSet<Node*> printedNodes;
99+
UncheckedKeyHashSet<DFG::Node*> printedNodes;
100100
const char* dfgPrefix = "DFG " " ";
101101
const char* b3Prefix = "b3 " " ";
102102
const char* airPrefix = "Air " " ";
103103
const char* asmPrefix = "asm " " ";
104104

105-
auto printDFGNode = [&] (Node* node) {
105+
auto printDFGNode = [&] (DFG::Node* node) {
106106
if (currentDFGNode == node)
107107
return;
108108

@@ -112,8 +112,8 @@ void State::dumpDisassembly(PrintStream& out, LinkBuffer& linkBuffer, const Scop
112112

113113
perDFGNodeCallback(node);
114114

115-
UncheckedKeyHashSet<Node*> localPrintedNodes;
116-
WTF::Function<void(Node*)> printNodeRecursive = [&] (Node* node) {
115+
UncheckedKeyHashSet<DFG::Node*> localPrintedNodes;
116+
WTF::Function<void(DFG::Node*)> printNodeRecursive = [&] (DFG::Node* node) {
117117
if (printedNodes.contains(node) || localPrintedNodes.contains(node))
118118
return;
119119

‎Source/JavaScriptCore/runtime/WeakMapImpl.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ class WeakMapImpl : public JSNonFinalObject {
453453
uint32_t m_deleteCount { 0 };
454454
};
455455

456+
template<> void WeakMapImpl<WeakMapBucket<WeakMapBucketDataKey>>::takeSnapshot(MarkedArgumentBuffer&, unsigned);
457+
template<> void WeakMapImpl<WeakMapBucket<WeakMapBucketDataKeyValue>>::takeSnapshot(MarkedArgumentBuffer&, unsigned);
458+
456459
} // namespace JSC
457460

458461
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END

0 commit comments

Comments
 (0)