Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (188883 => 188884)
--- trunk/Source/_javascript_Core/ChangeLog 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-08-24 21:43:13 UTC (rev 188884)
@@ -1,3 +1,67 @@
+2015-08-24 Geoffrey Garen <[email protected]>
+
+ Some renaming to clarify CodeBlock and UnlinkedCodeBlock
+ https://bugs.webkit.org/show_bug.cgi?id=148391
+
+ Reviewed by Saam Barati.
+
+ * bytecode/UnlinkedFunctionExecutable.cpp:
+ (JSC::generateUnlinkedFunctionCodeBlock):
+ (JSC::UnlinkedFunctionExecutable::visitChildren):
+ (JSC::UnlinkedFunctionExecutable::fromGlobalCode):
+ (JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor):
+ (JSC::generateFunctionCodeBlock): Deleted.
+ (JSC::UnlinkedFunctionExecutable::codeBlockFor): Deleted.
+ * bytecode/UnlinkedFunctionExecutable.h: Call our CodeBlocks "unlinked"
+ in the name for clarity, since we are unlinked.
+
+ * heap/Heap.cpp:
+ (JSC::Heap::objectTypeCounts):
+ (JSC::Heap::deleteAllCodeBlocks):
+ (JSC::Heap::deleteAllUnlinkedCodeBlocks):
+ (JSC::Heap::clearUnmarkedExecutables):
+ (JSC::Heap::deleteOldCode):
+ (JSC::Heap::FinalizerOwner::finalize):
+ (JSC::Heap::addExecutable):
+ (JSC::Heap::collectAllGarbageIfNotDoneRecently):
+ (JSC::Heap::deleteAllCompiledCode): Deleted.
+ (JSC::Heap::deleteAllUnlinkedFunctionCode): Deleted.
+ (JSC::Heap::addCompiledCode): Deleted.
+ * heap/Heap.h:
+ (JSC::Heap::notifyIsSafeToCollect):
+ (JSC::Heap::isSafeToCollect):
+ (JSC::Heap::sizeBeforeLastFullCollection):
+ (JSC::Heap::sizeAfterLastFullCollection):
+ (JSC::Heap::compiledCode): Deleted.
+
+ deleteAllCompiledCode => deleteAllCodeBlocks because "compiled"
+ is a broad phrase these days.
+
+ m_compiledCode => m_executables for the same reason.
+
+ addCompiledCode => addExecutable for the same reason.
+
+ deleteAllUnlinkedFunctionCode => deleteAllUnlinkedCodeBlocks
+ for consistency.
+
+ * jsc.cpp:
+ (functionDeleteAllCompiledCode):
+
+ * runtime/Executable.cpp:
+ (JSC::ScriptExecutable::newCodeBlockFor): codeBlockFor => unlinkedCodeBlockFor
+
+ (JSC::FunctionExecutable::clearUnlinkedCodeForRecompilation): Deleted.
+ It was strange to put this function on executable, since its name implied
+ that it only changed the executable, but it actually changed all cached
+ code. Now, a client that wants to change cached code must do so explicitly.
+
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::finishCreation):
+ * runtime/VM.cpp:
+ (JSC::VM::deleteAllCode):
+ * runtime/VMEntryScope.cpp:
+ (JSC::VMEntryScope::VMEntryScope): Updated for renames above.
+
2015-08-22 Filip Pizlo <[email protected]>
DFG::InsertionSet should be tolerant of occasional out-of-order insertions
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp (188883 => 188884)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2015-08-24 21:43:13 UTC (rev 188884)
@@ -47,7 +47,7 @@
const ClassInfo UnlinkedFunctionExecutable::s_info = { "UnlinkedFunctionExecutable", 0, 0, CREATE_METHOD_TABLE(UnlinkedFunctionExecutable) };
-static UnlinkedFunctionCodeBlock* generateFunctionCodeBlock(
+static UnlinkedFunctionCodeBlock* generateUnlinkedFunctionCodeBlock(
VM& vm, UnlinkedFunctionExecutable* executable, const SourceCode& source,
CodeSpecializationKind kind, DebuggerMode debuggerMode, ProfilerMode profilerMode,
UnlinkedFunctionKind functionKind, ParserError& error, bool isArrowFunction)
@@ -110,8 +110,8 @@
UnlinkedFunctionExecutable* thisObject = jsCast<UnlinkedFunctionExecutable*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
- visitor.append(&thisObject->m_codeBlockForCall);
- visitor.append(&thisObject->m_codeBlockForConstruct);
+ visitor.append(&thisObject->m_unlinkedCodeBlockForCall);
+ visitor.append(&thisObject->m_unlinkedCodeBlockForConstruct);
visitor.append(&thisObject->m_nameValue);
}
@@ -178,22 +178,22 @@
return executable;
}
-UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::codeBlockFor(
+UnlinkedFunctionCodeBlock* UnlinkedFunctionExecutable::unlinkedCodeBlockFor(
VM& vm, const SourceCode& source, CodeSpecializationKind specializationKind,
DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error, bool isArrowFunction)
{
switch (specializationKind) {
case CodeForCall:
- if (UnlinkedFunctionCodeBlock* codeBlock = m_codeBlockForCall.get())
+ if (UnlinkedFunctionCodeBlock* codeBlock = m_unlinkedCodeBlockForCall.get())
return codeBlock;
break;
case CodeForConstruct:
- if (UnlinkedFunctionCodeBlock* codeBlock = m_codeBlockForConstruct.get())
+ if (UnlinkedFunctionCodeBlock* codeBlock = m_unlinkedCodeBlockForConstruct.get())
return codeBlock;
break;
}
- UnlinkedFunctionCodeBlock* result = generateFunctionCodeBlock(
+ UnlinkedFunctionCodeBlock* result = generateUnlinkedFunctionCodeBlock(
vm, this, source, specializationKind, debuggerMode, profilerMode,
isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction,
error, isArrowFunction);
@@ -203,10 +203,10 @@
switch (specializationKind) {
case CodeForCall:
- m_codeBlockForCall.set(vm, this, result);
+ m_unlinkedCodeBlockForCall.set(vm, this, result);
break;
case CodeForConstruct:
- m_codeBlockForConstruct.set(vm, this, result);
+ m_unlinkedCodeBlockForConstruct.set(vm, this, result);
break;
}
return result;
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h (188883 => 188884)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2015-08-24 21:43:13 UTC (rev 188884)
@@ -92,7 +92,7 @@
unsigned typeProfilingStartOffset() const { return m_typeProfilingStartOffset; }
unsigned typeProfilingEndOffset() const { return m_typeProfilingEndOffset; }
- UnlinkedFunctionCodeBlock* codeBlockFor(
+ UnlinkedFunctionCodeBlock* unlinkedCodeBlockFor(
VM&, const SourceCode&, CodeSpecializationKind, DebuggerMode, ProfilerMode,
ParserError&, bool);
@@ -102,10 +102,10 @@
FunctionExecutable* link(VM&, const SourceCode&, int overrideLineNumber = -1);
- void clearCodeForRecompilation()
+ void clearCode()
{
- m_codeBlockForCall.clear();
- m_codeBlockForConstruct.clear();
+ m_unlinkedCodeBlockForCall.clear();
+ m_unlinkedCodeBlockForConstruct.clear();
}
void recordParse(CodeFeatures features, bool hasCapturedVariables)
@@ -128,8 +128,8 @@
private:
UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&);
- WriteBarrier<UnlinkedFunctionCodeBlock> m_codeBlockForCall;
- WriteBarrier<UnlinkedFunctionCodeBlock> m_codeBlockForConstruct;
+ WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall;
+ WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForConstruct;
Identifier m_name;
Identifier m_inferredName;
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (188883 => 188884)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2015-08-24 21:43:13 UTC (rev 188884)
@@ -902,7 +902,7 @@
return m_objectSpace.forEachLiveCell<RecordType>(iterationScope);
}
-void Heap::deleteAllCompiledCode()
+void Heap::deleteAllCodeBlocks()
{
// If _javascript_ is running, it's not safe to delete _javascript_ code, since
// we'll end up returning to deleted code.
@@ -925,7 +925,7 @@
}
#endif // ENABLE(DFG_JIT)
- for (ExecutableBase* current : m_compiledCode) {
+ for (ExecutableBase* current : m_executables) {
if (!current->isFunctionExecutable())
continue;
static_cast<FunctionExecutable*>(current)->clearCode();
@@ -936,28 +936,28 @@
m_codeBlocks.deleteUnmarkedAndUnreferenced(FullCollection);
}
-void Heap::deleteAllUnlinkedFunctionCode()
+void Heap::deleteAllUnlinkedCodeBlocks()
{
- for (ExecutableBase* current : m_compiledCode) {
+ for (ExecutableBase* current : m_executables) {
if (!current->isFunctionExecutable())
continue;
- static_cast<FunctionExecutable*>(current)->clearUnlinkedCodeForRecompilation();
+ static_cast<FunctionExecutable*>(current)->unlinkedExecutable()->clearCode();
}
}
void Heap::clearUnmarkedExecutables()
{
GCPHASE(ClearUnmarkedExecutables);
- for (unsigned i = m_compiledCode.size(); i--;) {
- ExecutableBase* current = m_compiledCode[i];
+ for (unsigned i = m_executables.size(); i--;) {
+ ExecutableBase* current = m_executables[i];
if (isMarked(current))
continue;
// We do this because executable memory is limited on some platforms and because
// CodeBlock requires eager finalization.
ExecutableBase::clearCodeVirtual(current);
- std::swap(m_compiledCode[i], m_compiledCode.last());
- m_compiledCode.removeLast();
+ std::swap(m_executables[i], m_executables.last());
+ m_executables.removeLast();
}
}
@@ -1145,7 +1145,7 @@
GCPHASE(DeleteOldCode);
if (gcStartTime - m_lastCodeDiscardTime > minute) {
m_vm->regExpCache()->deleteAllCode();
- deleteAllCompiledCode();
+ deleteAllCodeBlocks();
m_lastCodeDiscardTime = WTF::monotonicallyIncreasingTime();
}
}
@@ -1406,9 +1406,9 @@
WeakSet::deallocate(WeakImpl::asWeakImpl(slot));
}
-void Heap::addCompiledCode(ExecutableBase* executable)
+void Heap::addExecutable(ExecutableBase* executable)
{
- m_compiledCode.append(executable);
+ m_executables.append(executable);
}
void Heap::collectAllGarbageIfNotDoneRecently()
Modified: trunk/Source/_javascript_Core/heap/Heap.h (188883 => 188884)
--- trunk/Source/_javascript_Core/heap/Heap.h 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2015-08-24 21:43:13 UTC (rev 188884)
@@ -149,7 +149,7 @@
typedef void (*Finalizer)(JSCell*);
JS_EXPORT_PRIVATE void addFinalizer(JSCell*, Finalizer);
- void addCompiledCode(ExecutableBase*);
+ void addExecutable(ExecutableBase*);
void notifyIsSafeToCollect() { m_isSafeToCollect = true; }
bool isSafeToCollect() const { return m_isSafeToCollect; }
@@ -208,8 +208,8 @@
size_t sizeBeforeLastFullCollection() const { return m_sizeBeforeLastFullCollect; }
size_t sizeAfterLastFullCollection() const { return m_sizeAfterLastFullCollect; }
- JS_EXPORT_PRIVATE void deleteAllCompiledCode();
- void deleteAllUnlinkedFunctionCode();
+ JS_EXPORT_PRIVATE void deleteAllCodeBlocks();
+ void deleteAllUnlinkedCodeBlocks();
void didAllocate(size_t);
void didAbandon(size_t);
@@ -237,8 +237,6 @@
void addLogicallyEmptyWeakBlock(WeakBlock*);
- Vector<ExecutableBase*>& compiledCode() { return m_compiledCode; }
-
private:
friend class CodeBlock;
friend class CopiedBlock;
@@ -392,7 +390,7 @@
double m_lastEdenGCLength;
double m_lastCodeDiscardTime;
- Vector<ExecutableBase*> m_compiledCode;
+ Vector<ExecutableBase*> m_executables;
Vector<WeakBlock*> m_logicallyEmptyWeakBlocks;
size_t m_indexOfNextLogicallyEmptyWeakBlockToSweep { WTF::notFound };
Modified: trunk/Source/_javascript_Core/jsc.cpp (188883 => 188884)
--- trunk/Source/_javascript_Core/jsc.cpp 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/jsc.cpp 2015-08-24 21:43:13 UTC (rev 188884)
@@ -905,7 +905,7 @@
EncodedJSValue JSC_HOST_CALL functionDeleteAllCompiledCode(ExecState* exec)
{
JSLockHolder lock(exec);
- exec->heap()->deleteAllCompiledCode();
+ exec->heap()->deleteAllCodeBlocks();
return JSValue::encode(jsUndefined());
}
Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (188883 => 188884)
--- trunk/Source/_javascript_Core/runtime/Executable.cpp 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp 2015-08-24 21:43:13 UTC (rev 188884)
@@ -235,9 +235,14 @@
ParserError error;
DebuggerMode debuggerMode = globalObject->hasDebugger() ? DebuggerOn : DebuggerOff;
ProfilerMode profilerMode = globalObject->hasProfiler() ? ProfilerOn : ProfilerOff;
- UnlinkedFunctionCodeBlock* unlinkedCodeBlock =
- executable->m_unlinkedExecutable->codeBlockFor(*vm, executable->m_source, kind, debuggerMode, profilerMode, error, executable->isArrowFunction());
- recordParse(executable->m_unlinkedExecutable->features(), executable->m_unlinkedExecutable->hasCapturedVariables(), firstLine(), lastLine(), startColumn(), endColumn());
+ UnlinkedFunctionCodeBlock* unlinkedCodeBlock =
+ executable->m_unlinkedExecutable->unlinkedCodeBlockFor(
+ *vm, executable->m_source, kind, debuggerMode, profilerMode, error,
+ executable->isArrowFunction());
+ recordParse(
+ executable->m_unlinkedExecutable->features(),
+ executable->m_unlinkedExecutable->hasCapturedVariables(), firstLine(),
+ lastLine(), startColumn(), endColumn());
if (!unlinkedCodeBlock) {
exception = vm->throwException(
globalObject->globalExec(),
@@ -557,11 +562,6 @@
visitor.append(&thisObject->m_singletonFunction);
}
-void FunctionExecutable::clearUnlinkedCodeForRecompilation()
-{
- m_unlinkedExecutable->clearCodeForRecompilation();
-}
-
void FunctionExecutable::clearCode()
{
m_codeBlockForCall = nullptr;
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (188883 => 188884)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2015-08-24 21:43:13 UTC (rev 188884)
@@ -421,7 +421,7 @@
void finishCreation(VM& vm)
{
Base::finishCreation(vm);
- vm.heap.addCompiledCode(this); // Balanced by Heap::deleteUnmarkedCompiledCode().
+ vm.heap.addExecutable(this); // Balanced by Heap::deleteUnmarkedCompiledCode().
#if ENABLE(CODEBLOCK_SAMPLING)
if (SamplingTool* sampler = vm.interpreter->sampler())
@@ -640,7 +640,6 @@
JSString* nameValue() const { return m_unlinkedExecutable->nameValue(); }
size_t parameterCount() const { return m_unlinkedExecutable->parameterCount(); } // Excluding 'this'!
- void clearUnlinkedCodeForRecompilation();
static void visitChildren(JSCell*, SlotVisitor&);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)
{
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (188883 => 188884)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2015-08-24 21:43:13 UTC (rev 188884)
@@ -489,8 +489,8 @@
#if ENABLE(DFG_JIT)
DFG::completeAllPlansForVM(*this);
#endif
- heap.deleteAllCompiledCode();
- heap.deleteAllUnlinkedFunctionCode();
+ heap.deleteAllCodeBlocks();
+ heap.deleteAllUnlinkedCodeBlocks();
heap.reportAbandonedObjectGraph();
});
}
Modified: trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp (188883 => 188884)
--- trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp 2015-08-24 21:41:37 UTC (rev 188883)
+++ trunk/Source/_javascript_Core/runtime/VMEntryScope.cpp 2015-08-24 21:43:13 UTC (rev 188884)
@@ -42,7 +42,7 @@
if (!vm.entryScope) {
#if ENABLE(ASSEMBLER)
if (ExecutableAllocator::underMemoryPressure())
- vm.heap.deleteAllCompiledCode();
+ vm.heap.deleteAllCodeBlocks();
#endif
vm.entryScope = this;