From 6c8c604f11e7a6d5880e4f951255d496fe905797 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 10 Jan 2018 14:16:22 +0100 Subject: Reorganize Lookup data structure to make marking faster Do this by always using odd numbers for protoId's, and putting those into the same place as the InternalClass pointers. That makes it possible to quickly check whether the lookup contains a pointer to a valid heap object. Change-Id: I330017b26c090b4dcbbcce1a127dca7ba7e148d1 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4engine_p.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/qml/jsruntime/qv4engine_p.h') diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 737f377730..4316967484 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -374,7 +374,7 @@ public: const bool m_canAllocateExecutableMemory; #endif - int internalClassIdCount = 0; + quintptr protoIdCount = 1; ExecutionEngine(QJSEngine *jsEngine = nullptr); ~ExecutionEngine(); @@ -398,7 +398,8 @@ public: return static_cast(¤tStackFrame->jsFrame->context); } - int newInternalClassId() { return ++internalClassIdCount; } + // ensure we always get odd prototype IDs. This helps make marking in QV4::Lookup fast + quintptr newProtoId() { return (protoIdCount += 2); } Heap::InternalClass *newInternalClass(const VTable *vtable, Object *prototype); -- cgit v1.2.3