WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 86436
shrinkToFit() is often not called for Vectors in CodeBlock
https://bugs.webkit.org/show_bug.cgi?id=86436
Summary
shrinkToFit() is often not called for Vectors in CodeBlock
Simon Fraser (smfr)
Reported
2012-05-14 21:55:57 PDT
Data collected via
bug 86281
show that a lot of vector capacity is wasted via the Vectors allocated here: 2200 vectors, 17.20KB used of 550.00KB, 532.80KB wasted at: 1 0x1069ac725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector() 2 0x1069abf25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector() 3 0x1069abeb6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector() 4 0x10699c805 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector() 5 0x1069958d1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 2200 vectors, 20.92KB used of 550.00KB, 529.08KB wasted at: 1 0x1069ad1b5 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector() 2 0x1069ad135 WTF::Vector<WTF::Vector<JSC::LLIntCallLinkInfo, 8ul>*, 32ul>::Vector() 3 0x1069ad0e6 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector() 4 0x10699c675 WTF::SegmentedVector<JSC::LLIntCallLinkInfo, 8ul>::SegmentedVector() 5 0x1069957a1 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 2200 vectors, 21.14KB used of 550.00KB, 528.86KB wasted at: 1 0x1069ac725 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector() 2 0x1069abf25 WTF::Vector<WTF::Vector<JSC::RareCaseProfile, 8ul>*, 32ul>::Vector() 3 0x1069abeb6 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector() 4 0x10699c805 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector() 5 0x1069958be JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 2200 vectors, 43.21KB used of 550.47KB, 507.26KB wasted at: 1 0x1069aca05 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector() 2 0x1069ac985 WTF::Vector<WTF::Vector<JSC::ValueProfile, 8ul>*, 32ul>::Vector() 3 0x1069ac936 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector() 4 0x10699c7e5 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector() 5 0x1069958ab JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 1996 vectors, 323.72KB used of 665.81KB, 342.09KB wasted at: 1 0x1069acf45 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector() 2 0x10699c6b5 WTF::Vector<JSC::StructureStubInfo, 0ul>::Vector() 3 0x1069957c7 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 4 0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 5 0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 1996 vectors, 102.31KB used of 372.38KB, 270.06KB wasted at: 1 0x1069ace65 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector() 2 0x10699c705 WTF::Vector<JSC::CallLinkInfo, 0ul>::Vector() 3 0x1069957ed JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 4 0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 5 0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 1996 vectors, 57.59KB used of 276.23KB, 218.64KB wasted at: 1 0x1069acd65 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector() 2 0x10699c725 WTF::Vector<JSC::MethodCallLinkInfo, 0ul>::Vector() 3 0x106995800 JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 4 0x106a9ea22 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 5 0x106a97ab8 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 2200 vectors, 380.47KB used of 550.00KB, 169.53KB wasted at: 1 0x106985f15 WTF::Vector<JSC::ValueProfile, 8ul>::Vector() 2 0x106985d35 WTF::Vector<JSC::ValueProfile, 8ul>::Vector() 3 0x1069ac924 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector() 4 0x10699c7e5 WTF::SegmentedVector<JSC::ValueProfile, 8ul>::SegmentedVector() 5 0x1069958ab JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>)
Attachments
the patch
(8.65 KB, patch)
2012-05-15 14:38 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(9.06 KB, patch)
2012-05-15 14:41 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(10.01 KB, patch)
2012-05-15 14:44 PDT
,
Filip Pizlo
oliver
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
patch for EWS
(10.09 KB, patch)
2012-05-15 17:36 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Filip Pizlo
Comment 1
2012-05-15 13:44:33 PDT
***
Bug 86437
has been marked as a duplicate of this bug. ***
Filip Pizlo
Comment 2
2012-05-15 13:52:33 PDT
***
Bug 86435
has been marked as a duplicate of this bug. ***
Filip Pizlo
Comment 3
2012-05-15 14:38:05 PDT
Created
attachment 142058
[details]
the patch
Filip Pizlo
Comment 4
2012-05-15 14:41:44 PDT
Created
attachment 142061
[details]
the patch Decided to write a comment clearly defining what I mean by "EarlyShrink" and "LateShrink".
Filip Pizlo
Comment 5
2012-05-15 14:44:52 PDT
Created
attachment 142062
[details]
the patch Realized that it might be a good idea to have a change log for WTF.
Oliver Hunt
Comment 6
2012-05-15 14:48:34 PDT
Comment on
attachment 142062
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142062&action=review
> Source/JavaScriptCore/bytecode/CodeBlock.cpp:2130 > m_rareData->m_lineInfo.shrinkToFit();
I think we always have line info now -- it seems we should pull it out of rareData so we're not unnecessarily creating what is intended to be an uncommon allocation.
> Source/JavaScriptCore/bytecode/CodeBlock.cpp:2136 > + m_rareData->m_callReturnIndexVector.shrinkToFit(); > +#endif > +#if ENABLE(DFG_JIT) > + m_rareData->m_inlineCallFrames.shrinkToFit(); > + m_rareData->m_codeOrigins.shrinkToFit();
Ditto for these -- do we want a lazily instantiated m_jitData member perhaps?
Filip Pizlo
Comment 7
2012-05-15 14:50:00 PDT
(In reply to
comment #6
)
> (From update of
attachment 142062
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=142062&action=review
> > > Source/JavaScriptCore/bytecode/CodeBlock.cpp:2130 > > m_rareData->m_lineInfo.shrinkToFit(); > > I think we always have line info now -- it seems we should pull it out of rareData so we're not unnecessarily creating what is intended to be an uncommon allocation. > > > Source/JavaScriptCore/bytecode/CodeBlock.cpp:2136 > > + m_rareData->m_callReturnIndexVector.shrinkToFit(); > > +#endif > > +#if ENABLE(DFG_JIT) > > + m_rareData->m_inlineCallFrames.shrinkToFit(); > > + m_rareData->m_codeOrigins.shrinkToFit(); > > Ditto for these -- do we want a lazily instantiated m_jitData member perhaps?
Separate patch for both?
Build Bot
Comment 8
2012-05-15 17:32:14 PDT
Comment on
attachment 142062
[details]
the patch
Attachment 142062
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12694792
Filip Pizlo
Comment 9
2012-05-15 17:36:32 PDT
Created
attachment 142108
[details]
patch for EWS
Filip Pizlo
Comment 10
2012-05-15 17:57:13 PDT
Landed in
http://trac.webkit.org/changeset/117198
Simon Fraser (smfr)
Comment 11
2012-05-15 19:39:07 PDT
Even after this change I see a lot of wasted capacity under: 1 0x108813e54 WTF::SegmentedVector<JSC::RareCaseProfile, 8ul>::SegmentedVector() 2 0x10880c43d JSC::CodeBlock::CodeBlock(JSC::ScriptExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, WTF::HashMap<WTF::RefPtr<WTF::StringImpl>, JSC::SymbolTableEntry, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::StringImpl> >, JSC::SymbolTableIndexHashTraits>*, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 3 0x108878757 JSC::FunctionCodeBlock::FunctionCodeBlock(JSC::FunctionExecutable*, JSC::CodeType, JSC::JSGlobalObject*, WTF::PassRefPtr<JSC::SourceProvider>, unsigned int, bool, WTF::PassOwnPtr<JSC::CodeBlock>) 4 0x108875c5b JSC::FunctionExecutable::produceCodeBlockFor(JSC::ScopeChainNode*, JSC::CompilationKind, JSC::CodeSpecializationKind, JSC::JSObject*&) 5 0x108875689 JSC::FunctionExecutable::compileForCallInternal(JSC::ExecState*, JSC::ScopeChainNode*, JSC::JITCode::JITType)
Simon Fraser (smfr)
Comment 12
2012-05-15 19:41:07 PDT
Actually RareCaseProfile, LLIntCallLinkInfo and ValueProfile still show up as having lots of wasted capacity.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug