Title: [161172] branches/jsCStack/Source/_javascript_Core
- Revision
- 161172
- Author
- [email protected]
- Date
- 2013-12-30 22:49:49 -0800 (Mon, 30 Dec 2013)
Log Message
CStack: Refactor to split the tracking of the jsStackLimit from the native stackLimit.
https://bugs.webkit.org/show_bug.cgi?id=126331.
Not yet reviewed.
Previously, when using the C stack for the JS stack, VM::m_jsStackLimit is a union
with VM::m_stackLimit. We now separate them into 2 distinct fields but haven't yet
changed the computation of the limit values to set them with.
* interpreter/JSStack.cpp:
(JSC::JSStack::updateStackLimit):
* runtime/VM.h:
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):
(JSC::VMEntryScope::updateStackLimits):
(JSC::VMEntryScope::requiredCapacity):
* runtime/VMEntryScope.h:
Modified Paths
Diff
Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (161171 => 161172)
--- branches/jsCStack/Source/_javascript_Core/ChangeLog 2013-12-31 06:32:59 UTC (rev 161171)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog 2013-12-31 06:49:49 UTC (rev 161172)
@@ -1,5 +1,26 @@
2013-12-30 Mark Lam <[email protected]>
+ CStack: Refactor to split the tracking of the jsStackLimit from the native stackLimit.
+ https://bugs.webkit.org/show_bug.cgi?id=126331.
+
+ Not yet reviewed.
+
+ Previously, when using the C stack for the JS stack, VM::m_jsStackLimit is a union
+ with VM::m_stackLimit. We now separate them into 2 distinct fields but haven't yet
+ changed the computation of the limit values to set them with.
+
+ * interpreter/JSStack.cpp:
+ (JSC::JSStack::updateStackLimit):
+ * runtime/VM.h:
+ * runtime/VMEntryScope.cpp:
+ (JSC::VMEntryScope::VMEntryScope):
+ (JSC::VMEntryScope::~VMEntryScope):
+ (JSC::VMEntryScope::updateStackLimits):
+ (JSC::VMEntryScope::requiredCapacity):
+ * runtime/VMEntryScope.h:
+
+2013-12-30 Mark Lam <[email protected]>
+
CStack: Fix JSStack::ensureCapacity() to match LLINT and JIT stack checks.
https://bugs.webkit.org/show_bug.cgi?id=126328.
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp (161171 => 161172)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp 2013-12-31 06:32:59 UTC (rev 161171)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp 2013-12-31 06:49:49 UTC (rev 161172)
@@ -205,7 +205,7 @@
disableErrorStackReserve();
#endif
if (m_vm.firstEntryScope)
- m_vm.firstEntryScope->updateStackLimit();
+ m_vm.firstEntryScope->updateStackLimits();
}
} // namespace JSC
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VM.h (161171 => 161172)
--- branches/jsCStack/Source/_javascript_Core/runtime/VM.h 2013-12-31 06:32:59 UTC (rev 161171)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VM.h 2013-12-31 06:49:49 UTC (rev 161172)
@@ -505,18 +505,8 @@
#if ENABLE(GC_VALIDATION)
const ClassInfo* m_initializingObjectClass;
#endif
-
-#if ENABLE(LLINT_C_LOOP)
- struct {
- void* m_stackLimit;
- void* m_jsStackLimit;
- };
-#else
- union {
- void* m_stackLimit;
- void* m_jsStackLimit;
- };
-#endif
+ void* m_stackLimit;
+ void* m_jsStackLimit;
void* m_lastStackTop;
JSValue m_exception;
bool m_inDefineOwnProperty;
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp (161171 => 161172)
--- branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp 2013-12-31 06:32:59 UTC (rev 161171)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.cpp 2013-12-31 06:49:49 UTC (rev 161172)
@@ -37,6 +37,9 @@
, m_globalObject(globalObject)
, m_prevFirstEntryScope(vm.firstEntryScope)
, m_prevStackLimit(vm.stackLimit())
+#if !ENABLE(LLINT_C_LOOP)
+ , m_prevJSStackLimit(vm.jsStackLimit())
+#endif
, m_prevLastStackTop(vm.lastStackTop())
{
if (!vm.firstEntryScope) {
@@ -53,7 +56,7 @@
// Clear the exception stack between entries
vm.clearExceptionStack();
- updateStackLimit();
+ updateStackLimits();
vm.setLastStackTop(m_stack.origin());
}
@@ -61,18 +64,25 @@
{
m_vm.firstEntryScope = m_prevFirstEntryScope;
m_vm.setStackLimit(m_prevStackLimit);
+#if !ENABLE(LLINT_C_LOOP)
+ m_vm.setJSStackLimit(m_prevJSStackLimit);
+#endif
m_vm.setLastStackTop(m_prevLastStackTop);
}
-void VMEntryScope::updateStackLimit()
+void VMEntryScope::updateStackLimits()
{
- void* limit = m_stack.recursionLimit(requiredCapacity());
- m_vm.setStackLimit(limit);
+#if !ENABLE(LLINT_C_LOOP)
+ void* jsStackLimit = m_stack.recursionLimit(requiredCapacity(JSStackCapacity));
+ m_vm.setJSStackLimit(jsStackLimit);
+#endif
+ void* nativeStackLimit = m_stack.recursionLimit(requiredCapacity(NativeStackCapacity));
+ m_vm.setStackLimit(nativeStackLimit);
}
-size_t VMEntryScope::requiredCapacity() const
+size_t VMEntryScope::requiredCapacity(CapacityType type) const
{
- Interpreter* interpreter = m_vm.interpreter;
+ UNUSED_PARAM(type);
// We require a smaller stack budget for the error stack. This is to allow
// some minimal JS execution to proceed and do the work of throwing a stack
@@ -84,6 +94,7 @@
const size_t requiredStack = 128 * KB;
const size_t errorModeRequiredStack = 64 * KB;
+ Interpreter* interpreter = m_vm.interpreter;
size_t requiredCapacity = interpreter->isInErrorHandlingMode() ? errorModeRequiredStack : requiredStack;
RELEASE_ASSERT(m_stack.size() >= requiredCapacity);
return requiredCapacity;
Modified: branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h (161171 => 161172)
--- branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h 2013-12-31 06:32:59 UTC (rev 161171)
+++ branches/jsCStack/Source/_javascript_Core/runtime/VMEntryScope.h 2013-12-31 06:49:49 UTC (rev 161172)
@@ -40,20 +40,27 @@
JS_EXPORT_PRIVATE VMEntryScope(VM&, JSGlobalObject*);
JS_EXPORT_PRIVATE ~VMEntryScope();
- void updateStackLimit();
+ void updateStackLimits();
JSGlobalObject* globalObject() const { return m_globalObject; }
private:
- size_t requiredCapacity() const;
+ enum CapacityType {
+ JSStackCapacity,
+ NativeStackCapacity,
+ };
+ size_t requiredCapacity(CapacityType) const;
VM& m_vm;
StackStats::CheckPoint m_stackCheckPoint;
StackBounds m_stack;
JSGlobalObject* m_globalObject;
- // m_prevFirstEntryScope, m_prevStackLimit & m_prevLastStackTop may belong to a different thread's stack.
+ // The following pointers may point to a different thread's stack.
VMEntryScope* m_prevFirstEntryScope;
void* m_prevStackLimit;
+#if !ENABLE(LLINT_C_LOOP)
+ void* m_prevJSStackLimit;
+#endif
void* m_prevLastStackTop;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes