summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-20 14:39:02 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-20 14:39:02 (GMT)
commitf32035e829bbad14eed632d80794349a878bcc38 (patch)
tree2d86864a060c482b0e19a9f6d30bfa75033dc575 /src/script/bridge
parent6fec99fd1fc256437c5c651209084f479005a7a7 (diff)
downloadQt-f32035e829bbad14eed632d80794349a878bcc38.zip
Qt-f32035e829bbad14eed632d80794349a878bcc38.tar.gz
Qt-f32035e829bbad14eed632d80794349a878bcc38.tar.bz2
add recursion guard for GC marking
To achieve behavior of the old back-end. There, the recursion guard was automatic because a mark flag was set on the object as soon as marking begun, but in JSC it appears to only be set _after_ the marking is completed.
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptobject.cpp6
-rw-r--r--src/script/bridge/qscriptobject_p.h3
-rw-r--r--src/script/bridge/qscriptqobject.cpp5
3 files changed, 10 insertions, 4 deletions
diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp
index a8bd798..a550d39 100644
--- a/src/script/bridge/qscriptobject.cpp
+++ b/src/script/bridge/qscriptobject.cpp
@@ -41,6 +41,7 @@
#include "config.h"
#include "qscriptobject_p.h"
+#include "private/qobject_p.h"
QT_BEGIN_NAMESPACE
@@ -144,6 +145,11 @@ void QScriptObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArra
void QScriptObject::mark()
{
Q_ASSERT(!marked());
+ if (!d)
+ d = new Data();
+ if (d->isMarking)
+ return;
+ QBoolBlocker markBlocker(d->isMarking, true);
if (d && d->data && !d->data.marked())
d->data.mark();
if (!d || !d->delegate) {
diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h
index a905234..d499c61 100644
--- a/src/script/bridge/qscriptobject_p.h
+++ b/src/script/bridge/qscriptobject_p.h
@@ -69,8 +69,9 @@ public:
{
JSC::JSValue data; // QScriptValue::data
QScriptObjectDelegate *delegate;
+ bool isMarking; // recursion guard
- Data() : delegate(0) {}
+ Data() : delegate(0), isMarking(false) {}
~Data();
};
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index bb701ce..b7a0e44 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -266,9 +266,8 @@ JSC::CallType QtFunction::getCallData(JSC::CallData &callData)
void QtFunction::mark()
{
Q_ASSERT(!marked());
- if (data->object && !data->object.marked()) {
- JSC::asObject(data->object)->JSC::JSObject::mark();
- }
+ if (data->object && !data->object.marked())
+ data->object.mark();
JSC::InternalFunction::mark();
}