Commit f1241693 authored by akling@apple.com's avatar akling@apple.com

CodeBlock: Size m_function{Exprs,Decls} to fit from creation.

<https://webkit.org/b/127238>

Reviewed by Anders Carlsson.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):

    Use resizeToFit() instead of grow() for m_functionExprs and
    m_functionDecls since we know they will never change size.

(JSC::CodeBlock::shrinkToFit):

    No need to shrink them here anymore.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162281 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b6f83685
2014-01-18 Andreas Kling <akling@apple.com>
CodeBlock: Size m_function{Exprs,Decls} to fit from creation.
<https://webkit.org/b/127238>
Reviewed by Anders Carlsson.
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
Use resizeToFit() instead of grow() for m_functionExprs and
m_functionDecls since we know they will never change size.
(JSC::CodeBlock::shrinkToFit):
No need to shrink them here anymore.
2014-01-18 Andreas Kling <akling@apple.com>
Remove unused CodeBlock::m_additionalIdentifiers member.
......
......@@ -1558,7 +1558,7 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin
setConstantRegisters(unlinkedCodeBlock->constantRegisters());
if (unlinkedCodeBlock->usesGlobalObject())
m_constantRegisters[unlinkedCodeBlock->globalObjectRegister().offset()].set(*m_vm, ownerExecutable, m_globalObject.get());
m_functionDecls.grow(unlinkedCodeBlock->numberOfFunctionDecls());
m_functionDecls.resizeToFit(unlinkedCodeBlock->numberOfFunctionDecls());
for (size_t count = unlinkedCodeBlock->numberOfFunctionDecls(), i = 0; i < count; ++i) {
UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionDecl(i);
unsigned lineCount = unlinkedExecutable->lineCount();
......@@ -1574,7 +1574,7 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin
m_functionDecls[i].set(*m_vm, ownerExecutable, executable);
}
m_functionExprs.grow(unlinkedCodeBlock->numberOfFunctionExprs());
m_functionExprs.resizeToFit(unlinkedCodeBlock->numberOfFunctionExprs());
for (size_t count = unlinkedCodeBlock->numberOfFunctionExprs(), i = 0; i < count; ++i) {
UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionExpr(i);
unsigned lineCount = unlinkedExecutable->lineCount();
......@@ -2590,8 +2590,6 @@ void CodeBlock::shrinkToFit(ShrinkMode shrinkMode)
m_specialFastCaseProfiles.shrinkToFit();
if (shrinkMode == EarlyShrink) {
m_functionDecls.shrinkToFit();
m_functionExprs.shrinkToFit();
m_constantRegisters.shrinkToFit();
if (m_rareData) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment