Diff
Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/ChangeLog 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog 2014-01-09 22:07:31 UTC (rev 161582)
@@ -1,5 +1,48 @@
2014-01-09 Mark Lam <[email protected]>
+ CStack: Rename "host zone" to "reserved zone".
+ https://bugs.webkit.org/show_bug.cgi?id=126716.
+
+ Reviewed by Michael Saboff.
+
+ The "zone" is used as a reserve of stack memory for:
+ 1. nominal host code stack usage.
+ 2. stack space for error handling.
+ 3. initial stack space for pushing VMEntrySentinel frames.
+
+ The "zone" may reside on the C stack and on the C loop JSStack depending
+ on context. Hence, the name "host zone" is not quite accurate, and we'll
+ rename it to "reserved zone".
+
+ * interpreter/JSStack.cpp:
+ (JSC::JSStack::JSStack):
+ (JSC::JSStack::growSlowCase):
+ (JSC::JSStack::releaseExcessCapacity):
+ (JSC::JSStack::setReservedZoneSize):
+ * interpreter/JSStack.h:
+ * interpreter/JSStackInlines.h:
+ (JSC::JSStack::shrink):
+ * runtime/ErrorHandlingScope.cpp:
+ (JSC::ErrorHandlingScope::ErrorHandlingScope):
+ (JSC::ErrorHandlingScope::~ErrorHandlingScope):
+ * runtime/ErrorHandlingScope.h:
+ * runtime/JSLock.cpp:
+ (JSC::JSLock::DropAllLocks::DropAllLocks):
+ (JSC::JSLock::DropAllLocks::~DropAllLocks):
+ * runtime/JSLock.h:
+ * runtime/Options.h:
+ * runtime/VM.cpp:
+ (JSC::VM::VM):
+ (JSC::VM::updateStackLimitWithReservedZoneSize):
+ * runtime/VM.h:
+ (JSC::VM::reservedZoneSize):
+ * runtime/VMEntryScope.cpp:
+ (JSC::VMEntryScope::VMEntryScope):
+ (JSC::VMEntryScope::~VMEntryScope):
+ * runtime/VMEntryScope.h:
+
+2014-01-09 Mark Lam <[email protected]>
+
CStack: Need a separate stack limit for the JS stack and the C stack.
https://bugs.webkit.org/show_bug.cgi?id=126320.
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp 2014-01-09 22:07:31 UTC (rev 161582)
@@ -50,7 +50,7 @@
, m_topCallFrame(vm.topCallFrame)
#if ENABLE(LLINT_C_LOOP)
, m_end(0)
- , m_hostZoneSizeInRegisters(0)
+ , m_reservedZoneSizeInRegisters(0)
#endif
{
#if ENABLE(LLINT_C_LOOP)
@@ -78,11 +78,11 @@
bool JSStack::growSlowCase(Register* newTopOfStack)
{
- Register* newTopOfStackWithHostZone = newTopOfStack - m_hostZoneSizeInRegisters;
+ Register* newTopOfStackWithReservedZone = newTopOfStack - m_reservedZoneSizeInRegisters;
// If we have already committed enough memory to satisfy this request,
// just update the end pointer and return.
- if (newTopOfStackWithHostZone >= m_commitTop) {
+ if (newTopOfStackWithReservedZone >= m_commitTop) {
setStackLimit(newTopOfStack);
return true;
}
@@ -90,7 +90,7 @@
// Compute the chunk size of additional memory to commit, and see if we
// have it is still within our budget. If not, we'll fail to grow and
// return false.
- ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithHostZone);
+ ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithReservedZone);
delta = WTF::roundUpToMultipleOf(commitSize, delta);
Register* newCommitTop = m_commitTop - (delta / sizeof(Register));
if (newCommitTop < reservationTop())
@@ -130,11 +130,11 @@
void JSStack::releaseExcessCapacity()
{
- Register* highAddressWithHostZone = highAddress() - m_hostZoneSizeInRegisters;
- ptrdiff_t delta = reinterpret_cast<char*>(highAddressWithHostZone) - reinterpret_cast<char*>(m_commitTop);
+ Register* highAddressWithReservedZone = highAddress() - m_reservedZoneSizeInRegisters;
+ ptrdiff_t delta = reinterpret_cast<char*>(highAddressWithReservedZone) - reinterpret_cast<char*>(m_commitTop);
m_reservation.decommit(m_commitTop, delta);
addToCommittedByteCount(-delta);
- m_commitTop = highAddressWithHostZone;
+ m_commitTop = highAddressWithReservedZone;
}
void JSStack::initializeThreading()
@@ -149,10 +149,10 @@
committedBytesCount += byteCount;
}
-void JSStack::setHostZoneSize(size_t hostZoneSize)
+void JSStack::setReservedZoneSize(size_t reservedZoneSize)
{
- m_hostZoneSizeInRegisters = hostZoneSize / sizeof(Register);
- if (m_commitTop >= (m_end + 1) - m_hostZoneSizeInRegisters)
+ m_reservedZoneSizeInRegisters = reservedZoneSize / sizeof(Register);
+ if (m_commitTop >= (m_end + 1) - m_reservedZoneSizeInRegisters)
growSlowCase(m_end + 1);
}
#endif // ENABLE(LLINT_C_LOOP)
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -107,7 +107,7 @@
static void initializeThreading();
- void setHostZoneSize(size_t);
+ void setReservedZoneSize(size_t);
CallFrame* pushFrame(class CodeBlock*, JSScope*, int argsCount, JSObject* callee);
@@ -174,7 +174,7 @@
Register* m_commitTop;
PageReservation m_reservation;
Register* m_lastStackTop;
- ptrdiff_t m_hostZoneSizeInRegisters;
+ ptrdiff_t m_reservedZoneSizeInRegisters;
#endif // ENABLE(LLINT_C_LOOP)
friend class LLIntOffsetsExtractor;
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStackInlines.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStackInlines.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStackInlines.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -161,7 +161,7 @@
// invoke std::max() with it as an argument. To work around this, we first
// assign the constant to a local variable, and use the local instead.
ptrdiff_t maxExcessCapacity = JSStack::maxExcessCapacity;
- ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_hostZoneSizeInRegisters);
+ ptrdiff_t maxExcessInRegisters = std::max(maxExcessCapacity, m_reservedZoneSizeInRegisters);
if (m_end == baseOfStack() && (highAddress() - m_commitTop) >= maxExcessInRegisters)
releaseExcessCapacity();
}
Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-01-09 22:07:31 UTC (rev 161582)
@@ -230,7 +230,7 @@
storep temp2, VM::m_jsStackLimit[vm]
storep sp, VM::stackPointerAtVMEntry[vm]
- # The stack host zone ensures that we have adequate space for the
+ # The stack reserved zone ensures that we have adequate space for the
# VMEntrySentinelFrame. Proceed with allocating and initializing the
# sentinel frame.
move sp, cfr
Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-01-09 22:07:31 UTC (rev 161582)
@@ -121,7 +121,7 @@
checkStackPointerAlignment(temp2, 0xbad0dc01)
- # The stack host zone ensures that we have adequate space for the
+ # The stack reserved zone ensures that we have adequate space for the
# VMEntrySentinelFrame. Proceed with allocating and initializing the
# sentinel frame.
move sp, cfr
Modified: branches/jsCStack/Source/_javascript_Core/runtime/ErrorHandlingScope.cpp (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/ErrorHandlingScope.cpp 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/ErrorHandlingScope.cpp 2014-01-09 22:07:31 UTC (rev 161582)
@@ -37,10 +37,10 @@
{
if (!m_vm.stackPointerAtVMEntry)
m_vm.stackPointerAtVMEntry = this;
- size_t newHostZoneSize = Options::errorModeHostZoneSize();
- m_savedHostZoneSize = m_vm.updateStackLimitWithHostZoneSize(newHostZoneSize);
+ size_t newReservedZoneSize = Options::errorModeReservedZoneSize();
+ m_savedReservedZoneSize = m_vm.updateStackLimitWithReservedZoneSize(newReservedZoneSize);
#if ENABLE(LLINT_C_LOOP)
- m_vm.interpreter->stack().setHostZoneSize(newHostZoneSize);
+ m_vm.interpreter->stack().setReservedZoneSize(newReservedZoneSize);
#endif
}
@@ -48,9 +48,9 @@
{
if (m_vm.stackPointerAtVMEntry == this)
m_vm.stackPointerAtVMEntry = nullptr;
- m_vm.updateStackLimitWithHostZoneSize(m_savedHostZoneSize);
+ m_vm.updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize);
#if ENABLE(LLINT_C_LOOP)
- m_vm.interpreter->stack().setHostZoneSize(m_savedHostZoneSize);
+ m_vm.interpreter->stack().setReservedZoneSize(m_savedReservedZoneSize);
#endif
}
Modified: branches/jsCStack/Source/_javascript_Core/runtime/ErrorHandlingScope.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/ErrorHandlingScope.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/ErrorHandlingScope.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -36,7 +36,7 @@
JS_EXPORT_PRIVATE ~ErrorHandlingScope();
private:
VM& m_vm;
- size_t m_savedHostZoneSize;
+ size_t m_savedReservedZoneSize;
};
} // namespace JSC
Modified: branches/jsCStack/Source/_javascript_Core/runtime/JSLock.cpp (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/JSLock.cpp 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/JSLock.cpp 2014-01-09 22:07:31 UTC (rev 161582)
@@ -290,7 +290,7 @@
#if PLATFORM(IOS)
SpinLockHolder holder(&spinLock);
#endif
- m_savedHostZoneSize = m_vm->hostZoneSize();
+ m_savedReservedZoneSize = m_vm->reservedZoneSize();
m_savedStackPointerAtVMEntry = m_vm->stackPointerAtVMEntry;
m_vm->stackPointerAtVMEntry = nullptr;
@@ -310,7 +310,7 @@
#if PLATFORM(IOS)
SpinLockHolder holder(&spinLock);
#endif
- m_savedHostZoneSize = m_vm->hostZoneSize();
+ m_savedReservedZoneSize = m_vm->reservedZoneSize();
m_savedStackPointerAtVMEntry = m_vm->stackPointerAtVMEntry;
m_vm->stackPointerAtVMEntry = nullptr;
@@ -331,7 +331,7 @@
m_vm->apiLock().grabAllLocks(m_lockCount, spinLock);
m_vm->stackPointerAtVMEntry = m_savedStackPointerAtVMEntry;
- m_vm->updateStackLimitWithHostZoneSize(m_savedHostZoneSize);
+ m_vm->updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize);
}
} // namespace JSC
Modified: branches/jsCStack/Source/_javascript_Core/runtime/JSLock.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/JSLock.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/JSLock.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -110,7 +110,7 @@
private:
intptr_t m_lockCount;
RefPtr<VM> m_vm;
- size_t m_savedHostZoneSize;
+ size_t m_savedReservedZoneSize;
void* m_savedStackPointerAtVMEntry;
};
Modified: branches/jsCStack/Source/_javascript_Core/runtime/Options.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/Options.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/Options.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -96,8 +96,8 @@
v(bool, useRegExpJIT, true) \
\
v(unsigned, maxPerThreadStackUsage, 4 * MB) \
- v(unsigned, hostZoneSize, 128 * KB) \
- v(unsigned, errorModeHostZoneSize, 64 * KB) \
+ v(unsigned, reservedZoneSize, 128 * KB) \
+ v(unsigned, errorModeReservedZoneSize, 64 * KB) \
\
v(bool, crashIfCantAllocateJITMemory, false) \
\
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VM.cpp (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/VM.cpp 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VM.cpp 2014-01-09 22:07:31 UTC (rev 161582)
@@ -229,9 +229,9 @@
{
interpreter = new Interpreter(*this);
StackBounds stack = wtfThreadData().stack();
- updateStackLimitWithHostZoneSize(Options::hostZoneSize());
+ updateStackLimitWithReservedZoneSize(Options::reservedZoneSize());
#if ENABLE(LLINT_C_LOOP)
- interpreter->stack().setHostZoneSize(Options::hostZoneSize());
+ interpreter->stack().setReservedZoneSize(Options::reservedZoneSize());
#endif
setLastStackTop(stack.origin());
@@ -715,22 +715,22 @@
m_exceptionStack = RefCountedArray<StackFrame>();
}
-size_t VM::updateStackLimitWithHostZoneSize(size_t hostZoneSize)
+size_t VM::updateStackLimitWithReservedZoneSize(size_t reservedZoneSize)
{
- size_t oldHostZoneSize = m_hostZoneSize;
- m_hostZoneSize = hostZoneSize;
+ size_t oldReservedZoneSize = m_reservedZoneSize;
+ m_reservedZoneSize = reservedZoneSize;
void* stackLimit;
if (stackPointerAtVMEntry) {
ASSERT(wtfThreadData().stack().isGrowingDownward());
char* startOfStack = reinterpret_cast<char*>(stackPointerAtVMEntry);
- char* desiredStackLimit = startOfStack - Options::maxPerThreadStackUsage() + hostZoneSize;
- stackLimit = wtfThreadData().stack().recursionLimit(hostZoneSize, desiredStackLimit);
+ char* desiredStackLimit = startOfStack - Options::maxPerThreadStackUsage() + reservedZoneSize;
+ stackLimit = wtfThreadData().stack().recursionLimit(reservedZoneSize, desiredStackLimit);
} else
- stackLimit = wtfThreadData().stack().recursionLimit(hostZoneSize);
+ stackLimit = wtfThreadData().stack().recursionLimit(reservedZoneSize);
setStackLimit(stackLimit);
- return oldHostZoneSize;
+ return oldReservedZoneSize;
}
void releaseExecutableMemory(VM& vm)
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VM.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/VM.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VM.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -375,8 +375,8 @@
JS_EXPORT_PRIVATE JSValue throwException(ExecState*, JSValue);
JS_EXPORT_PRIVATE JSObject* throwException(ExecState*, JSObject*);
- size_t hostZoneSize() const { return m_hostZoneSize; }
- size_t updateStackLimitWithHostZoneSize(size_t hostZoneSize);
+ size_t reservedZoneSize() const { return m_reservedZoneSize; }
+ size_t updateStackLimitWithReservedZoneSize(size_t reservedZoneSize);
void** addressOfJSStackLimit() { return &m_jsStackLimit; }
#if ENABLE(LLINT_C_LOOP)
@@ -513,7 +513,7 @@
#if ENABLE(GC_VALIDATION)
const ClassInfo* m_initializingObjectClass;
#endif
- size_t m_hostZoneSize;
+ size_t m_reservedZoneSize;
#if ENABLE(LLINT_C_LOOP)
struct {
void* m_stackLimit;
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp 2014-01-09 22:07:31 UTC (rev 161582)
@@ -51,7 +51,7 @@
if (!vm.stackPointerAtVMEntry) {
vm.stackPointerAtVMEntry = this;
- m_savedHostZoneSize = vm.updateStackLimitWithHostZoneSize(Options::hostZoneSize());
+ m_savedReservedZoneSize = vm.updateStackLimitWithReservedZoneSize(Options::reservedZoneSize());
}
// Clear the captured exception stack between entries
@@ -64,7 +64,7 @@
m_vm.entryScope = nullptr;
if (m_vm.stackPointerAtVMEntry == this) {
m_vm.stackPointerAtVMEntry = nullptr;
- m_vm.updateStackLimitWithHostZoneSize(m_savedHostZoneSize);
+ m_vm.updateStackLimitWithReservedZoneSize(m_savedReservedZoneSize);
}
}
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h (161581 => 161582)
--- branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h 2014-01-09 22:05:40 UTC (rev 161581)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h 2014-01-09 22:07:31 UTC (rev 161582)
@@ -46,7 +46,7 @@
VM& m_vm;
StackStats::CheckPoint m_stackCheckPoint;
JSGlobalObject* m_globalObject;
- size_t m_savedHostZoneSize;
+ size_t m_savedReservedZoneSize;
};
} // namespace JSC