summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-09-24 14:35:49 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-09-24 15:36:17 (GMT)
commitaabd12223bda6260756ab19430082477d5669c0a (patch)
tree6ca7a12e627915992cfd0038f6ddd8ee244711f4 /src/script/bridge
parent270c374c178ec5a532d37168b018cd7ebc844558 (diff)
downloadQt-aabd12223bda6260756ab19430082477d5669c0a.zip
Qt-aabd12223bda6260756ab19430082477d5669c0a.tar.gz
Qt-aabd12223bda6260756ab19430082477d5669c0a.tar.bz2
Update src/3rdparty/javascriptcore and adapt src/script to the changes.
Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptactivationobject.cpp6
-rw-r--r--src/script/bridge/qscriptactivationobject_p.h2
-rw-r--r--src/script/bridge/qscriptclassobject.cpp8
-rw-r--r--src/script/bridge/qscriptclassobject_p.h5
-rw-r--r--src/script/bridge/qscriptglobalobject.cpp28
-rw-r--r--src/script/bridge/qscriptglobalobject_p.h31
-rw-r--r--src/script/bridge/qscriptobject.cpp33
-rw-r--r--src/script/bridge/qscriptobject_p.h15
-rw-r--r--src/script/bridge/qscriptqobject.cpp109
-rw-r--r--src/script/bridge/qscriptqobject_p.h20
-rw-r--r--src/script/bridge/qscriptvariant.cpp5
-rw-r--r--src/script/bridge/qscriptvariant_p.h4
12 files changed, 131 insertions, 135 deletions
diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp
index fea8f44..7982982 100644
--- a/src/script/bridge/qscriptactivationobject.cpp
+++ b/src/script/bridge/qscriptactivationobject.cpp
@@ -88,13 +88,13 @@ bool QScriptActivationObject::getPropertyAttributes(JSC::ExecState* exec, const
return JSC::JSVariableObject::getPropertyAttributes(exec, propertyName, attributes);
}
-void QScriptActivationObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, unsigned listedAttributes)
+void QScriptActivationObject::getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, bool includeNonEnumerable)
{
if (d_ptr()->delegate != 0) {
- d_ptr()->delegate->getPropertyNames(exec, propertyNames, listedAttributes);
+ d_ptr()->delegate->getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
return;
}
- return JSC::JSVariableObject::getPropertyNames(exec, propertyNames, listedAttributes);
+ return JSC::JSVariableObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
}
void QScriptActivationObject::putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes)
diff --git a/src/script/bridge/qscriptactivationobject_p.h b/src/script/bridge/qscriptactivationobject_p.h
index f45845d..f313f90 100644
--- a/src/script/bridge/qscriptactivationobject_p.h
+++ b/src/script/bridge/qscriptactivationobject_p.h
@@ -70,7 +70,7 @@ public:
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&, unsigned&) const;
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, unsigned listedAttributes = JSC::Structure::Prototype);
+ virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, bool includeNonEnumerable = false);
virtual void putWithAttributes(JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue value, unsigned attributes);
virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue value, JSC::PutPropertySlot&);
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index c1e386b..0d88532 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -188,9 +188,9 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
return QScriptObjectDelegate::getPropertyAttributes(object, exec, propertyName, attribs);
}
-void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState *exec,
- JSC::PropertyNameArray &propertyNames,
- unsigned listedAttributes)
+void ClassObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecState *exec,
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScript::SaveFrameHelper saveFrame(engine, exec);
@@ -204,7 +204,7 @@ void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState
}
delete it;
}
- QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames, listedAttributes);
+ QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, includeNonEnumerable);
}
JSC::CallType ClassObjectDelegate::getCallData(QScriptObject*, JSC::CallData &callData)
diff --git a/src/script/bridge/qscriptclassobject_p.h b/src/script/bridge/qscriptclassobject_p.h
index 253e406..f5cce76 100644
--- a/src/script/bridge/qscriptclassobject_p.h
+++ b/src/script/bridge/qscriptclassobject_p.h
@@ -87,8 +87,9 @@ public:
virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(QScriptObject*, JSC::ExecState*,
- JSC::PropertyNameArray&, unsigned listedAttributes = JSC::Structure::Prototype);
+ virtual void getOwnPropertyNames(QScriptObject*, JSC::ExecState*,
+ JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&);
static JSC::JSValue JSC_HOST_CALL call(JSC::ExecState*, JSC::JSObject*,
diff --git a/src/script/bridge/qscriptglobalobject.cpp b/src/script/bridge/qscriptglobalobject.cpp
index 17a96c3..c624a31 100644
--- a/src/script/bridge/qscriptglobalobject.cpp
+++ b/src/script/bridge/qscriptglobalobject.cpp
@@ -68,12 +68,11 @@ GlobalObject::~GlobalObject()
{
}
-void GlobalObject::mark()
+void GlobalObject::markChildren(JSC::MarkStack& markStack)
{
- Q_ASSERT(!marked());
- JSC::JSGlobalObject::mark();
- if (customGlobalObject && !customGlobalObject->marked())
- customGlobalObject->mark();
+ JSC::JSGlobalObject::markChildren(markStack);
+ if (customGlobalObject)
+ markStack.append(customGlobalObject);
}
bool GlobalObject::getOwnPropertySlot(JSC::ExecState* exec,
@@ -125,28 +124,29 @@ bool GlobalObject::getPropertyAttributes(JSC::ExecState* exec, const JSC::Identi
return JSC::JSGlobalObject::getPropertyAttributes(exec, propertyName, attributes);
}
-void GlobalObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, unsigned listedAttributes)
+void GlobalObject::getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames,
+ bool includeNonEnumerable)
{
if (customGlobalObject)
- customGlobalObject->getPropertyNames(exec, propertyNames, listedAttributes);
+ customGlobalObject->getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
else
- JSC::JSGlobalObject::getPropertyNames(exec, propertyNames, listedAttributes);
+ JSC::JSGlobalObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
}
-void GlobalObject::defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction)
+void GlobalObject::defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes)
{
if (customGlobalObject)
- customGlobalObject->defineGetter(exec, propertyName, getterFunction);
+ customGlobalObject->defineGetter(exec, propertyName, getterFunction, attributes);
else
- JSC::JSGlobalObject::defineGetter(exec, propertyName, getterFunction);
+ JSC::JSGlobalObject::defineGetter(exec, propertyName, getterFunction, attributes);
}
-void GlobalObject::defineSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction)
+void GlobalObject::defineSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes)
{
if (customGlobalObject)
- customGlobalObject->defineSetter(exec, propertyName, setterFunction);
+ customGlobalObject->defineSetter(exec, propertyName, setterFunction, attributes);
else
- JSC::JSGlobalObject::defineSetter(exec, propertyName, setterFunction);
+ JSC::JSGlobalObject::defineSetter(exec, propertyName, setterFunction, attributes);
}
JSC::JSValue GlobalObject::lookupGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
diff --git a/src/script/bridge/qscriptglobalobject_p.h b/src/script/bridge/qscriptglobalobject_p.h
index 70458a7..01784c2 100644
--- a/src/script/bridge/qscriptglobalobject_p.h
+++ b/src/script/bridge/qscriptglobalobject_p.h
@@ -68,7 +68,7 @@ public:
GlobalObject();
virtual ~GlobalObject();
virtual JSC::UString className() const { return "global"; }
- virtual void mark();
+ virtual void markChildren(JSC::MarkStack&);
virtual bool getOwnPropertySlot(JSC::ExecState*,
const JSC::Identifier& propertyName,
JSC::PropertySlot&);
@@ -81,10 +81,10 @@ public:
bool checkDontDelete = true);
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
- unsigned listedAttributes = JSC::Structure::Prototype);
- virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction);
- virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction);
+ virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
+ virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes = 0);
+ virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes = 0);
virtual JSC::JSValue lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);
virtual JSC::JSValue lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);
@@ -103,12 +103,10 @@ public:
{}
virtual JSC::UString className() const
{ return originalGlobalObject->className(); }
- virtual void mark()
+ virtual void markChildren(JSC::MarkStack& markStack)
{
- Q_ASSERT(!marked());
- if (!originalGlobalObject->marked())
- originalGlobalObject->JSC::JSGlobalObject::mark();
- JSC::JSObject::mark();
+ markStack.append(originalGlobalObject);
+ JSC::JSObject::markChildren(markStack);
}
virtual bool getOwnPropertySlot(JSC::ExecState* exec,
const JSC::Identifier& propertyName,
@@ -125,13 +123,12 @@ public:
virtual bool getPropertyAttributes(JSC::ExecState* exec, const JSC::Identifier& propertyName,
unsigned& attributes) const
{ return originalGlobalObject->JSC::JSGlobalObject::getPropertyAttributes(exec, propertyName, attributes); }
- virtual void getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames,
- unsigned listedAttributes = JSC::Structure::Prototype)
- { originalGlobalObject->JSC::JSGlobalObject::getPropertyNames(exec, propertyNames, listedAttributes); }
- virtual void defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction)
- { originalGlobalObject->JSC::JSGlobalObject::defineGetter(exec, propertyName, getterFunction); }
- virtual void defineSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction)
- { originalGlobalObject->JSC::JSGlobalObject::defineSetter(exec, propertyName, setterFunction); }
+ virtual void getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, bool includeNonEnumerable = false)
+ { originalGlobalObject->JSC::JSGlobalObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable); }
+ virtual void defineGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes)
+ { originalGlobalObject->JSC::JSGlobalObject::defineGetter(exec, propertyName, getterFunction, attributes); }
+ virtual void defineSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes)
+ { originalGlobalObject->JSC::JSGlobalObject::defineSetter(exec, propertyName, setterFunction, attributes); }
virtual JSC::JSValue lookupGetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
{ return originalGlobalObject->JSC::JSGlobalObject::lookupGetter(exec, propertyName); }
virtual JSC::JSValue lookupSetter(JSC::ExecState* exec, const JSC::Identifier& propertyName)
diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp
index 0807dc2..0d899f8 100644
--- a/src/script/bridge/qscriptobject.cpp
+++ b/src/script/bridge/qscriptobject.cpp
@@ -136,13 +136,14 @@ bool QScriptObject::getPropertyAttributes(JSC::ExecState* exec, const JSC::Ident
return d->delegate->getPropertyAttributes(this, exec, propertyName, attributes);
}
-void QScriptObject::getPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames, unsigned listedAttributes)
+void QScriptObject::getOwnPropertyNames(JSC::ExecState* exec, JSC::PropertyNameArray& propertyNames,
+ bool includeNonEnumerable)
{
if (!d || !d->delegate) {
- JSC::JSObject::getPropertyNames(exec, propertyNames, listedAttributes);
+ JSC::JSObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
return;
}
- d->delegate->getPropertyNames(this, exec, propertyNames, listedAttributes);
+ d->delegate->getOwnPropertyNames(this, exec, propertyNames, includeNonEnumerable);
}
bool QScriptObject::compareToObject(JSC::ExecState* exec, JSC::JSObject *other)
@@ -153,22 +154,20 @@ bool QScriptObject::compareToObject(JSC::ExecState* exec, JSC::JSObject *other)
return d->delegate->compareToObject(this, exec, other);
}
-
-void QScriptObject::mark()
+void QScriptObject::markChildren(JSC::MarkStack& markStack)
{
- 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->data)
+ markStack.append(d->data);
if (!d || !d->delegate) {
- JSC::JSObject::mark();
+ JSC::JSObject::markChildren(markStack);
return;
}
- d->delegate->mark(this);
+ d->delegate->markChildren(this, markStack);
}
JSC::CallType QScriptObject::getCallData(JSC::CallData &data)
@@ -235,17 +234,17 @@ bool QScriptObjectDelegate::getPropertyAttributes(const QScriptObject* object,
return object->JSC::JSObject::getPropertyAttributes(exec, propertyName, attributes);
}
-void QScriptObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState* exec,
- JSC::PropertyNameArray& propertyNames,
- unsigned listedAttributes)
+void QScriptObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecState* exec,
+ JSC::PropertyNameArray& propertyNames,
+ bool includeNonEnumerable)
{
- object->JSC::JSObject::getPropertyNames(exec, propertyNames, listedAttributes);
+ object->JSC::JSObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
}
-void QScriptObjectDelegate::mark(QScriptObject* object)
+void QScriptObjectDelegate::markChildren(QScriptObject* object, JSC::MarkStack& markStack)
{
- if (!object->marked())
- object->JSC::JSObject::mark();
+ // ### should this call the virtual function instead??
+ object->JSC::JSObject::markChildren(markStack);
}
JSC::CallType QScriptObjectDelegate::getCallData(QScriptObject* object, JSC::CallData& data)
diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h
index 8060914..c1cee31 100644
--- a/src/script/bridge/qscriptobject_p.h
+++ b/src/script/bridge/qscriptobject_p.h
@@ -88,11 +88,13 @@ public:
bool checkDontDelete = true);
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, unsigned listedAttributes = JSC::Structure::Prototype);
- virtual void mark();
+ virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
+ virtual void markChildren(JSC::MarkStack& markStack);
virtual JSC::CallType getCallData(JSC::CallData&);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
virtual bool hasInstance(JSC::ExecState*, JSC::JSValue value, JSC::JSValue proto);
+ virtual bool compareToObject(JSC::ExecState*, JSC::JSObject*);
virtual const JSC::ClassInfo* classInfo() const { return &info; }
static const JSC::ClassInfo info;
@@ -108,8 +110,6 @@ public:
QScriptObjectDelegate *delegate() const;
void setDelegate(QScriptObjectDelegate *delegate);
- virtual bool compareToObject(JSC::ExecState*, JSC::JSObject*);
-
protected:
Data *d;
};
@@ -145,14 +145,13 @@ public:
bool checkDontDelete = true);
virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
const JSC::Identifier&, unsigned&) const;
- virtual void getPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&,
- unsigned listedAttributes = JSC::Structure::Prototype);
- virtual void mark(QScriptObject*);
+ virtual void getOwnPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
+ virtual void markChildren(QScriptObject*, JSC::MarkStack& markStack);
virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&);
virtual JSC::ConstructType getConstructData(QScriptObject*, JSC::ConstructData&);
virtual bool hasInstance(QScriptObject*, JSC::ExecState*,
JSC::JSValue value, JSC::JSValue proto);
-
virtual bool compareToObject(QScriptObject*, JSC::ExecState*, JSC::JSObject*);
private:
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 236f899..345489f 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -99,11 +99,12 @@ struct QObjectConnection
return (s == slot);
}
- void mark()
+ void mark(JSC::MarkStack& markStack)
{
- if (senderWrapper && !senderWrapper.marked()) {
+ // ### need to find out if senderWrapper is marked
+ if (senderWrapper) {
// see if the sender should be marked or not
- Q_ASSERT(senderWrapper.isObject(&QScriptObject::info));
+ Q_ASSERT(senderWrapper.inherits(&QScriptObject::info));
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(senderWrapper));
QScriptObjectDelegate *delegate = scriptObject->delegate();
Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject));
@@ -111,15 +112,17 @@ struct QObjectConnection
if ((inst->ownership() == QScriptEngine::ScriptOwnership)
|| ((inst->ownership() == QScriptEngine::AutoOwnership)
&& inst->value() && !inst->value()->parent())) {
- senderWrapper = JSC::JSValue();
+ // #### don't mark if not marked otherwise
+ //senderWrapper = JSC::JSValue();
+ markStack.append(senderWrapper);
} else {
- senderWrapper.mark();
+ markStack.append(senderWrapper);
}
}
- if (receiver && !receiver.marked())
- receiver.mark();
- if (slot && !slot.marked())
- slot.mark();
+ if (receiver)
+ markStack.append(receiver);
+ if (slot)
+ markStack.append(slot);
}
};
@@ -154,7 +157,7 @@ public:
void execute(int slotIndex, void **argv);
- void mark();
+ void mark(JSC::MarkStack&);
private:
QScriptEnginePrivate *engine;
@@ -264,12 +267,11 @@ JSC::CallType QtFunction::getCallData(JSC::CallData &callData)
return JSC::CallTypeHost;
}
-void QtFunction::mark()
+void QtFunction::markChildren(JSC::MarkStack& markStack)
{
- Q_ASSERT(!marked());
- if (data->object && !data->object.marked())
- data->object.mark();
- JSC::InternalFunction::mark();
+ if (data->object)
+ markStack.append(data->object);
+ JSC::InternalFunction::markChildren(markStack);
}
QScriptObject *QtFunction::wrapperObject() const
@@ -988,7 +990,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c
JSC::JSValue QtFunction::execute(JSC::ExecState *exec, JSC::JSValue thisValue,
const JSC::ArgList &scriptArgs)
{
- Q_ASSERT(data->object.isObject(&QScriptObject::info));
+ Q_ASSERT(data->object.inherits(&QScriptObject::info));
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(data->object));
QScriptObjectDelegate *delegate = scriptObject->delegate();
Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject));
@@ -999,7 +1001,7 @@ JSC::JSValue QtFunction::execute(JSC::ExecState *exec, JSC::JSValue thisValue,
const QMetaObject *meta = qobj->metaObject();
QObject *thisQObject = 0;
thisValue = engine->toUsableValue(thisValue);
- if (thisValue.isObject(&QScriptObject::info)) {
+ if (thisValue.inherits(&QScriptObject::info)) {
delegate = static_cast<QScriptObject*>(JSC::asObject(thisValue))->delegate();
if (delegate && (delegate->type() == QScriptObjectDelegate::QtObject))
thisQObject = static_cast<QScript::QObjectDelegate*>(delegate)->value();
@@ -1511,9 +1513,9 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object,
return QScriptObjectDelegate::getPropertyAttributes(object, exec, propertyName, attributes);
}
-void QObjectDelegate::getPropertyNames(QScriptObject *object, JSC::ExecState *exec,
- JSC::PropertyNameArray &propertyNames,
- unsigned listedAttributes)
+void QObjectDelegate::getOwnPropertyNames(QScriptObject *object, JSC::ExecState *exec,
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
{
QObject *qobject = data->value;
if (!qobject) {
@@ -1557,24 +1559,24 @@ void QObjectDelegate::getPropertyNames(QScriptObject *object, JSC::ExecState *ex
}
}
- QScriptObjectDelegate::getPropertyNames(object, exec, propertyNames, listedAttributes);
+ QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, includeNonEnumerable);
}
-void QObjectDelegate::mark(QScriptObject *object)
+void QObjectDelegate::markChildren(QScriptObject *object, JSC::MarkStack& markStack)
{
QHash<QByteArray, JSC::JSValue>::const_iterator it;
for (it = data->cachedMembers.constBegin(); it != data->cachedMembers.constEnd(); ++it) {
JSC::JSValue val = it.value();
- if (val && !val.marked())
- val.mark();
+ if (val)
+ markStack.append(val);
}
- QScriptObjectDelegate::mark(object);
+ QScriptObjectDelegate::markChildren(object, markStack);
}
bool QObjectDelegate::compareToObject(QScriptObject *, JSC::ExecState *exec, JSC::JSObject *o2)
{
- if(!o2->inherits(&QScriptObject::info))
+ if (!o2->inherits(&QScriptObject::info))
return false;
QScriptObject *object = static_cast<QScriptObject*>(o2);
QScriptObjectDelegate *delegate = object->delegate();
@@ -1583,13 +1585,12 @@ bool QObjectDelegate::compareToObject(QScriptObject *, JSC::ExecState *exec, JSC
return value() == static_cast<QObjectDelegate *>(delegate)->value();
}
-
static JSC::JSValue JSC_HOST_CALL qobjectProtoFuncFindChild(JSC::ExecState *exec, JSC::JSObject*,
JSC::JSValue thisValue, const JSC::ArgList &args)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
thisValue = engine->toUsableValue(thisValue);
- if (!thisValue.isObject(&QScriptObject::info))
+ if (!thisValue.inherits(&QScriptObject::info))
return throwError(exec, JSC::TypeError, "this object is not a QObject");
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(thisValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
@@ -1610,7 +1611,7 @@ static JSC::JSValue JSC_HOST_CALL qobjectProtoFuncFindChildren(JSC::ExecState *e
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
thisValue = engine->toUsableValue(thisValue);
// extract the QObject
- if (!thisValue.isObject(&QScriptObject::info))
+ if (!thisValue.inherits(&QScriptObject::info))
return throwError(exec, JSC::TypeError, "this object is not a QObject");
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(thisValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
@@ -1622,7 +1623,7 @@ static JSC::JSValue JSC_HOST_CALL qobjectProtoFuncFindChildren(JSC::ExecState *e
QList<QObject *> children;
if (args.size() != 0) {
const JSC::JSValue arg = args.at(0);
- if (arg.isObject(&JSC::RegExpObject::info)) {
+ if (arg.inherits(&JSC::RegExpObject::info)) {
const QObjectList allChildren= obj->children();
JSC::RegExpObject *const regexp = JSC::asRegExpObject(arg);
@@ -1662,7 +1663,7 @@ static JSC::JSValue JSC_HOST_CALL qobjectProtoFuncToString(JSC::ExecState *exec,
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
thisValue = engine->toUsableValue(thisValue);
- if (!thisValue.isObject(&QScriptObject::info))
+ if (!thisValue.inherits(&QScriptObject::info))
return JSC::jsUndefined();
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(thisValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
@@ -1807,7 +1808,9 @@ bool QMetaObjectWrapperObject::getPropertyAttributes(JSC::ExecState *exec,
return JSC::JSObject::getPropertyAttributes(exec, propertyName, attributes);
}
-void QMetaObjectWrapperObject::getPropertyNames(JSC::ExecState *exec, JSC::PropertyNameArray &propertyNames, unsigned listedAttributes)
+void QMetaObjectWrapperObject::getOwnPropertyNames(JSC::ExecState *exec,
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
{
const QMetaObject *meta = data->value;
if (!meta)
@@ -1817,17 +1820,16 @@ void QMetaObjectWrapperObject::getPropertyNames(JSC::ExecState *exec, JSC::Prope
for (int j = 0; j < e.keyCount(); ++j)
propertyNames.add(JSC::Identifier(exec, e.key(j)));
}
- JSC::JSObject::getPropertyNames(exec, propertyNames, listedAttributes);
+ JSC::JSObject::getOwnPropertyNames(exec, propertyNames, includeNonEnumerable);
}
-void QMetaObjectWrapperObject::mark()
+void QMetaObjectWrapperObject::markChildren(JSC::MarkStack& markStack)
{
- Q_ASSERT(!marked());
- if (data->ctor && !data->ctor.marked())
- data->ctor.mark();
- if (data->prototype && !data->prototype.marked())
- data->prototype.mark();
- JSC::JSObject::mark();
+ if (data->ctor)
+ markStack.append(data->ctor);
+ if (data->prototype)
+ markStack.append(data->prototype);
+ JSC::JSObject::markChildren(markStack);
}
JSC::CallType QMetaObjectWrapperObject::getCallData(JSC::CallData& callData)
@@ -1883,12 +1885,12 @@ JSC::JSValue QMetaObjectWrapperObject::execute(JSC::ExecState *exec,
JSC::CallType callType = data->ctor.getCallData(callData);
Q_UNUSED(callType);
Q_ASSERT_X(callType == JSC::CallTypeHost, Q_FUNC_INFO, "script constructors not supported");
- if (data->ctor.isObject(&FunctionWithArgWrapper::info)) {
+ if (data->ctor.inherits(&FunctionWithArgWrapper::info)) {
FunctionWithArgWrapper *wrapper = static_cast<FunctionWithArgWrapper*>(JSC::asObject(data->ctor));
QScriptValue result = wrapper->function()(ctx, QScriptEnginePrivate::get(eng_p), wrapper->arg());
return eng_p->scriptValueToJSCValue(result);
} else {
- Q_ASSERT(data->ctor.isObject(&FunctionWrapper::info));
+ Q_ASSERT(data->ctor.inherits(&FunctionWrapper::info));
FunctionWrapper *wrapper = static_cast<FunctionWrapper*>(JSC::asObject(data->ctor));
QScriptValue result = wrapper->function()(ctx, QScriptEnginePrivate::get(eng_p));
return eng_p->scriptValueToJSCValue(result);
@@ -1899,7 +1901,7 @@ JSC::JSValue QMetaObjectWrapperObject::execute(JSC::ExecState *exec,
JSC::JSValue result = callQtMethod(exec, QMetaMethod::Constructor, /*thisQObject=*/0,
args, meta, meta->constructorCount()-1, /*maybeOverloaded=*/true);
if (!exec->hadException()) {
- Q_ASSERT(result && result.isObject(&QScriptObject::info));
+ Q_ASSERT(result && result.inherits(&QScriptObject::info));
QScriptObject *object = static_cast<QScriptObject*>(JSC::asObject(result));
QScript::QObjectDelegate *delegate = static_cast<QScript::QObjectDelegate*>(object->delegate());
delegate->setOwnership(QScriptEngine::AutoOwnership);
@@ -1926,7 +1928,7 @@ static JSC::JSValue JSC_HOST_CALL qmetaobjectProtoFuncClassName(
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
thisValue = engine->toUsableValue(thisValue);
- if (!thisValue.isObject(&QMetaObjectWrapperObject::info))
+ if (!thisValue.inherits(&QMetaObjectWrapperObject::info))
return throwError(exec, JSC::TypeError, "this object is not a QMetaObject");
const QMetaObject *meta = static_cast<QMetaObjectWrapperObject*>(JSC::asObject(thisValue))->value();
return JSC::jsString(exec, meta->className());
@@ -2060,7 +2062,7 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv)
JSC::ArgList jscArgs(argsVector.data(), argsVector.size());
JSC::JSValue senderObject;
- if (senderWrapper && senderWrapper.isObject(&QScriptObject::info)) // ### check if it's actually a QObject wrapper
+ if (senderWrapper && senderWrapper.inherits(&QScriptObject::info)) // ### check if it's actually a QObject wrapper
senderObject = senderWrapper;
else {
QScriptEngine::QObjectWrapOptions opt = QScriptEngine::PreferExistingWrapperObject;
@@ -2093,12 +2095,12 @@ QObjectConnectionManager::~QObjectConnectionManager()
{
}
-void QObjectConnectionManager::mark()
+void QObjectConnectionManager::mark(JSC::MarkStack& markStack)
{
for (int i = 0; i < connections.size(); ++i) {
QVector<QObjectConnection> &cs = connections[i];
for (int j = 0; j < cs.size(); ++j)
- cs[j].mark();
+ cs[j].mark(markStack);
}
}
@@ -2162,19 +2164,18 @@ QObjectData::~QObjectData()
}
}
-void QObjectData::mark()
+void QObjectData::mark(JSC::MarkStack& markStack)
{
if (connectionManager)
- connectionManager->mark();
+ connectionManager->mark(markStack);
{
QList<QScript::QObjectWrapperInfo>::iterator it;
for (it = wrappers.begin(); it != wrappers.end(); ) {
const QScript::QObjectWrapperInfo &info = *it;
- if (info.object->marked()) {
- ++it;
- } else {
- it = wrappers.erase(it);
- }
+ // ### don't mark if there are no other references.
+ // we need something like isMarked()
+ markStack.append(info.object);
+ ++it;
}
}
}
diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h
index 72d066d..2d482cc 100644
--- a/src/script/bridge/qscriptqobject_p.h
+++ b/src/script/bridge/qscriptqobject_p.h
@@ -105,9 +105,11 @@ public:
virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(QScriptObject*, JSC::ExecState*, JSC::PropertyNameArray&,
- unsigned listedAttributes = JSC::Structure::Prototype);
- virtual void mark(QScriptObject*);
+ virtual void getOwnPropertyNames(QScriptObject*, JSC::ExecState*,
+ JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
+ virtual void markChildren(QScriptObject*, JSC::MarkStack& markStack);
+ virtual bool compareToObject(QScriptObject*, JSC::ExecState*, JSC::JSObject*);
inline QObject *value() const { return data->value; }
inline void setValue(QObject* value) { data->value = value; }
@@ -122,8 +124,6 @@ public:
inline void setOptions(QScriptEngine::QObjectWrapOptions options)
{ data->options = options; }
- virtual bool compareToObject(QScriptObject*, JSC::ExecState*, JSC::JSObject*);
-
protected:
Data *data;
};
@@ -181,7 +181,7 @@ public:
QScriptEngine::ValueOwnership ownership,
const QScriptEngine::QObjectWrapOptions &options);
- void mark();
+ void mark(JSC::MarkStack&);
private:
QScriptEnginePrivate *engine;
@@ -208,7 +208,7 @@ public:
virtual ~QtFunction();
virtual JSC::CallType getCallData(JSC::CallData&);
- virtual void mark();
+ virtual void markChildren(JSC::MarkStack&);
virtual const JSC::ClassInfo* classInfo() const { return &info; }
static const JSC::ClassInfo info;
@@ -297,9 +297,9 @@ public:
bool checkDontDelete = true);
virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&,
unsigned&) const;
- virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
- unsigned listedAttributes = JSC::Structure::Prototype);
- virtual void mark();
+ virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
+ virtual void markChildren(JSC::MarkStack& markStack);
virtual JSC::CallType getCallData(JSC::CallData&);
virtual JSC::ConstructType getConstructData(JSC::ConstructData&);
diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp
index aa7ad94..725f4e0 100644
--- a/src/script/bridge/qscriptvariant.cpp
+++ b/src/script/bridge/qscriptvariant.cpp
@@ -89,7 +89,7 @@ static JSC::JSValue JSC_HOST_CALL variantProtoFuncValueOf(JSC::ExecState *exec,
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
thisValue = engine->toUsableValue(thisValue);
- if (!thisValue.isObject(&QScriptObject::info))
+ if (!thisValue.inherits(&QScriptObject::info))
return throwError(exec, JSC::TypeError);
QScriptObjectDelegate *delegate = static_cast<QScriptObject*>(JSC::asObject(thisValue))->delegate();
if (!delegate || (delegate->type() != QScriptObjectDelegate::Variant))
@@ -127,7 +127,7 @@ static JSC::JSValue JSC_HOST_CALL variantProtoFuncToString(JSC::ExecState *exec,
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
thisValue = engine->toUsableValue(thisValue);
- if (!thisValue.isObject(&QScriptObject::info))
+ if (!thisValue.inherits(&QScriptObject::info))
return throwError(exec, JSC::TypeError, "This object is not a QVariant");
QScriptObjectDelegate *delegate = static_cast<QScriptObject*>(JSC::asObject(thisValue))->delegate();
if (!delegate || (delegate->type() != QScriptObjectDelegate::Variant))
@@ -154,7 +154,6 @@ bool QVariantDelegate::compareToObject(QScriptObject *, JSC::ExecState *exec, JS
return variant1 == scriptEngineFromExec(exec)->scriptValueFromJSCValue(o2).toVariant();
}
-
QVariantPrototype::QVariantPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::Structure> structure,
JSC::Structure* prototypeFunctionStructure)
: QScriptObject(structure)
diff --git a/src/script/bridge/qscriptvariant_p.h b/src/script/bridge/qscriptvariant_p.h
index 4ce0aa6..445ca69 100644
--- a/src/script/bridge/qscriptvariant_p.h
+++ b/src/script/bridge/qscriptvariant_p.h
@@ -68,13 +68,13 @@ public:
QVariantDelegate(const QVariant &value);
~QVariantDelegate();
+ virtual bool compareToObject(QScriptObject*, JSC::ExecState*, JSC::JSObject*);
+
QVariant &value();
void setValue(const QVariant &value);
Type type() const;
- bool compareToObject(QScriptObject*, JSC::ExecState*, JSC::JSObject*);
-
private:
QVariant m_value;
};