Changeset 162277 in webkit


Ignore:
Timestamp:
Jan 18, 2014 3:09:48 PM (10 years ago)
Author:
akling@apple.com
Message:

CodeBlock: Size m_exceptionHandlers to fit from creation.
<https://webkit.org/b/127234>

Avoid allocation churn for CodeBlock::m_exceptionHandlers.

Reviewed by Anders Carlsson.

  • bytecode/CodeBlock.h:

Removed unused CodeBlock::allocateHandlers() function.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):

Use resizeToFit() instead of grow() for m_exceptionHandlers
since we know it's never going to change size.

(JSC::CodeBlock::shrinkToFit):

No need to shrink m_exceptionHandlers here since it's already
the perfect size.

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r162270 r162277  
     12014-01-18  Andreas Kling  <akling@apple.com>
     2
     3        CodeBlock: Size m_exceptionHandlers to fit from creation.
     4        <https://webkit.org/b/127234>
     5
     6        Avoid allocation churn for CodeBlock::m_exceptionHandlers.
     7
     8        Reviewed by Anders Carlsson.
     9
     10        * bytecode/CodeBlock.h:
     11
     12            Removed unused CodeBlock::allocateHandlers() function.
     13
     14        * bytecode/CodeBlock.cpp:
     15        (JSC::CodeBlock::CodeBlock):
     16
     17            Use resizeToFit() instead of grow() for m_exceptionHandlers
     18            since we know it's never going to change size.
     19
     20        (JSC::CodeBlock::shrinkToFit):
     21
     22            No need to shrink m_exceptionHandlers here since it's already
     23            the perfect size.
     24
    1252014-01-18  Mark Lam  <mark.lam@apple.com>
    226
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r162256 r162277  
    16021602        }
    16031603        if (size_t count = unlinkedCodeBlock->numberOfExceptionHandlers()) {
    1604             m_rareData->m_exceptionHandlers.grow(count);
     1604            m_rareData->m_exceptionHandlers.resizeToFit(count);
    16051605            size_t nonLocalScopeDepth = scope->depth();
    16061606            for (size_t i = 0; i < count; i++) {
     
    26022602        }
    26032603    } // else don't shrink these, because we would have already pointed pointers into these tables.
    2604 
    2605     if (m_rareData)
    2606         m_rareData->m_exceptionHandlers.shrinkToFit();
    26072604}
    26082605
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r162256 r162277  
    546546
    547547    size_t numberOfExceptionHandlers() const { return m_rareData ? m_rareData->m_exceptionHandlers.size() : 0; }
    548     void allocateHandlers(const Vector<UnlinkedHandlerInfo>& unlinkedHandlers)
    549     {
    550         size_t count = unlinkedHandlers.size();
    551         if (!count)
    552             return;
    553         createRareDataIfNecessary();
    554         m_rareData->m_exceptionHandlers.resize(count);
    555         for (size_t i = 0; i < count; ++i) {
    556             m_rareData->m_exceptionHandlers[i].start = unlinkedHandlers[i].start;
    557             m_rareData->m_exceptionHandlers[i].end = unlinkedHandlers[i].end;
    558             m_rareData->m_exceptionHandlers[i].target = unlinkedHandlers[i].target;
    559             m_rareData->m_exceptionHandlers[i].scopeDepth = unlinkedHandlers[i].scopeDepth;
    560         }
    561 
    562     }
    563548    HandlerInfo& exceptionHandler(int index) { RELEASE_ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; }
    564549
Note: See TracChangeset for help on using the changeset viewer.