summaryrefslogtreecommitdiffstats
path: root/src/script/api
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-28 09:14:05 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-28 10:05:11 (GMT)
commit2d5a70e25c1ea140cb2c6faca4758af4f1d2a663 (patch)
tree9e851f5ea80fa66ca61aa573e1008b4169f6f12c /src/script/api
parent5fa9d11e31edb7aeed9012e4042a5b1a899554c7 (diff)
downloadQt-2d5a70e25c1ea140cb2c6faca4758af4f1d2a663.zip
Qt-2d5a70e25c1ea140cb2c6faca4758af4f1d2a663.tar.gz
Qt-2d5a70e25c1ea140cb2c6faca4758af4f1d2a663.tar.bz2
QScriptEngine: Remove one superflous stackframe for native call made by JIT
JIT does create stackframe while the interperer doesn't. So we would end up with one superflous stackframe Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/qscriptengine.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 596fd8f..29044a9 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2259,8 +2259,11 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV
if (calledAsConstructor)
flags |= CalledAsConstructorContext;
+ //build a frame
JSC::CallFrame *newCallFrame = exec;
- if (callee == 0 || !(exec->callee() == callee && exec->returnPC() != 0)) {
+ if (callee == 0 //called from public QScriptEngine::pushContext
+ || exec->returnPC() == 0 || (contextFlags(exec) & NativeContext) //called from native-native call
+ || (exec->codeBlock() && exec->callee() != callee)) { //the interpreter did not build a frame for us.
//We need to check if the Interpreter might have already created a frame for function called from JS.
JSC::Interpreter *interp = exec->interpreter();
JSC::Register *oldEnd = interp->registerFile().end();
@@ -2278,6 +2281,9 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV
newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags, argc, callee);
} else {
setContextFlags(newCallFrame, flags);
+#if ENABLE(JIT)
+ exec->registers()[JSC::RegisterFile::Callee] = JSC::JSValue(callee); //JIT let the callee set the 'callee'
+#endif
if (calledAsConstructor) {
//update the new created this
JSC::Register* thisRegister = newCallFrame->registers() - JSC::RegisterFile::CallFrameHeaderSize - newCallFrame->argumentCount();