summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2009-10-22 21:18:11 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-10-22 21:18:11 (GMT)
commit4d1a9b18b905f21b70608b13f4789dadec6bc181 (patch)
treebfa0d9364432b0c4fc55648acc0f99a3a12e42f9 /src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
parenta6a8e2b1918b2037c9d79e59aabf04ef09bee73e (diff)
parent6e84a8f0d93f178611a40917fec92648e956fe38 (diff)
downloadQt-4d1a9b18b905f21b70608b13f4789dadec6bc181.zip
Qt-4d1a9b18b905f21b70608b13f4789dadec6bc181.tar.gz
Qt-4d1a9b18b905f21b70608b13f4789dadec6bc181.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
index db2a9b2..6932ded 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp
@@ -42,6 +42,25 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(JSObject);
+static inline void getEnumerablePropertyNames(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames)
+{
+ // Add properties from the static hashtables of properties
+ for (; classInfo; classInfo = classInfo->parentClass) {
+ const HashTable* table = classInfo->propHashTable(exec);
+ if (!table)
+ continue;
+ table->initializeIfNeeded(exec);
+ ASSERT(table->table);
+
+ int hashSizeMask = table->compactSize - 1;
+ const HashEntry* entry = table->table;
+ for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
+ if (entry->key() && !(entry->attributes() & DontEnum))
+ propertyNames.add(entry->key());
+ }
+ }
+}
+
void JSObject::markChildren(MarkStack& markStack)
{
#ifndef NDEBUG
@@ -424,12 +443,29 @@ bool JSObject::getPropertySpecificValue(ExecState*, const Identifier& propertyNa
void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
- m_structure->getEnumerablePropertyNames(exec, propertyNames, this);
+ getOwnPropertyNames(exec, propertyNames);
+
+ if (prototype().isNull())
+ return;
+
+ JSObject* prototype = asObject(this->prototype());
+ while(1) {
+ if (prototype->structure()->typeInfo().overridesGetPropertyNames()) {
+ prototype->getPropertyNames(exec, propertyNames);
+ break;
+ }
+ prototype->getOwnPropertyNames(exec, propertyNames);
+ JSValue nextProto = prototype->prototype();
+ if (nextProto.isNull())
+ break;
+ prototype = asObject(nextProto);
+ }
}
void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
{
- m_structure->getOwnEnumerablePropertyNames(exec, propertyNames, this);
+ m_structure->getEnumerablePropertyNames(propertyNames);
+ getEnumerablePropertyNames(exec, classInfo(), propertyNames);
}
bool JSObject::toBoolean(ExecState*) const