<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: https://svn.webkit.org/repository/webkit/trunk@162277
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+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.
}
}
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);
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)
// 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(); }