Changeset 275866 in webkit
- Timestamp:
- Apr 13, 2021, 12:35:38 AM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
bytecode/BytecodeDumper.cpp (modified) (1 diff)
-
bytecode/CodeBlock.cpp (modified) (3 diffs)
-
bytecode/CodeBlock.h (modified) (5 diffs)
-
bytecode/UnlinkedCodeBlock.h (modified) (1 diff)
-
bytecode/UnlinkedCodeBlockGenerator.h (modified) (1 diff)
-
dfg/DFGGraph.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r275860 r275866 1 2021-04-12 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Remove CodeBlock::m_constantsSourceCodeRepresentation 4 https://bugs.webkit.org/show_bug.cgi?id=224473 5 6 Reviewed by Mark Lam. 7 8 CodeBlock::m_constantsSourceCodeRepresentation is identical to UnlinkedCodeBlock::m_constantsSourceCodeRepresentation. 9 10 1. For all constants existing at bytecode compile time, elements of the above vectors are identical. 11 2. For lazily added constants from DFG, it is always SourceCodeRepresentation::Other. 12 13 And the array is effectively accessed only when compiling DFG code. So we should remove copy of that in CodeBlock, and 14 get SourceCodeRepresentation from UnlinkedCodeBlock. 15 16 * bytecode/BytecodeDumper.cpp: 17 (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): 18 * bytecode/CodeBlock.cpp: 19 (JSC::CodeBlock::CodeBlock): 20 (JSC::CodeBlock::setConstantRegisters): 21 (JSC::CodeBlock::shrinkToFit): 22 * bytecode/CodeBlock.h: 23 (JSC::CodeBlock::constants): 24 (JSC::CodeBlock::addConstant): 25 (JSC::CodeBlock::addConstantLazily): 26 (JSC::CodeBlock::constantSourceCodeRepresentation const): 27 (JSC::CodeBlock::constantsSourceCodeRepresentation): Deleted. 28 * bytecode/UnlinkedCodeBlock.h: 29 (JSC::UnlinkedCodeBlock::constantSourceCodeRepresentation const): 30 * bytecode/UnlinkedCodeBlockGenerator.h: 31 (JSC::UnlinkedCodeBlockGenerator::constantSourceCodeRepresentation const): 32 (JSC::UnlinkedCodeBlockGenerator::constantsSourceCodeRepresentation): Deleted. 33 * dfg/DFGGraph.cpp: 34 (JSC::DFG::Graph::registerFrozenValues): 35 1 36 2021-04-12 Mark Lam <mark.lam@apple.com> 2 37 -
trunk/Source/JavaScriptCore/bytecode/BytecodeDumper.cpp
r275840 r275866 138 138 for (const auto& constant : this->block()->constantRegisters()) { 139 139 const char* sourceCodeRepresentationDescription = nullptr; 140 switch (this->block()->constant sSourceCodeRepresentation()[i]) {140 switch (this->block()->constantSourceCodeRepresentation(i)) { 141 141 case SourceCodeRepresentation::Double: 142 142 sourceCodeRepresentationDescription = ": in source as double"; -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r275840 r275866 297 297 , m_instructionsRawPointer(other.m_instructionsRawPointer) 298 298 , m_constantRegisters(other.m_constantRegisters) 299 , m_constantsSourceCodeRepresentation(other.m_constantsSourceCodeRepresentation)300 299 , m_functionDecls(other.m_functionDecls) 301 300 , m_functionExprs(other.m_functionExprs) … … 884 883 ConcurrentJSLocker locker(m_lock); 885 884 m_constantRegisters.resizeToFit(count); 886 m_constantsSourceCodeRepresentation.resizeToFit(count);887 885 } 888 886 for (size_t i = 0; i < count; i++) { 889 887 JSValue constant = constants[i].get(); 890 888 SourceCodeRepresentation representation = constantsSourceCodeRepresentation[i]; 891 m_constantsSourceCodeRepresentation[i] = representation;892 889 switch (representation) { 893 890 case SourceCodeRepresentation::LinkTimeConstant: … … 2125 2122 m_constantRegisters.shrinkToFit(); 2126 2123 #endif 2127 m_constantsSourceCodeRepresentation.shrinkToFit();2128 2124 2129 2125 if (shrinkMode == ShrinkMode::EarlyShrink) { -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r275840 r275866 573 573 574 574 Vector<WriteBarrier<Unknown>>& constants() { return m_constantRegisters; } 575 Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; }576 575 unsigned addConstant(const ConcurrentJSLocker&, JSValue v) 577 576 { … … 579 578 m_constantRegisters.append(WriteBarrier<Unknown>()); 580 579 m_constantRegisters.last().set(*m_vm, this, v); 581 m_constantsSourceCodeRepresentation.append(SourceCodeRepresentation::Other);582 580 return result; 583 581 } … … 587 585 unsigned result = m_constantRegisters.size(); 588 586 m_constantRegisters.append(WriteBarrier<Unknown>()); 589 m_constantsSourceCodeRepresentation.append(SourceCodeRepresentation::Other);590 587 return result; 591 588 } … … 594 591 WriteBarrier<Unknown>& constantRegister(VirtualRegister reg) { return m_constantRegisters[reg.toConstantIndex()]; } 595 592 ALWAYS_INLINE JSValue getConstant(VirtualRegister reg) const { return m_constantRegisters[reg.toConstantIndex()].get(); } 596 ALWAYS_INLINE SourceCodeRepresentation constantSourceCodeRepresentation(VirtualRegister reg) const { return m_constantsSourceCodeRepresentation[reg.toConstantIndex()]; } 593 ALWAYS_INLINE SourceCodeRepresentation constantSourceCodeRepresentation(VirtualRegister reg) const { return m_unlinkedCode->constantSourceCodeRepresentation(reg); } 594 ALWAYS_INLINE SourceCodeRepresentation constantSourceCodeRepresentation(unsigned index) const { return m_unlinkedCode->constantSourceCodeRepresentation(index); } 597 595 598 596 FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); } … … 1047 1045 // it, so we're stuck with it for now. 1048 1046 Vector<WriteBarrier<Unknown>> m_constantRegisters; 1049 Vector<SourceCodeRepresentation> m_constantsSourceCodeRepresentation;1050 1047 FixedVector<WriteBarrier<FunctionExecutable>> m_functionDecls; 1051 1048 FixedVector<WriteBarrier<FunctionExecutable>> m_functionExprs; -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r275840 r275866 162 162 const FixedVector<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; } 163 163 164 SourceCodeRepresentation constantSourceCodeRepresentation(VirtualRegister reg) const 165 { 166 return constantSourceCodeRepresentation(reg.toConstantIndex()); 167 } 168 SourceCodeRepresentation constantSourceCodeRepresentation(unsigned index) const 169 { 170 if (index < m_constantsSourceCodeRepresentation.size()) 171 return m_constantsSourceCodeRepresentation[index]; 172 return SourceCodeRepresentation::Other; 173 } 174 164 175 unsigned numberOfConstantIdentifierSets() const { return m_rareData ? m_rareData->m_constantIdentifierSets.size() : 0; } 165 176 const FixedVector<IdentifierSet>& constantIdentifierSets() { ASSERT(m_rareData); return m_rareData->m_constantIdentifierSets; } -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.h
r275840 r275866 125 125 const Vector<WriteBarrier<Unknown>>& constantRegisters() { return m_constantRegisters; } 126 126 ALWAYS_INLINE JSValue getConstant(VirtualRegister reg) const { return m_constantRegisters[reg.toConstantIndex()].get(); } 127 const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; } 127 128 SourceCodeRepresentation constantSourceCodeRepresentation(VirtualRegister reg) const 129 { 130 return constantSourceCodeRepresentation(reg.toConstantIndex()); 131 } 132 SourceCodeRepresentation constantSourceCodeRepresentation(unsigned index) const 133 { 134 if (index < m_constantsSourceCodeRepresentation.size()) 135 return m_constantsSourceCodeRepresentation[index]; 136 return SourceCodeRepresentation::Other; 137 } 128 138 129 139 unsigned addConstant(JSValue v, SourceCodeRepresentation sourceCodeRepresentation = SourceCodeRepresentation::Other) -
trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
r275626 r275866 1425 1425 ConcurrentJSLocker locker(m_codeBlock->m_lock); 1426 1426 m_codeBlock->constants().shrink(0); 1427 m_codeBlock->constantsSourceCodeRepresentation().resize(0);1428 1427 for (FrozenValue* value : m_frozenValues) { 1429 1428 if (!value->pointsToHeap()) … … 1446 1445 } 1447 1446 m_codeBlock->constants().shrinkToFit(); 1448 m_codeBlock->constantsSourceCodeRepresentation().shrinkToFit();1449 1447 } 1450 1448
Note:
See TracChangeset
for help on using the changeset viewer.