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

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 014a9151
2014-01-18 Andreas Kling <akling@apple.com>
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.
2014-01-18 Mark Lam <mark.lam@apple.com>
Add a hasBreakpointFlag arg to the op_debug bytecode.
......
......@@ -1601,7 +1601,7 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin
}
}
if (size_t count = unlinkedCodeBlock->numberOfExceptionHandlers()) {
m_rareData->m_exceptionHandlers.grow(count);
m_rareData->m_exceptionHandlers.resizeToFit(count);
size_t nonLocalScopeDepth = scope->depth();
for (size_t i = 0; i < count; i++) {
const UnlinkedHandlerInfo& handler = unlinkedCodeBlock->exceptionHandler(i);
......@@ -2601,9 +2601,6 @@ void CodeBlock::shrinkToFit(ShrinkMode shrinkMode)
m_rareData->m_stringSwitchJumpTables.shrinkToFit();
}
} // else don't shrink these, because we would have already pointed pointers into these tables.
if (m_rareData)
m_rareData->m_exceptionHandlers.shrinkToFit();
}
void CodeBlock::createActivation(CallFrame* callFrame)
......
......@@ -545,21 +545,6 @@ public:
// Exception handling support
size_t numberOfExceptionHandlers() const { return m_rareData ? m_rareData->m_exceptionHandlers.size() : 0; }
void allocateHandlers(const Vector<UnlinkedHandlerInfo>& unlinkedHandlers)
{
size_t count = unlinkedHandlers.size();
if (!count)
return;
createRareDataIfNecessary();
m_rareData->m_exceptionHandlers.resize(count);
for (size_t i = 0; i < count; ++i) {
m_rareData->m_exceptionHandlers[i].start = unlinkedHandlers[i].start;
m_rareData->m_exceptionHandlers[i].end = unlinkedHandlers[i].end;
m_rareData->m_exceptionHandlers[i].target = unlinkedHandlers[i].target;
m_rareData->m_exceptionHandlers[i].scopeDepth = unlinkedHandlers[i].scopeDepth;
}
}
HandlerInfo& exceptionHandler(int index) { RELEASE_ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; }
bool hasExpressionInfo() { return m_unlinkedCode->hasExpressionInfo(); }
......
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