CodeBlock: Size m_function{Exprs,Decls} to fit from creation.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jan 2014 23:35:34 +0000 (23:35 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jan 2014 23:35:34 +0000 (23:35 +0000)
<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: https://svn.webkit.org/repository/webkit/trunk@162281 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp

index 35dd53b2b236cb552c63db0de3be14ea956530b2..73851bdeee7149a7d2816384bd83e2c7b35734e5 100644 (file)
@@ -1,3 +1,20 @@
+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.
index cc24ddc74c0dea8c65a9c40f6e0218978237b537..4ff29d335c39e76448e2546945d1cb6306c1fe50 100644 (file)
@@ -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) {