Changeset 110138 in webkit
- Timestamp:
- Mar 7, 2012 8:04:40 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r110134 r110138 1 2012-03-07 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r110127. 4 http://trac.webkit.org/changeset/110127 5 https://bugs.webkit.org/show_bug.cgi?id=80562 6 7 compile failed on AppleWin (Requested by ukai on #webkit). 8 9 * heap/Heap.cpp: 10 (JSC::Heap::collectAllGarbage): 11 * heap/Heap.h: 12 (JSC): 13 (Heap): 14 * runtime/Executable.cpp: 15 (JSC::FunctionExecutable::FunctionExecutable): 16 (JSC::FunctionExecutable::finalize): 17 * runtime/Executable.h: 18 (FunctionExecutable): 19 (JSC::FunctionExecutable::create): 20 * runtime/JSGlobalData.cpp: 21 (WTF): 22 (Recompiler): 23 (WTF::Recompiler::operator()): 24 (JSC::JSGlobalData::recompileAllJSFunctions): 25 (JSC): 26 * runtime/JSGlobalData.h: 27 (JSGlobalData): 28 * runtime/JSGlobalObject.cpp: 29 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): 30 1 31 2012-03-07 Hojong Han <hojong.han@samsung.com> 2 32 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r110127 r110138 765 765 } 766 766 767 void Heap::discardAllCompiledCode()768 {769 // If JavaScript is running, it's not safe to recompile, since we'll end770 // up throwing away code that is live on the stack.771 ASSERT(!m_globalData->dynamicGlobalObject);772 773 for (FunctionExecutable* current = m_functions.head(); current; current = current->next())774 current->discardCode();775 }776 777 767 void Heap::collectAllGarbage() 778 768 { … … 780 770 return; 781 771 if (!m_globalData->dynamicGlobalObject) 782 discardAllCompiledCode();772 m_globalData->recompileAllJSFunctions(); 783 773 784 774 collect(DoSweep); … … 935 925 } 936 926 937 void Heap::addFunctionExecutable(FunctionExecutable* executable)938 {939 m_functions.append(executable);940 }941 942 void Heap::removeFunctionExecutable(FunctionExecutable* executable)943 {944 m_functions.remove(executable);945 }946 947 927 } // namespace JSC -
trunk/Source/JavaScriptCore/heap/Heap.h
r110127 r110138 43 43 class CopiedSpace; 44 44 class CodeBlock; 45 class FunctionExecutable;46 45 class GCActivityCallback; 47 46 class GlobalCodeBlock; … … 107 106 typedef void (*Finalizer)(JSCell*); 108 107 JS_EXPORT_PRIVATE void addFinalizer(JSCell*, Finalizer); 109 void addFunctionExecutable(FunctionExecutable*);110 void removeFunctionExecutable(FunctionExecutable*);111 108 112 109 void notifyIsSafeToCollect() { m_isSafeToCollect = true; } … … 143 140 144 141 double lastGCLength() { return m_lastGCLength; } 145 146 void discardAllCompiledCode();147 142 148 143 private: … … 245 240 JSGlobalData* m_globalData; 246 241 double m_lastGCLength; 247 248 DoublyLinkedList<FunctionExecutable> m_functions;249 242 }; 250 243 -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r110127 r110138 147 147 , m_inferredName(inferredName.isNull() ? globalData.propertyNames->emptyIdentifier : inferredName) 148 148 , m_symbolTable(0) 149 , m_next(0)150 , m_prev(0)151 149 { 152 150 } … … 160 158 , m_inferredName(inferredName.isNull() ? exec->globalData().propertyNames->emptyIdentifier : inferredName) 161 159 , m_symbolTable(0) 162 , m_next(0)163 , m_prev(0)164 160 { 165 161 } … … 659 655 void FunctionExecutable::finalize(JSCell* cell) 660 656 { 661 FunctionExecutable* executable = jsCast<FunctionExecutable*>(cell); 662 Heap::heap(executable)->removeFunctionExecutable(executable); 663 executable->clearCode(); 657 jsCast<FunctionExecutable*>(cell)->clearCode(); 664 658 } 665 659 -
trunk/Source/JavaScriptCore/runtime/Executable.h
r110127 r110138 464 464 }; 465 465 466 class FunctionExecutable : public ScriptExecutable , public DoublyLinkedListNode<FunctionExecutable>{466 class FunctionExecutable : public ScriptExecutable { 467 467 friend class JIT; 468 468 friend class LLIntOffsetsExtractor; 469 friend class DoublyLinkedListNode<FunctionExecutable>;470 469 public: 471 470 typedef ScriptExecutable Base; … … 475 474 FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, inferredName, source, forceUsesArguments, parameters, isInStrictContext); 476 475 executable->finishCreation(exec->globalData(), name, firstLine, lastLine); 477 exec->globalData().heap.addFunctionExecutable(executable);478 476 exec->globalData().heap.addFinalizer(executable, &finalize); 479 477 return executable; … … 484 482 FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, inferredName, source, forceUsesArguments, parameters, isInStrictContext); 485 483 executable->finishCreation(globalData, name, firstLine, lastLine); 486 globalData.heap.addFunctionExecutable(executable);487 484 globalData.heap.addFinalizer(executable, &finalize); 488 485 return executable; … … 692 689 WriteBarrier<JSString> m_nameValue; 693 690 SharedSymbolTable* m_symbolTable; 694 FunctionExecutable* m_next;695 FunctionExecutable* m_prev;696 691 }; 697 692 -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r110127 r110138 69 69 using namespace WTF; 70 70 71 namespace { 72 73 using namespace JSC; 74 75 class Recompiler : public MarkedBlock::VoidFunctor { 76 public: 77 void operator()(JSCell*); 78 }; 79 80 inline void Recompiler::operator()(JSCell* cell) 81 { 82 if (!cell->inherits(&JSFunction::s_info)) 83 return; 84 JSFunction* function = asFunction(cell); 85 if (!function->executable() || function->executable()->isHostFunction()) 86 return; 87 function->jsExecutable()->discardCode(); 88 } 89 90 } // namespace 91 71 92 namespace JSC { 72 93 … … 423 444 } 424 445 446 void JSGlobalData::recompileAllJSFunctions() 447 { 448 // If JavaScript is running, it's not safe to recompile, since we'll end 449 // up throwing away code that is live on the stack. 450 ASSERT(!dynamicGlobalObject); 451 452 heap.objectSpace().forEachCell<Recompiler>(); 453 } 454 425 455 struct StackPreservingRecompiler : public MarkedBlock::VoidFunctor { 426 456 HashSet<FunctionExecutable*> currentlyExecutingFunctions; -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r110127 r110138 325 325 JS_EXPORT_PRIVATE void stopSampling(); 326 326 JS_EXPORT_PRIVATE void dumpSampleData(ExecState* exec); 327 void discardAllCompiledCode();327 void recompileAllJSFunctions(); 328 328 RegExpCache* regExpCache() { return m_regExpCache; } 329 329 #if ENABLE(REGEXP_TRACING) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r110127 r110138 461 461 #if ENABLE(ASSEMBLER) 462 462 if (ExecutableAllocator::underMemoryPressure()) 463 globalData. heap.discardAllCompiledCode();463 globalData.recompileAllJSFunctions(); 464 464 #endif 465 465
Note: See TracChangeset
for help on using the changeset viewer.