aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4context.cpp6
-rw-r--r--src/qml/jsruntime/qv4context_p.h1
-rw-r--r--src/qml/jsruntime/qv4engine.cpp33
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4mm.cpp15
5 files changed, 30 insertions, 28 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 27c3a31d95..36b1512b63 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -91,9 +91,6 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData
c->strictMode = function->strictMode;
c->outer = function->scope;
-#ifndef QT_NO_DEBUG
- assert(c->outer->next != (ExecutionContext *)0x1);
-#endif
c->activation = 0;
@@ -237,9 +234,6 @@ CallContext::CallContext(ExecutionEngine *engine, ObjectRef qml, FunctionObject
strictMode = true;
outer = function->scope;
-#ifndef QT_NO_DEBUG
- assert(outer->next != (ExecutionContext *)0x1);
-#endif
activation = qml.getPointer();
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 851f024a60..a0930a577e 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -110,7 +110,6 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
ExecutionContext *outer;
Lookup *lookups;
CompiledData::CompilationUnit *compilationUnit;
- ExecutionContext *next; // used in the GC
struct EvalCode
{
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 384254f896..5de8e0de44 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -109,21 +109,28 @@ quintptr getStackLimit()
# else
void* stackBottom = 0;
pthread_attr_t attr;
- pthread_getattr_np(pthread_self(), &attr);
- size_t stackSize = 0;
- pthread_attr_getstack(&attr, &stackBottom, &stackSize);
- pthread_attr_destroy(&attr);
-
-# if defined(Q_OS_ANDROID)
- // Bionic pretends that the main thread has a tiny stack; work around it
- if (gettid() == getpid()) {
- rlimit limit;
- getrlimit(RLIMIT_STACK, &limit);
- stackBottom = reinterpret_cast<void*>(reinterpret_cast<quintptr>(stackBottom) + stackSize - limit.rlim_cur);
+ if (pthread_getattr_np(pthread_self(), &attr) == 0) {
+ size_t stackSize = 0;
+ pthread_attr_getstack(&attr, &stackBottom, &stackSize);
+ pthread_attr_destroy(&attr);
+
+# if defined(Q_OS_ANDROID)
+ // Bionic pretends that the main thread has a tiny stack; work around it
+ if (gettid() == getpid()) {
+ rlimit limit;
+ getrlimit(RLIMIT_STACK, &limit);
+ stackBottom = reinterpret_cast<void*>(reinterpret_cast<quintptr>(stackBottom) + stackSize - limit.rlim_cur);
+ }
+# endif
+
+ stackLimit = reinterpret_cast<quintptr>(stackBottom);
+ } else {
+ int dummy;
+ // this is inexact, as part of the stack is used when being called here,
+ // but let's simply default to 1MB from where the stack is right now
+ stackLimit = reinterpret_cast<qintptr>(&dummy) - 1024*1024;
}
-# endif
- stackLimit = reinterpret_cast<quintptr>(stackBottom);
# endif
// This is wrong. StackLimit is the currently committed stack size, not the real end.
// only way to get that limit is apparently by using VirtualQuery (Yuck)
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index a1673dfc2a..daa3d5b0de 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -131,9 +131,6 @@ void FunctionObject::init(const StringRef n, bool createProto)
needsActivation = true;
strictMode = false;
-#ifndef QT_NO_DEBUG
- assert(scope->next != (ExecutionContext *)0x1);
-#endif
if (createProto) {
Scoped<Object> proto(s, scope->engine->newObject(scope->engine->protoClass));
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 625e34de07..d55ddead89 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -234,12 +234,17 @@ MemoryManager::MemoryManager()
# else
void* stackBottom = 0;
pthread_attr_t attr;
- pthread_getattr_np(pthread_self(), &attr);
- size_t stackSize = 0;
- pthread_attr_getstack(&attr, &stackBottom, &stackSize);
- pthread_attr_destroy(&attr);
+ if (pthread_getattr_np(pthread_self(), &attr) == 0) {
+ size_t stackSize = 0;
+ pthread_attr_getstack(&attr, &stackBottom, &stackSize);
+ pthread_attr_destroy(&attr);
- m_d->stackTop = static_cast<quintptr *>(stackBottom) + stackSize/sizeof(quintptr);
+ m_d->stackTop = static_cast<quintptr *>(stackBottom) + stackSize/sizeof(quintptr);
+ } else {
+ // can't scan the native stack so have to rely on exact gc
+ m_d->stackTop = 0;
+ m_d->exactGC = true;
+ }
# endif
#elif OS(WINCE)
if (false && g_stackBase) {