summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-27 12:58:33 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-27 12:58:33 (GMT)
commit94c4d2cf9ed3878d91a866d492717ae36bb253bd (patch)
treecc704371ded0fc12f66756c1d40a57631ce8024d
parentf5af458153471d3788fe5abe5e6b5d9749ba42fe (diff)
downloadQt-94c4d2cf9ed3878d91a866d492717ae36bb253bd.zip
Qt-94c4d2cf9ed3878d91a866d492717ae36bb253bd.tar.gz
Qt-94c4d2cf9ed3878d91a866d492717ae36bb253bd.tar.bz2
move engine-specific GC marking to QScriptEnginePrivate
-rw-r--r--src/script/api/qscriptengine.cpp84
-rw-r--r--src/script/api/qscriptengine_p.h1
2 files changed, 45 insertions, 40 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index a54d029..4070c67 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -587,46 +587,7 @@ GlobalObject::~GlobalObject()
void GlobalObject::mark()
{
JSC::JSGlobalObject::mark();
-
- if (engine->uncaughtException && !engine->uncaughtException.marked())
- engine->uncaughtException.mark();
-
- if (engine->customGlobalObject && !engine->customGlobalObject->marked())
- engine->customGlobalObject->mark();
-
- if (engine->qobjectPrototype && !engine->qobjectPrototype->marked())
- engine->qobjectPrototype->mark();
- if (engine->qmetaobjectPrototype && !engine->qmetaobjectPrototype->marked())
- engine->qmetaobjectPrototype->mark();
- if (engine->variantPrototype && !engine->variantPrototype->marked())
- engine->variantPrototype->mark();
-
- {
- QHash<JSC::JSCell*,QBasicAtomicInt>::const_iterator it;
- for (it = engine->keepAliveValues.constBegin(); it != engine->keepAliveValues.constEnd(); ++it) {
- JSC::JSCell *cell = it.key();
- if (!cell->marked())
- cell->mark();
- }
- }
-
-#ifndef QT_NO_QOBJECT
- {
- QHash<QObject*, QScript::QObjectData*>::const_iterator it;
- for (it = engine->m_qobjectData.constBegin(); it != engine->m_qobjectData.constEnd(); ++it) {
- QScript::QObjectData *qdata = it.value();
- qdata->mark();
- }
- }
-#endif
-
- {
- QHash<int, QScriptTypeInfo*>::const_iterator it;
- for (it = engine->m_typeInfos.constBegin(); it != engine->m_typeInfos.constEnd(); ++it) {
- if ((*it)->prototype && !(*it)->prototype.marked())
- (*it)->prototype.mark();
- }
- }
+ engine->mark();
}
bool GlobalObject::getOwnPropertySlot(JSC::ExecState* exec,
@@ -1072,6 +1033,49 @@ void QScriptEnginePrivate::releaseContextForFrame(JSC::ExecState *frame)
delete ctx;
}
+void QScriptEnginePrivate::mark()
+{
+ if (uncaughtException && !uncaughtException.marked())
+ uncaughtException.mark();
+
+ if (customGlobalObject && !customGlobalObject->marked())
+ customGlobalObject->mark();
+
+ if (qobjectPrototype && !qobjectPrototype->marked())
+ qobjectPrototype->mark();
+ if (qmetaobjectPrototype && !qmetaobjectPrototype->marked())
+ qmetaobjectPrototype->mark();
+ if (variantPrototype && !variantPrototype->marked())
+ variantPrototype->mark();
+
+ {
+ QHash<JSC::JSCell*,QBasicAtomicInt>::const_iterator it;
+ for (it = keepAliveValues.constBegin(); it != keepAliveValues.constEnd(); ++it) {
+ JSC::JSCell *cell = it.key();
+ if (!cell->marked())
+ cell->mark();
+ }
+ }
+
+#ifndef QT_NO_QOBJECT
+ {
+ QHash<QObject*, QScript::QObjectData*>::const_iterator it;
+ for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) {
+ QScript::QObjectData *qdata = it.value();
+ qdata->mark();
+ }
+ }
+#endif
+
+ {
+ QHash<int, QScriptTypeInfo*>::const_iterator it;
+ for (it = m_typeInfos.constBegin(); it != m_typeInfos.constEnd(); ++it) {
+ if ((*it)->prototype && !(*it)->prototype.marked())
+ (*it)->prototype.mark();
+ }
+ }
+}
+
bool QScriptEnginePrivate::isCollecting() const
{
return globalObject->globalData()->heap.isBusy();
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index b7109b0..24863a7 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -110,6 +110,7 @@ public:
QScriptContext *contextForFrame(JSC::ExecState *frame);
void releaseContextForFrame(JSC::ExecState *frame);
+ void mark();
bool isCollecting() const;
void collectGarbage();