summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-04-16 08:06:39 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-04-19 17:01:22 (GMT)
commit2649b5f4695680b584decf75af11dc82325cc03f (patch)
tree18f82b5ea53bcd39aefd0e9b5bdc320f97e30f82 /src/script/api/qscriptengine.cpp
parent0fd81e81a357edb9f9e615cff28a1876bd363b2e (diff)
downloadQt-2649b5f4695680b584decf75af11dc82325cc03f.zip
Qt-2649b5f4695680b584decf75af11dc82325cc03f.tar.gz
Qt-2649b5f4695680b584decf75af11dc82325cc03f.tar.bz2
QScript: use JSC::NativeFunctionWrapper instead of JSC::PrototypeFunction when possible
JSC::NativeFunctionWrapper is a typedef to either JSC::PrototypeFunction or JSC::JSFunction depending if we are running JIT or not. When using JIT, JSC::JSFunction is faster, as it allow JIT to do the native call dirrectly. The difference is that in that case, the JS stack is not fully set up so we have to be carefull. Unfortunately, it is not possible to make FunctionWrapper inherit from JSC::NativeFunctionWrapper, because JSFunction is slightly bigger, and we cannot fit in a Cell Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r--src/script/api/qscriptengine.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 0b8a2e4..03d535c 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -796,7 +796,7 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS
JSC::UString context;
// The first non-empty source URL in the call stack determines the translation context.
{
- JSC::ExecState *frame = exec->removeHostCallFrameFlag();
+ JSC::ExecState *frame = exec->callerFrame()->removeHostCallFrameFlag();
while (frame) {
if (frame->codeBlock() && frame->codeBlock()->source()
&& !frame->codeBlock()->source()->url().isEmpty()) {
@@ -3404,7 +3404,7 @@ void QScriptEngine::installTranslatorFunctions(const QScriptValue &object)
// unsigned attribs = JSC::DontEnum;
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 5, JSC::Identifier(exec, "qsTranslate"), QScript::functionQsTranslate));
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 2, JSC::Identifier(exec, "QT_TRANSLATE_NOOP"), QScript::functionQsTranslateNoOp));
- JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::PrototypeFunction(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
+ JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
JSC::asObject(jscObject)->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "QT_TR_NOOP"), QScript::functionQsTrNoOp));
glob->stringPrototype()->putDirectFunction(exec, new (exec)JSC::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 1, JSC::Identifier(exec, "arg"), QScript::stringProtoFuncArg));