- Revision
- 189596
- Author
- [email protected]
- Date
- 2015-09-10 16:07:08 -0700 (Thu, 10 Sep 2015)
Log Message
Structure should be able to tell you if it had ever been a dictionary
https://bugs.webkit.org/show_bug.cgi?id=149047
Reviewed by Mark Lam.
Introduces the hasBeenDictionary flag to Structure, which tells you if this structure or
any of its ancestors is a dictionary. We already implicitly tracked this for DFG
watchpoint optimizations, so this is mainly just decoupling that existing logic from
watchpoints. Having Structure::hasBeenDictionary() enables some of the heuristics in the
property type inference work (https://bugs.webkit.org/show_bug.cgi?id=148610).
* runtime/Structure.cpp:
(JSC::Structure::Structure):
(JSC::Structure::toDictionaryTransition):
(JSC::Structure::dump):
* runtime/Structure.h:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (189595 => 189596)
--- trunk/Source/_javascript_Core/ChangeLog 2015-09-10 22:59:08 UTC (rev 189595)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-09-10 23:07:08 UTC (rev 189596)
@@ -1,3 +1,22 @@
+2015-09-10 Filip Pizlo <[email protected]>
+
+ Structure should be able to tell you if it had ever been a dictionary
+ https://bugs.webkit.org/show_bug.cgi?id=149047
+
+ Reviewed by Mark Lam.
+
+ Introduces the hasBeenDictionary flag to Structure, which tells you if this structure or
+ any of its ancestors is a dictionary. We already implicitly tracked this for DFG
+ watchpoint optimizations, so this is mainly just decoupling that existing logic from
+ watchpoints. Having Structure::hasBeenDictionary() enables some of the heuristics in the
+ property type inference work (https://bugs.webkit.org/show_bug.cgi?id=148610).
+
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::dump):
+ * runtime/Structure.h:
+
2015-09-10 Yusuke Suzuki <[email protected]>
Unreviewed, fix Windows file loading in JSC shell after r189583
Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (189595 => 189596)
--- trunk/Source/_javascript_Core/runtime/Structure.cpp 2015-09-10 22:59:08 UTC (rev 189595)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp 2015-09-10 23:07:08 UTC (rev 189596)
@@ -208,6 +208,7 @@
setStaticFunctionsReified(false);
setHasRareData(false);
setTransitionWatchpointIsLikelyToBeFired(false);
+ setHasBeenDictionary(false);
ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
@@ -239,6 +240,7 @@
setStaticFunctionsReified(false);
setHasRareData(false);
setTransitionWatchpointIsLikelyToBeFired(false);
+ setHasBeenDictionary(false);
TypeInfo typeInfo = TypeInfo(CellType, StructureFlags);
m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), 0, typeInfo);
@@ -268,6 +270,7 @@
setDidTransition(true);
setStaticFunctionsReified(previous->staticFunctionsReified());
setHasRareData(false);
+ setHasBeenDictionary(previous->hasBeenDictionary());
TypeInfo typeInfo = previous->typeInfo();
m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), previous->indexingTypeIncludingHistory(), typeInfo);
@@ -537,7 +540,7 @@
transition->m_offset = structure->m_offset;
transition->setDictionaryKind(kind);
transition->pin();
- transition->setTransitionWatchpointIsLikelyToBeFired(true);
+ transition->setHasBeenDictionary(true);
transition->checkOffsetConsistency();
return transition;
@@ -1156,6 +1159,8 @@
switch (dictionaryKind()) {
case NoneDictionaryKind:
+ if (hasBeenDictionary())
+ out.print(", Has been dictionary");
break;
case CachedDictionaryKind:
out.print(", Dictionary");
@@ -1164,6 +1169,11 @@
out.print(", UncacheableDictionary");
break;
}
+
+ if (transitionWatchpointSetIsStillValid())
+ out.print(", Leaf");
+ else if (transitionWatchpointIsLikelyToBeFired())
+ out.print(", Shady leaf");
out.print("]");
}
Modified: trunk/Source/_javascript_Core/runtime/Structure.h (189595 => 189596)
--- trunk/Source/_javascript_Core/runtime/Structure.h 2015-09-10 22:59:08 UTC (rev 189595)
+++ trunk/Source/_javascript_Core/runtime/Structure.h 2015-09-10 23:07:08 UTC (rev 189596)
@@ -429,9 +429,13 @@
// - We don't watch Structures that either decided not to be watched, or whose predecessors
// decided not to be watched. This happens either when a transition is fired while being
- // watched, or if a dictionary transition occurs.
+ // watched.
if (transitionWatchpointIsLikelyToBeFired())
return false;
+
+ // - Don't watch Structures that had been dictionaries.
+ if (hasBeenDictionary())
+ return false;
return true;
}
@@ -523,6 +527,7 @@
DEFINE_BITFIELD(bool, hasCustomGetterSetterProperties, HasCustomGetterSetterProperties, 1, 25);
DEFINE_BITFIELD(bool, didWatchInternalProperties, DidWatchInternalProperties, 1, 26);
DEFINE_BITFIELD(bool, transitionWatchpointIsLikelyToBeFired, TransitionWatchpointIsLikelyToBeFired, 1, 27);
+ DEFINE_BITFIELD(bool, hasBeenDictionary, HasBeenDictionary, 1, 28);
private:
friend class LLIntOffsetsExtractor;