diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-13 08:39:28 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-13 13:24:12 (GMT) |
commit | 04ac768f2ac5e3800893370c13c261a075a723ff (patch) | |
tree | a14a6c9580cde04bb962c350b9667d4510e66972 /src/script/api/qscriptvalue.cpp | |
parent | 88c6dc6ec7f73de279703b30874b30511901854b (diff) | |
download | Qt-04ac768f2ac5e3800893370c13c261a075a723ff.zip Qt-04ac768f2ac5e3800893370c13c261a075a723ff.tar.gz Qt-04ac768f2ac5e3800893370c13c261a075a723ff.tar.bz2 |
Lazily construct the QScriptActivationObject
We can store flags on the ReturnValueRegister entry in the stackframe
header (as native function don't use that)
Then when requesting an activation object we can lookup the flags to
know if we should create it.
This reduce a lot the cost of a native call.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index b02802c..4558097 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2020,6 +2020,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, "a different engine"); return QScriptValue(); } + engine()->currentContext()->activationObject(); //force the creation of a context for native function; QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(d->engine); JSC::ExecState *exec = eng_p->currentFrame; @@ -2095,6 +2096,7 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject, "a different engine"); return QScriptValue(); } + engine()->currentContext()->activationObject(); //force the creation of a context for native function; QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(d->engine); JSC::ExecState *exec = eng_p->currentFrame; @@ -2161,6 +2163,7 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) Q_D(const QScriptValue); if (!isFunction()) return QScriptValue(); + engine()->currentContext()->activationObject(); //force the creation of a context for native function; QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(d->engine); JSC::ExecState *exec = eng_p->currentFrame; @@ -2172,6 +2175,7 @@ QScriptValue QScriptValue::construct(const QScriptValueList &args) else argsVector[i] = eng_p->scriptValueToJSCValue(args.at(i)); } + JSC::ArgList jscArgs(argsVector.data(), argsVector.size()); JSC::JSValue callee = d->jscValue; @@ -2208,6 +2212,7 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) Q_D(QScriptValue); if (!isFunction()) return QScriptValue(); + engine()->currentContext()->activationObject(); //force the creation of a context for native function; QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(d->engine); JSC::ExecState *exec = eng_p->currentFrame; |