summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-08-03 14:12:10 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-08-03 14:18:09 (GMT)
commite520df1f8678bd59adb341fb586f008a7de17fe8 (patch)
treec8cfbf8e651c1e8aa5f9e0f305757b254e9ab6c4 /src/3rdparty/webkit/JavaScriptCore
parentecb53d192b4a56cd71c251621bec15a509307b23 (diff)
downloadQt-e520df1f8678bd59adb341fb586f008a7de17fe8.zip
Qt-e520df1f8678bd59adb341fb586f008a7de17fe8.tar.gz
Qt-e520df1f8678bd59adb341fb586f008a7de17fe8.tar.bz2
Complete the implementation of QScriptValueIterator with JSCore
This new implementation of QScriptValueIterator passes all the tests. QScriptValueIterator uses an linked list instead of JSC::PropertyNameArray so the list can be modified by ::remove() and to be able to add internal properties for the strings and arrays. Structure::getPropertyNames() has been modified to not show the property from the prototype. Reviewed-by: Kent Hansen
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp10
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h7
4 files changed, 15 insertions, 8 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
index 8e5c398..10efd59 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
@@ -447,9 +447,9 @@ bool JSObject::getPropertySpecificValue(ExecState*, const Identifier& propertyNa
return false;
}
-void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, bool includeNonEnumerable)
+void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, unsigned listedAttributes)
{
- m_structure->getPropertyNames(exec, propertyNames, this, includeNonEnumerable);
+ m_structure->getPropertyNames(exec, propertyNames, this, listedAttributes);
}
bool JSObject::toBoolean(ExecState*) const
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h
index 9838bb1..f390f4a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.h
@@ -117,7 +117,7 @@ namespace JSC {
virtual bool hasInstance(ExecState*, JSValue, JSValue prototypeProperty);
- virtual void getPropertyNames(ExecState*, PropertyNameArray&, bool includeNonEnumerable = false);
+ virtual void getPropertyNames(ExecState*, PropertyNameArray&, unsigned listedAttributes = Structure::Prototype);
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value);
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
index 1e4c429..9f6b0c3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp
@@ -285,9 +285,9 @@ void Structure::materializePropertyMap()
}
}
-void Structure::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject, bool includeNonEnumerable)
+void Structure::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject, unsigned listedAttributes)
{
- bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary);
+ bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_isDictionary) && (listedAttributes & Prototype);
if (shouldCache && m_cachedPropertyNameArrayData) {
if (m_cachedPropertyNameArrayData->cachedPrototypeChain() == prototypeChain(exec)) {
@@ -296,11 +296,13 @@ void Structure::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNam
}
clearEnumerationCache();
}
-
+ bool includeNonEnumerable = false;
+ if (listedAttributes & NonEnumerable)
+ includeNonEnumerable = true;
getNamesFromPropertyTable(propertyNames, includeNonEnumerable);
getNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames, includeNonEnumerable);
- if (m_prototype.isObject()) {
+ if ((listedAttributes & Prototype) && m_prototype.isObject()) {
propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly.
asObject(m_prototype)->getPropertyNames(exec, propertyNames);
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h
index 6c5e82f..0de03a3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h
@@ -50,6 +50,11 @@ namespace JSC {
class Structure : public RefCounted<Structure> {
public:
+ enum ListedAttribute {
+ NonEnumerable = 1 << 1,
+ Prototype = 1 << 2
+ };
+
friend class JIT;
static PassRefPtr<Structure> create(JSValue prototype, const TypeInfo& typeInfo)
{
@@ -106,7 +111,7 @@ namespace JSC {
return get(propertyName._ustring.rep(), attributes, specificValue);
}
- void getPropertyNames(ExecState*, PropertyNameArray&, JSObject*, bool includeNonEnumerable = false);
+ void getPropertyNames(ExecState*, PropertyNameArray&, JSObject*, unsigned listedAttributes = Prototype);
bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }