diff options
author | axis <qt-info@nokia.com> | 2009-10-23 09:40:37 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-10-23 09:40:37 (GMT) |
commit | 180d9189e8098d98848367f673fff723ddd1d068 (patch) | |
tree | b052fb1b8361e962884f54aa4d6e6d8dd6f67e73 /src/3rdparty/webkit/JavaScriptCore/runtime/JSObject.cpp | |
parent | 18acf933474577a4cec31560eeee22de04111e1e (diff) | |
parent | 0f6909e8e1be93d16798d31f18c4da2b0b5a084c (diff) | |
download | Qt-180d9189e8098d98848367f673fff723ddd1d068.zip Qt-180d9189e8098d98848367f673fff723ddd1d068.tar.gz Qt-180d9189e8098d98848367f673fff723ddd1d068.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.cpp | 40 |
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 |