Changeset 179746 in webkit
- Timestamp:
- Feb 6, 2015, 8:04:39 AM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
bytecompiler/BytecodeGenerator.cpp (modified) (3 diffs)
-
bytecompiler/BytecodeGenerator.h (modified) (3 diffs)
-
bytecompiler/RegisterID.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r179743 r179746 1 2015-02-04 Filip Pizlo <fpizlo@apple.com> 2 3 Remove BytecodeGenerator::preserveLastVar() and replace it with a more robust mechanism for preserving non-temporary registers 4 https://bugs.webkit.org/show_bug.cgi?id=141211 5 6 Reviewed by Mark Lam. 7 8 Previously, the way non-temporary registers were preserved (i.e. not reclaimed anytime 9 we did newTemporary()) by calling preserveLastVar() after all non-temps are created. It 10 would raise the refcount on the last (highest-numbered) variable created, and rely on 11 the fact that register reclamation started at higher-numbered registers and worked its 12 way down. So any retained register would block any lower-numbered registers from being 13 reclaimed. 14 15 Also, preserveLastVar() sets a thing called m_firstConstantIndex. It's unused. 16 17 This removes preserveLastVar() and makes addVar() retain each register it creates. This 18 is more explicit, since addVar() is the mechanism for creating non-temporary registers. 19 20 To make this work I had to remove an assertion that Register::setIndex() can only be 21 called when the refcount is zero. This method might be called after a var is created to 22 change its index. This previously worked because preserveLastVar() would be called after 23 we had already made all index changes, so the vars would still have refcount zero. Now 24 they have refcount 1. I think it's OK to lose this assertion; I can't remember this 25 assertion ever firing in a way that alerted me to a serious issue. 26 27 * bytecompiler/BytecodeGenerator.cpp: 28 (JSC::BytecodeGenerator::BytecodeGenerator): 29 (JSC::BytecodeGenerator::preserveLastVar): Deleted. 30 * bytecompiler/BytecodeGenerator.h: 31 (JSC::BytecodeGenerator::addVar): 32 * bytecompiler/RegisterID.h: 33 (JSC::RegisterID::setIndex): 34 1 35 2015-02-06 Andreas Kling <akling@apple.com> 2 36 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r179372 r179746 152 152 } 153 153 154 void BytecodeGenerator::preserveLastVar()155 {156 if ((m_firstConstantIndex = m_calleeRegisters.size()) != 0)157 m_lastVar = &m_calleeRegisters.last();158 }159 160 154 BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedProgramCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode) 161 155 : m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) … … 429 423 addParameter(simpleParameter->boundProperty(), index); 430 424 } 431 preserveLastVar();432 425 433 426 // We declare the callee's name last because it should lose to a var, function, and/or parameter declaration. … … 494 487 } 495 488 codeBlock->adoptVariables(variables); 496 preserveLastVar();497 489 } 498 490 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r178926 r179746 631 631 { 632 632 ++m_codeBlock->m_numVars; 633 return newRegister(); 633 RegisterID* result = newRegister(); 634 ASSERT(VirtualRegister(result->index()).toLocal() == m_codeBlock->m_numVars - 1); 635 result->ref(); // We should never free this slot. 636 return result; 634 637 } 635 638 … … 778 781 SegmentedVector<Label, 32> m_labels; 779 782 LabelScopeStore m_labelScopes; 780 RefPtr<RegisterID> m_lastVar;781 783 int m_finallyDepth; 782 784 int m_localScopeDepth; … … 792 794 SegmentedVector<TryData, 8> m_tryData; 793 795 794 int m_firstConstantIndex;795 796 int m_nextConstantOffset; 796 797 -
trunk/Source/JavaScriptCore/bytecompiler/RegisterID.h
r165676 r179746 71 71 void setIndex(int index) 72 72 { 73 ASSERT(!m_refCount);74 73 #ifndef NDEBUG 75 74 m_didSetIndex = true;
Note:
See TracChangeset
for help on using the changeset viewer.