summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-07 10:56:50 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-10-07 16:16:07 (GMT)
commit2dd5facac01df4a90fbf9b7ce666704fddaf9e4f (patch)
tree6e23b75546b991d9433714d7ba439ed50df592b0 /src/script/api/qscriptengine_p.h
parentdf5cdc6d9a22ae11d607e9359a3bb9a80596fdb6 (diff)
downloadQt-2dd5facac01df4a90fbf9b7ce666704fddaf9e4f.zip
Qt-2dd5facac01df4a90fbf9b7ce666704fddaf9e4f.tar.gz
Qt-2dd5facac01df4a90fbf9b7ce666704fddaf9e4f.tar.bz2
Inline QScriptValuePrivate operator new and delete
Make allocation faster.
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r--src/script/api/qscriptengine_p.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 5f31054..f1fc135 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -468,6 +468,22 @@ inline QScriptValue QScriptValuePrivate::property(const QString &name, int resol
return property(JSC::Identifier(exec, name), resolveMode);
}
+inline void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine)
+{
+ if (engine)
+ return engine->allocateScriptValuePrivate(size);
+ return qMalloc(size);
+}
+
+inline void QScriptValuePrivate::operator delete(void *ptr)
+{
+ QScriptValuePrivate *d = reinterpret_cast<QScriptValuePrivate*>(ptr);
+ if (d->engine)
+ d->engine->freeScriptValuePrivate(d);
+ else
+ qFree(d);
+}
+
inline void QScriptEnginePrivate::registerScriptString(QScriptStringPrivate *value)
{
Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated);