Ignore:
Timestamp:
Sep 16, 2015, 5:16:35 PM (10 years ago)
Author:
[email protected]
Message:

Remove obsolete code for deleting CodeBlocks
https://bugs.webkit.org/show_bug.cgi?id=149231

Reviewed by Mark Lam.

  • heap/Heap.cpp:

(JSC::Heap::deleteAllCodeBlocks): ASSERT that we're called in a valid
state, and do the compiler waiting ourselves instead of having our
caller do it. This is more appropriate to our new limited use.

(JSC::Heap::collectImpl):
(JSC::Heap::deleteOldCode): Deleted. Don't call deleteAllCodeBlocks
periodically because it's not such a good idea to delete everything
at once, and CodeBlocks now have a more precise individual policy for
when to delete. Also, this function used to fail all or nearly all of
the time because its invariants that we were not executing or compiling
could not be met.

  • heap/Heap.h:
  • jsc.cpp:

(GlobalObject::finishCreation):
(functionDeleteAllCompiledCode): Deleted.

  • tests/stress/deleteAllCompiledCode.js: Removed. Removed this testing

code because it did not do what it thought it did. All of this code
was guaranteed to no-op since it would run JavaScript to call a function
that would return early because JavaScript was running.

  • runtime/VM.cpp:

(JSC::VM::deleteAllCode): This code is simpler now becaue
heap.deleteAllCodeBlocks does some work for us.

  • runtime/VMEntryScope.cpp:

(JSC::VMEntryScope::VMEntryScope): Don't delete code on VM entry. This
policy was old, and it dated back to a time when we

(a) couldn't run in the interpreter if compilation failed;

(b) didn't reduce the rate of compilation in response to executable
memory pressure;

(c) didn't throw away individual CodeBlocks automatically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r189616 r189888  
    347347    , m_lastFullGCLength(0.01)
    348348    , m_lastEdenGCLength(0.01)
    349     , m_lastCodeDiscardTime(WTF::monotonicallyIncreasingTime())
    350349    , m_fullActivityCallback(GCActivityCallback::createFullTimer(this))
    351350#if ENABLE(GGC)
     
    893892void Heap::deleteAllCodeBlocks()
    894893{
    895     // If JavaScript is running, it's not safe to delete JavaScript code, since
     894    // If JavaScript is running, it's not safe to delete all JavaScript code, since
    896895    // we'll end up returning to deleted code.
    897     if (m_vm->entryScope)
    898         return;
    899    
    900     // If we have things on any worklist, then don't delete code. This is kind of
    901     // a weird heuristic. It's definitely not safe to throw away code that is on
    902     // the worklist. But this change was made in a hurry so we just avoid throwing
    903     // away any code if there is any code on any worklist. I suspect that this
    904     // might not actually be too dumb: if there is code on worklists then that
    905     // means that we are running some hot JS code right now. Maybe causing
    906     // recompilations isn't a good idea.
     896    RELEASE_ASSERT(!m_vm->entryScope);
     897
    907898#if ENABLE(DFG_JIT)
    908     for (unsigned i = DFG::numberOfWorklists(); i--;) {
    909         if (DFG::Worklist* worklist = DFG::worklistForIndexOrNull(i)) {
    910             if (worklist->isActiveForVM(*vm()))
    911                 return;
    912         }
    913     }
    914 #endif // ENABLE(DFG_JIT)
     899    DFG::completeAllPlansForVM(*m_vm);
     900#endif
    915901
    916902    for (ExecutableBase* current : m_executables) {
     
    983969    sweepAllLogicallyEmptyWeakBlocks();
    984970}
    985 
    986 static double minute = 60.0;
    987971
    988972NEVER_INLINE void Heap::collect(HeapOperation collectionType)
     
    10361020    }
    10371021
    1038     deleteOldCode(gcStartTime);
    10391022    flushOldStructureIDTables();
    10401023    stopAllocation();
     
    11241107    if (m_edenActivityCallback)
    11251108        m_edenActivityCallback->willCollect();
    1126 }
    1127 
    1128 void Heap::deleteOldCode(double gcStartTime)
    1129 {
    1130     if (m_operationInProgress == EdenCollection)
    1131         return;
    1132 
    1133     GCPHASE(DeleteOldCode);
    1134     if (gcStartTime - m_lastCodeDiscardTime > minute) {
    1135         m_vm->regExpCache()->deleteAllCode();
    1136         deleteAllCodeBlocks();
    1137         m_lastCodeDiscardTime = WTF::monotonicallyIncreasingTime();
    1138     }
    11391109}
    11401110
Note: See TracChangeset for help on using the changeset viewer.