aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4internalclass.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-05-16 15:29:17 +0200
committerLars Knoll <lars.knoll@qt.io>2017-05-19 06:23:42 +0000
commit32a1d14a3a1dead69dd1306adf70eefd3415639e (patch)
treeb3d2a39941603c812be5bb0294204321c3117760 /src/qml/jsruntime/qv4internalclass.cpp
parent8bb01e03e018de7e040b3224c6cdaf43d86051e5 (diff)
Optimize marking of prototypes in the InternalClass tree
There's no need to iterate over all internal classes, as prototype changes always happen in the first or second level of the tree. Change-Id: I99bf11a6cd238286c1547922d61ab47319b6eb97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass.cpp')
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index 9f43871f27..0bcd510541 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -506,25 +506,25 @@ void InternalClass::destroy()
}
}
-void InternalClass::mark(ExecutionEngine *e)
-{
- if (m_sealed)
- m_sealed->mark(e);
- if (m_frozen)
- m_frozen->mark(e);
-
- for (size_t i = 0; i < transitions.size(); ++i) {
- Q_ASSERT(transitions.at(i).lookup);
- transitions.at(i).lookup->mark(e);
- }
- if (prototype)
- prototype->mark(engine);
-}
-
void InternalClassPool::markObjects(ExecutionEngine *engine)
{
InternalClass *ic = engine->internalClasses[EngineBase::Class_Empty];
- ic->mark(engine);
+ Q_ASSERT(!ic->prototype);
+
+ // only need to go two levels into the IC hierarchy, as prototype changes
+ // can only happen there
+ for (auto &t : ic->transitions) {
+ Q_ASSERT(t.lookup);
+ if (t.flags == InternalClassTransition::VTableChange) {
+ InternalClass *ic2 = t.lookup;
+ for (auto &t2 : ic2->transitions) {
+ if (t2.flags == InternalClassTransition::PrototypeChange)
+ t2.lookup->prototype->mark(engine);
+ }
+ } else if (t.flags == InternalClassTransition::PrototypeChange) {
+ t.lookup->prototype->mark(engine);
+ }
+ }
}
QT_END_NAMESPACE