- Revision
- 188339
- Author
- [email protected]
- Date
- 2015-08-12 11:28:20 -0700 (Wed, 12 Aug 2015)
Log Message
Remove VM::releaseExecutableMemory
https://bugs.webkit.org/show_bug.cgi?id=147915
Reviewed by Saam Barati.
releaseExecutableMemory() was only used in one place, where discardAllCode()
would work just as well.
It's confusing to have two slightly different ways to discard code. Also,
releaseExecutableMemory() is unused in any production code, and it seems
to have bit-rotted.
* jit/ExecutableAllocator.h:
* jsc.cpp:
(GlobalObject::finishCreation):
(functionAddressOf):
(functionVersion):
(functionReleaseExecutableMemory): Deleted.
* runtime/VM.cpp:
(JSC::StackPreservingRecompiler::operator()):
(JSC::VM::throwException):
(JSC::VM::updateFTLLargestStackSize):
(JSC::VM::gatherConservativeRoots):
(JSC::VM::releaseExecutableMemory): Deleted.
(JSC::releaseExecutableMemory): Deleted.
* runtime/VM.h:
(JSC::VM::isCollectorBusy):
* runtime/Watchdog.cpp:
(JSC::Watchdog::setTimeLimit):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (188338 => 188339)
--- trunk/Source/_javascript_Core/ChangeLog 2015-08-12 18:14:02 UTC (rev 188338)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-08-12 18:28:20 UTC (rev 188339)
@@ -1,3 +1,35 @@
+2015-08-11 Geoffrey Garen <[email protected]>
+
+ Remove VM::releaseExecutableMemory
+ https://bugs.webkit.org/show_bug.cgi?id=147915
+
+ Reviewed by Saam Barati.
+
+ releaseExecutableMemory() was only used in one place, where discardAllCode()
+ would work just as well.
+
+ It's confusing to have two slightly different ways to discard code. Also,
+ releaseExecutableMemory() is unused in any production code, and it seems
+ to have bit-rotted.
+
+ * jit/ExecutableAllocator.h:
+ * jsc.cpp:
+ (GlobalObject::finishCreation):
+ (functionAddressOf):
+ (functionVersion):
+ (functionReleaseExecutableMemory): Deleted.
+ * runtime/VM.cpp:
+ (JSC::StackPreservingRecompiler::operator()):
+ (JSC::VM::throwException):
+ (JSC::VM::updateFTLLargestStackSize):
+ (JSC::VM::gatherConservativeRoots):
+ (JSC::VM::releaseExecutableMemory): Deleted.
+ (JSC::releaseExecutableMemory): Deleted.
+ * runtime/VM.h:
+ (JSC::VM::isCollectorBusy):
+ * runtime/Watchdog.cpp:
+ (JSC::Watchdog::setTimeLimit):
+
2015-08-12 Mark Lam <[email protected]>
Add a JSC option to enable the watchdog for testing.
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (188338 => 188339)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2015-08-12 18:14:02 UTC (rev 188338)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2015-08-12 18:28:20 UTC (rev 188339)
@@ -67,7 +67,6 @@
namespace JSC {
class VM;
-void releaseExecutableMemory(VM&);
static const unsigned jitAllocationGranule = 32;
Modified: trunk/Source/_javascript_Core/jsc.cpp (188338 => 188339)
--- trunk/Source/_javascript_Core/jsc.cpp 2015-08-12 18:14:02 UTC (rev 188338)
+++ trunk/Source/_javascript_Core/jsc.cpp 2015-08-12 18:28:20 UTC (rev 188339)
@@ -463,7 +463,6 @@
static EncodedJSValue JSC_HOST_CALL functionDeleteAllCompiledCode(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionAddressOf(ExecState*);
#ifndef NDEBUG
-static EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState*);
#endif
static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*);
@@ -612,7 +611,6 @@
addFunction(vm, "addressOf", functionAddressOf, 1);
#ifndef NDEBUG
addFunction(vm, "dumpCallFrame", functionDumpCallFrame, 0);
- addFunction(vm, "releaseExecutableMemory", functionReleaseExecutableMemory, 0);
#endif
addFunction(vm, "version", functionVersion, 1);
addFunction(vm, "run", functionRun, 1);
@@ -909,16 +907,6 @@
return returnValue;
}
-
-#ifndef NDEBUG
-EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState* exec)
-{
- JSLockHolder lock(exec);
- exec->vm().releaseExecutableMemory();
- return JSValue::encode(jsUndefined());
-}
-#endif
-
EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*)
{
// We need this function for compatibility with the Mozilla JS tests but for now
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (188338 => 188339)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2015-08-12 18:14:02 UTC (rev 188338)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2015-08-12 18:28:20 UTC (rev 188339)
@@ -510,58 +510,6 @@
sourceProviderCacheMap.clear();
}
-struct StackPreservingRecompiler : public MarkedBlock::VoidFunctor {
- HashSet<FunctionExecutable*> currentlyExecutingFunctions;
- inline void visit(JSCell* cell)
- {
- if (!cell->inherits(FunctionExecutable::info()))
- return;
- FunctionExecutable* executable = jsCast<FunctionExecutable*>(cell);
- if (currentlyExecutingFunctions.contains(executable))
- return;
- executable->clearCode();
- }
- IterationStatus operator()(JSCell* cell)
- {
- visit(cell);
- return IterationStatus::Continue;
- }
-};
-
-void VM::releaseExecutableMemory()
-{
- prepareToDiscardCode();
-
- if (entryScope) {
- StackPreservingRecompiler recompiler;
- HeapIterationScope iterationScope(heap);
- HashSet<JSCell*> roots;
- heap.getConservativeRegisterRoots(roots);
- HashSet<JSCell*>::iterator end = roots.end();
- for (HashSet<JSCell*>::iterator ptr = roots.begin(); ptr != end; ++ptr) {
- ScriptExecutable* executable = 0;
- JSCell* cell = *ptr;
- if (cell->inherits(ScriptExecutable::info()))
- executable = static_cast<ScriptExecutable*>(*ptr);
- else if (cell->inherits(JSFunction::info())) {
- JSFunction* function = jsCast<JSFunction*>(*ptr);
- if (function->isHostFunction())
- continue;
- executable = function->jsExecutable();
- } else
- continue;
- ASSERT(executable->inherits(ScriptExecutable::info()));
- executable->unlinkCalls();
- if (executable->inherits(FunctionExecutable::info()))
- recompiler.currentlyExecutingFunctions.add(static_cast<FunctionExecutable*>(executable));
-
- }
- heap.objectSpace().forEachLiveCell<StackPreservingRecompiler>(iterationScope, recompiler);
- }
- m_regExpCache->invalidateCode();
- heap.collectAllGarbage();
-}
-
void VM::throwException(ExecState* exec, Exception* exception)
{
if (Options::breakOnThrow()) {
@@ -669,11 +617,6 @@
}
#endif
-void releaseExecutableMemory(VM& vm)
-{
- vm.releaseExecutableMemory();
-}
-
#if ENABLE(DFG_JIT)
void VM::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
{
Modified: trunk/Source/_javascript_Core/runtime/VM.h (188338 => 188339)
--- trunk/Source/_javascript_Core/runtime/VM.h 2015-08-12 18:14:02 UTC (rev 188338)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2015-08-12 18:28:20 UTC (rev 188339)
@@ -514,7 +514,6 @@
JS_EXPORT_PRIVATE void dumpRegExpTrace();
bool isCollectorBusy() { return heap.isBusy(); }
- JS_EXPORT_PRIVATE void releaseExecutableMemory();
#if ENABLE(GC_VALIDATION)
bool isInitializingObject() const;
Modified: trunk/Source/_javascript_Core/runtime/Watchdog.cpp (188338 => 188339)
--- trunk/Source/_javascript_Core/runtime/Watchdog.cpp 2015-08-12 18:14:02 UTC (rev 188338)
+++ trunk/Source/_javascript_Core/runtime/Watchdog.cpp 2015-08-12 18:28:20 UTC (rev 188339)
@@ -84,7 +84,7 @@
if (!hadTimeLimit) {
// And if we've previously compiled any functions, we need to revert
// them because they don't have the needed polling checks yet.
- vm.releaseExecutableMemory();
+ vm.discardAllCode();
}
if (m_hasEnteredVM && hasTimeLimit())