summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptqobject.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-11 11:53:04 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-12 13:15:23 (GMT)
commit45e2a19b4b75fe94a78161f26862bf3c6f727d74 (patch)
treea6e698eee514ad28815519f3b2ba5ac592941de3 /src/script/bridge/qscriptqobject.cpp
parente806a4e887b6584f1115ced3cb489bb0e9a2de36 (diff)
downloadQt-45e2a19b4b75fe94a78161f26862bf3c6f727d74.zip
Qt-45e2a19b4b75fe94a78161f26862bf3c6f727d74.tar.gz
Qt-45e2a19b4b75fe94a78161f26862bf3c6f727d74.tar.bz2
Refactor the way the JS stack are created for native function
The original JavaScriptCore doesn't create stack frame or scope for native function. JSC has been patched to support that. This commit revert our patches to JSC, and implement create the stack frame from QScript Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/bridge/qscriptqobject.cpp')
-rw-r--r--src/script/bridge/qscriptqobject.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 69ae205..a15e632 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1837,8 +1837,9 @@ JSC::JSValue JSC_HOST_CALL QMetaObjectWrapperObject::call(
return throwError(exec, JSC::TypeError, "callee is not a QMetaObject");
QMetaObjectWrapperObject *self = static_cast<QMetaObjectWrapperObject*>(callee);
JSC::ExecState *previousFrame = eng_p->currentFrame;
- eng_p->currentFrame = exec;
- JSC::JSValue result = self->execute(exec, args, /*calledAsConstructor=*/false);
+ eng_p->pushContext(exec, thisValue, args, callee);
+ JSC::JSValue result = self->execute(eng_p->currentFrame, args, /*calledAsConstructor=*/false);
+ eng_p->popContext();
eng_p->currentFrame = previousFrame;
return result;
}
@@ -1848,8 +1849,9 @@ JSC::JSObject* QMetaObjectWrapperObject::construct(JSC::ExecState *exec, JSC::JS
QMetaObjectWrapperObject *self = static_cast<QMetaObjectWrapperObject*>(callee);
QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec);
JSC::ExecState *previousFrame = eng_p->currentFrame;
- eng_p->currentFrame = exec;
- JSC::JSValue result = self->execute(exec, args, /*calledAsConstructor=*/true);
+ eng_p->pushContext(exec, JSC::JSValue(), args, callee, true);
+ JSC::JSValue result = self->execute(eng_p->currentFrame, args, /*calledAsConstructor=*/true);
+ eng_p->popContext();
eng_p->currentFrame = previousFrame;
if (!result || !result.isObject())
return 0;
@@ -1863,7 +1865,6 @@ JSC::JSValue QMetaObjectWrapperObject::execute(JSC::ExecState *exec,
if (data->ctor) {
QScriptEnginePrivate *eng_p = QScript::scriptEngineFromExec(exec);
QScriptContext *ctx = eng_p->contextForFrame(exec);
- QScriptPushScopeHelper scope(exec, calledAsConstructor);
JSC::CallData callData;
JSC::CallType callType = data->ctor.getCallData(callData);
Q_ASSERT_X(callType == JSC::CallTypeHost, Q_FUNC_INFO, "script constructors not supported");