Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (201852 => 201853)
--- trunk/Source/_javascript_Core/ChangeLog 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-06-09 05:43:46 UTC (rev 201853)
@@ -1,3 +1,46 @@
+2016-06-08 Gavin & Ellie Barraclough <barraclo...@apple.com>
+
+ JSObject::reifyAllStaticProperties cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=158543
+
+ Reviewed by Mark Lam.
+
+ - JSObject & Structure contain fields labeled 'staticFunctionsReified', however reification now
+ affects all properties, not just functions. Rename to 'staticPropertiesReified'.
+ - reifyAllStaticProperties relies on a 'hasStaticProperties' method on ClassInfo that walks the
+ ClassInfo inheritance chain looking for static property tables. We can now more efficiently
+ get this information from TypeInfo.
+ - reifyAllStaticProperties triggers a 'toUncacheableDictionaryTransition'; this is overzealous,
+ cacheable dictionary is sufficient - this is what we do in the case of DOM prototype property
+ reification (see 'reifyStaticProperties' in Lookup.h). (Changing this with an eye on switching
+ DOM prototype property reification to use JSObject:: reifyAllStaticProperties, rather than
+ having its own special purpose code path.)
+
+ * runtime/ClassInfo.h:
+ (JSC::ClassInfo::hasStaticProperties): Deleted.
+ - deprecated by TypeInfo::hasStaticPropertyTable.
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::putInlineSlow):
+ (JSC::JSObject::deleteProperty):
+ (JSC::JSObject::getOwnNonIndexPropertyNames):
+ - staticFunctionsReified -> staticPropertiesReified
+ (JSC::JSObject::reifyAllStaticProperties):
+ - hasStaticProperties -> TypeInfo::hasStaticPropertyTable
+ - toUncacheableDictionaryTransition -> toCacheableDictionaryTransition
+ - staticFunctionsReified -> staticPropertiesReified
+ * runtime/JSObject.h:
+ (JSC::JSObject::staticPropertiesReified):
+ (JSC::JSObject::staticFunctionsReified): Deleted.
+ * runtime/Lookup.cpp:
+ (JSC::setUpStaticFunctionSlot):
+ * runtime/Lookup.h:
+ (JSC::getStaticPropertySlotFromTable):
+ (JSC::replaceStaticPropertySlot):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ * runtime/Structure.h:
+ - staticFunctionsReified -> staticPropertiesReified
+
2016-06-08 Benjamin Poulain <bpoul...@apple.com>
Change thresholdForOptimizeSoon to match thresholdForOptimizeAfterWarmUp
Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/ClassInfo.h 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h 2016-06-09 05:43:46 UTC (rev 201853)
@@ -197,15 +197,6 @@
return false;
}
- bool hasStaticProperties() const
- {
- for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
- if (ci->staticPropHashTable)
- return true;
- }
- return false;
- }
-
JS_EXPORT_PRIVATE bool hasStaticSetterOrReadonlyProperties() const;
const HashTable* staticPropHashTable;
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2016-06-09 05:43:46 UTC (rev 201853)
@@ -568,7 +568,7 @@
// prototypes it should be replaced, so break here.
break;
}
- if (!obj->staticFunctionsReified()) {
+ if (!obj->staticPropertiesReified()) {
if (obj->classInfo()->hasStaticSetterOrReadonlyProperties()) {
if (auto* entry = obj->findPropertyHashEntry(propertyName))
return putEntry(exec, entry, obj, this, propertyName, value, slot);
@@ -1498,7 +1498,7 @@
unsigned attributes;
- if (!thisObject->staticFunctionsReified()) {
+ if (!thisObject->staticPropertiesReified()) {
if (auto* entry = thisObject->findPropertyHashEntry(propertyName)) {
// If the static table contains a non-configurable (DontDelete) property then we can return early;
// if there is a property in the storage array it too must be non-configurable (the language does
@@ -1890,7 +1890,7 @@
void JSObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
- if (!object->staticFunctionsReified())
+ if (!object->staticPropertiesReified())
getClassPropertyNames(exec, object->classInfo(), propertyNames, mode);
if (!mode.includeJSObjectProperties())
@@ -1965,18 +1965,18 @@
void JSObject::reifyAllStaticProperties(ExecState* exec)
{
- ASSERT(!staticFunctionsReified());
+ ASSERT(!staticPropertiesReified());
VM& vm = exec->vm();
// If this object's ClassInfo has no static properties, then nothing to reify!
// We can safely set the flag to avoid the expensive check again in the future.
- if (!classInfo()->hasStaticProperties()) {
- structure(vm)->setStaticFunctionsReified(true);
+ if (!TypeInfo::hasStaticPropertyTable(inlineTypeFlags())) {
+ structure(vm)->setStaticPropertiesReified(true);
return;
}
- if (!structure(vm)->isUncacheableDictionary())
- setStructure(vm, Structure::toUncacheableDictionaryTransition(vm, structure(vm)));
+ if (!structure(vm)->isDictionary())
+ setStructure(vm, Structure::toCacheableDictionaryTransition(vm, structure(vm)));
for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
const HashTable* hashTable = info->staticPropHashTable;
@@ -1992,7 +1992,7 @@
}
}
- structure(vm)->setStaticFunctionsReified(true);
+ structure(vm)->setStaticPropertiesReified(true);
}
NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue getterSetter, unsigned attributes, PropertyOffset offset)
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2016-06-09 05:43:46 UTC (rev 201853)
@@ -678,7 +678,7 @@
|| structure()->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero();
}
- bool staticFunctionsReified() { return structure()->staticFunctionsReified(); }
+ bool staticPropertiesReified() { return structure()->staticPropertiesReified(); }
void reifyAllStaticProperties(ExecState*);
JS_EXPORT_PRIVATE Butterfly* growOutOfLineStorage(VM&, size_t oldSize, size_t newSize);
Modified: trunk/Source/_javascript_Core/runtime/Lookup.cpp (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/Lookup.cpp 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/Lookup.cpp 2016-06-09 05:43:46 UTC (rev 201853)
@@ -53,7 +53,7 @@
if (!isValidOffset(offset)) {
// If a property is ever deleted from an object with a static table, then we reify
// all static functions at that time - after this we shouldn't be re-adding anything.
- if (thisObject->staticFunctionsReified())
+ if (thisObject->staticPropertiesReified())
return false;
if (entry->attributes() & Builtin)
Modified: trunk/Source/_javascript_Core/runtime/Lookup.h (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/Lookup.h 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/Lookup.h 2016-06-09 05:43:46 UTC (rev 201853)
@@ -210,7 +210,7 @@
inline bool getStaticPropertySlotFromTable(VM& vm, const HashTable& table, JSObject* thisObject, PropertyName propertyName, PropertySlot& slot)
{
- if (thisObject->staticFunctionsReified())
+ if (thisObject->staticPropertiesReified())
return false;
auto* entry = table.entry(propertyName);
@@ -234,7 +234,7 @@
if (!thisObject->putDirect(vm, propertyName, value))
return false;
- if (!thisObject->staticFunctionsReified())
+ if (!thisObject->staticPropertiesReified())
thisObject->JSObject::setStructure(vm, Structure::attributeChangeTransition(vm, thisObject->structure(), propertyName, 0));
return true;
Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/Structure.cpp 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp 2016-06-09 05:43:46 UTC (rev 201853)
@@ -205,7 +205,7 @@
setAttributesInPrevious(0);
setDidPreventExtensions(false);
setDidTransition(false);
- setStaticFunctionsReified(false);
+ setStaticPropertiesReified(false);
setTransitionWatchpointIsLikelyToBeFired(false);
setHasBeenDictionary(false);
@@ -236,7 +236,7 @@
setAttributesInPrevious(0);
setDidPreventExtensions(false);
setDidTransition(false);
- setStaticFunctionsReified(false);
+ setStaticPropertiesReified(false);
setTransitionWatchpointIsLikelyToBeFired(false);
setHasBeenDictionary(false);
@@ -266,7 +266,7 @@
setAttributesInPrevious(0);
setDidPreventExtensions(previous->didPreventExtensions());
setDidTransition(true);
- setStaticFunctionsReified(previous->staticFunctionsReified());
+ setStaticPropertiesReified(previous->staticPropertiesReified());
setHasBeenDictionary(previous->hasBeenDictionary());
TypeInfo typeInfo = previous->typeInfo();
Modified: trunk/Source/_javascript_Core/runtime/Structure.h (201852 => 201853)
--- trunk/Source/_javascript_Core/runtime/Structure.h 2016-06-09 05:18:38 UTC (rev 201852)
+++ trunk/Source/_javascript_Core/runtime/Structure.h 2016-06-09 05:43:46 UTC (rev 201853)
@@ -609,7 +609,7 @@
DEFINE_BITFIELD(unsigned, attributesInPrevious, AttributesInPrevious, 14, 6);
DEFINE_BITFIELD(bool, didPreventExtensions, DidPreventExtensions, 1, 20);
DEFINE_BITFIELD(bool, didTransition, DidTransition, 1, 21);
- DEFINE_BITFIELD(bool, staticFunctionsReified, StaticFunctionsReified, 1, 22);
+ DEFINE_BITFIELD(bool, staticPropertiesReified, StaticPropertiesReified, 1, 22);
DEFINE_BITFIELD(bool, hasBeenFlattenedBefore, HasBeenFlattenedBefore, 1, 23);
DEFINE_BITFIELD(bool, hasCustomGetterSetterProperties, HasCustomGetterSetterProperties, 1, 24);
DEFINE_BITFIELD(bool, didWatchInternalProperties, DidWatchInternalProperties, 1, 25);