summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/Structure.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Source/JavaScriptCore/runtime/Structure.cpp
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/runtime/Structure.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/Structure.cpp69
1 files changed, 48 insertions, 21 deletions
diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp
index e733c7e23..9ffe3b060 100644
--- a/Source/JavaScriptCore/runtime/Structure.cpp
+++ b/Source/JavaScriptCore/runtime/Structure.cpp
@@ -135,17 +135,17 @@ void Structure::dumpStatistics()
}
}
- dataLog("Number of live Structures: %d\n", liveStructureSet.size());
- dataLog("Number of Structures using the single item optimization for transition map: %d\n", numberUsingSingleSlot);
- dataLog("Number of Structures that are leaf nodes: %d\n", numberLeaf);
- dataLog("Number of Structures that singletons: %d\n", numberSingletons);
- dataLog("Number of Structures with PropertyMaps: %d\n", numberWithPropertyMaps);
-
- dataLog("Size of a single Structures: %d\n", static_cast<unsigned>(sizeof(Structure)));
- dataLog("Size of sum of all property maps: %d\n", totalPropertyMapsSize);
- dataLog("Size of average of all property maps: %f\n", static_cast<double>(totalPropertyMapsSize) / static_cast<double>(liveStructureSet.size()));
+ dataLogF("Number of live Structures: %d\n", liveStructureSet.size());
+ dataLogF("Number of Structures using the single item optimization for transition map: %d\n", numberUsingSingleSlot);
+ dataLogF("Number of Structures that are leaf nodes: %d\n", numberLeaf);
+ dataLogF("Number of Structures that singletons: %d\n", numberSingletons);
+ dataLogF("Number of Structures with PropertyMaps: %d\n", numberWithPropertyMaps);
+
+ dataLogF("Size of a single Structures: %d\n", static_cast<unsigned>(sizeof(Structure)));
+ dataLogF("Size of sum of all property maps: %d\n", totalPropertyMapsSize);
+ dataLogF("Size of average of all property maps: %f\n", static_cast<double>(totalPropertyMapsSize) / static_cast<double>(liveStructureSet.size()));
#else
- dataLog("Dumping Structure statistics is not enabled.\n");
+ dataLogF("Dumping Structure statistics is not enabled.\n");
#endif
}
@@ -543,12 +543,13 @@ Structure* Structure::nonPropertyTransition(JSGlobalData& globalData, Structure*
unsigned attributes = toAttributes(transitionKind);
IndexingType indexingType = newIndexingType(structure->indexingTypeIncludingHistory(), transitionKind);
- JSGlobalObject* globalObject = structure->globalObject();
- if (structure == globalObject->arrayStructure()) {
- Structure* transition = globalObject->arrayStructureWithArrayStorage();
- if (transition->indexingTypeIncludingHistory() == indexingType) {
- structure->notifyTransitionFromThisStructure();
- return transition;
+ if (JSGlobalObject* globalObject = structure->m_globalObject.get()) {
+ if (globalObject->isOriginalArrayStructure(structure)) {
+ Structure* result = globalObject->originalArrayStructureForIndexingType(indexingType);
+ if (result->indexingTypeIncludingHistory() == indexingType) {
+ structure->notifyTransitionFromThisStructure();
+ return result;
+ }
}
}
@@ -694,11 +695,11 @@ static PropertyMapStatisticsExitLogger logger;
PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger()
{
- dataLog("\nJSC::PropertyMap statistics\n\n");
- dataLog("%d probes\n", numProbes);
- dataLog("%d collisions (%.1f%%)\n", numCollisions, 100.0 * numCollisions / numProbes);
- dataLog("%d rehashes\n", numRehashes);
- dataLog("%d removes\n", numRemoves);
+ dataLogF("\nJSC::PropertyMap statistics\n\n");
+ dataLogF("%d probes\n", numProbes);
+ dataLogF("%d collisions (%.1f%%)\n", numCollisions, 100.0 * numCollisions / numProbes);
+ dataLogF("%d rehashes\n", numRehashes);
+ dataLogF("%d removes\n", numRemoves);
}
#endif
@@ -861,6 +862,32 @@ void Structure::visitChildren(JSCell* cell, SlotVisitor& visitor)
visitor.append(&thisObject->m_objectToStringValue);
}
+bool Structure::prototypeChainMayInterceptStoreTo(JSGlobalData& globalData, PropertyName propertyName)
+{
+ unsigned i = propertyName.asIndex();
+ if (i != PropertyName::NotAnIndex)
+ return anyObjectInChainMayInterceptIndexedAccesses();
+
+ for (Structure* current = this; ;) {
+ JSValue prototype = current->storedPrototype();
+ if (prototype.isNull())
+ return false;
+
+ current = prototype.asCell()->structure();
+
+ unsigned attributes;
+ JSCell* specificValue;
+ PropertyOffset offset = current->get(globalData, propertyName, attributes, specificValue);
+ if (!JSC::isValidOffset(offset))
+ continue;
+
+ if (attributes & (ReadOnly | Accessor))
+ return true;
+
+ return false;
+ }
+}
+
#if DO_PROPERTYMAP_CONSTENCY_CHECK
void PropertyTable::checkConsistency()