Changeset 162277 in webkit
- Timestamp:
- Jan 18, 2014 3:09:48 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r162270 r162277 1 2014-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 1 25 2014-01-18 Mark Lam <mark.lam@apple.com> 2 26 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r162256 r162277 1602 1602 } 1603 1603 if (size_t count = unlinkedCodeBlock->numberOfExceptionHandlers()) { 1604 m_rareData->m_exceptionHandlers. grow(count);1604 m_rareData->m_exceptionHandlers.resizeToFit(count); 1605 1605 size_t nonLocalScopeDepth = scope->depth(); 1606 1606 for (size_t i = 0; i < count; i++) { … … 2602 2602 } 2603 2603 } // 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();2607 2604 } 2608 2605 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r162256 r162277 546 546 547 547 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 }563 548 HandlerInfo& exceptionHandler(int index) { RELEASE_ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; } 564 549
Note: See TracChangeset
for help on using the changeset viewer.