summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-04-14 16:22:35 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-04-14 16:32:34 (GMT)
commita3d6d4db2c12123873b809a9605b3ab50c740294 (patch)
tree8db9358f87a202cf8ca6a28d947b66b001952222 /src/script
parenta0b027c9e29cdc75ffe857e19e9892e88bde722e (diff)
downloadQt-a3d6d4db2c12123873b809a9605b3ab50c740294.zip
Qt-a3d6d4db2c12123873b809a9605b3ab50c740294.tar.gz
Qt-a3d6d4db2c12123873b809a9605b3ab50c740294.tar.bz2
QtScript: Fix call stack issue with qsTr() when JIT is enabled
When the JIT is enabled, as well as JIT_OPTIMIZE_NATIVE_CALL defined, NativeFunctionWrapper is a typedef for JSFunction. This has the consequence that the native call frame will not be fully initialized by JIT-generated code (because it shouldn't have to); in particular, ExecState::codeBlock() is not set up. qsTr() relies on codeBlock() to return a sensible value, though, so it breaks this contract. By making qsTr a PrototypeFunction, the JIT will detect that the function call needs more elaborate setup, i.e. initialize codeBlock() as well. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 9bd98f1..9ce0f7d 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2939,7 +2939,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::NativeFunctionWrapper(exec, glob->prototypeFunctionStructure(), 3, JSC::Identifier(exec, "qsTr"), QScript::functionQsTr));
+ 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(), 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));