diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-24 13:54:09 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-24 13:58:47 (GMT) |
commit | 9e8b3f2e789e24c561d2f583927ee15b38808941 (patch) | |
tree | d6f0d5334f533bfc93e6415459cc7462da12eb7a /src/script/api/qscriptengine_p.h | |
parent | 2c21acaee645590f907672b6cfc4d84597444418 (diff) | |
download | Qt-9e8b3f2e789e24c561d2f583927ee15b38808941.zip Qt-9e8b3f2e789e24c561d2f583927ee15b38808941.tar.gz Qt-9e8b3f2e789e24c561d2f583927ee15b38808941.tar.bz2 |
handle memory management of QScriptValuePrivate in engine if possible
Avoid calling malloc() and free() so often. The premise is that
QScriptValue is usually a short-lived type, and only a few QScriptValues
exist at a time, so if we cache privates in the engine, QScriptValues
will be much faster to create and destroy.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r-- | src/script/api/qscriptengine_p.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index eb660e2..1142fcb 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -210,6 +210,9 @@ public: bool scriptDisconnect(JSC::JSValue signal, JSC::JSValue receiver, JSC::JSValue function); + QScriptValuePrivate *allocateScriptValuePrivate(size_t); + void freeScriptValuePrivate(QScriptValuePrivate *p); + void registerScriptValue(QScriptValuePrivate *value); void unregisterScriptValue(QScriptValuePrivate *value); void detachAllRegisteredScriptValues(); @@ -237,6 +240,7 @@ public: QScriptEngineAgent *activeAgent; int agentLineNumber; QScriptValuePrivate *registeredScriptValues; + QScriptValuePrivate *freeScriptValues; QHash<int, QScriptTypeInfo*> m_typeInfos; int processEventsInterval; QScriptValue abortResult; |