summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-09-02 16:14:01 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-09-02 16:17:13 (GMT)
commite4dfcd4392e5be1b5de8648fc20ff45f7faa30ca (patch)
tree8e1fbb0779b150d556b8d2807271c17090989cb6 /src/script/bridge
parent03274e0f539086cbf58d3fbd8e7e126a0cc16433 (diff)
downloadQt-e4dfcd4392e5be1b5de8648fc20ff45f7faa30ca.zip
Qt-e4dfcd4392e5be1b5de8648fc20ff45f7faa30ca.tar.gz
Qt-e4dfcd4392e5be1b5de8648fc20ff45f7faa30ca.tar.bz2
improve memory management scheme of QScriptString(Private)
Get rid of QPointer. Use linked list of privates (like was recently done for QScriptValue). Allocate the private on the stack when we can. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptclassobject.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index fcd0124..5dea491 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -97,7 +97,9 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object,
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);
@@ -115,7 +117,9 @@ void ClassObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec,
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesWriteAccess, &id);
@@ -133,7 +137,9 @@ bool ClassObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState *
// ### avoid duplication of put()
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesWriteAccess, &id);
@@ -152,7 +158,9 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
- QScriptString scriptName = engine->scriptStringFromJSCIdentifier(propertyName);
+ QScriptString scriptName;
+ QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
+ QScriptStringPrivate::init(scriptName, &scriptName_d);
uint id = 0;
QScriptClass::QueryFlags flags = m_scriptClass->queryProperty(
scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id);