diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-13 09:19:48 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-13 09:25:57 (GMT) |
commit | 25e76959da84fe4c40f98cf32b7b8c69e5087681 (patch) | |
tree | 32093b3c9357c09e1a8efe49eb99bd388a602c26 /src/3rdparty/webkit/JavaScriptCore/interpreter | |
parent | a267b590d17d1e7088acf44a8ba7e307f898ccb1 (diff) | |
download | Qt-25e76959da84fe4c40f98cf32b7b8c69e5087681.zip Qt-25e76959da84fe4c40f98cf32b7b8c69e5087681.tar.gz Qt-25e76959da84fe4c40f98cf32b7b8c69e5087681.tar.bz2 |
add some world-class hacks to JSC to make QtScript work
QtScript needs the VM to create script objects of type
QScriptObject, not JSC::Object. This is so that the class of
the object can be changed dynamically using e.g.
QScriptValue::setScriptClass(), or the overload of
QScriptEngine::newQObject() that takes an existing object
as first argument (it "promotes" the plain script object to
a QObject wrapper).
This makes the bindings produced by the bindings generator
work.
When JSC becomes a shared library, we need another solution.
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/interpreter')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index d9c5cda..d006b53 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -69,6 +69,10 @@ #include "AssemblerBuffer.h" #endif +#ifdef QT_BUILD_SCRIPT_LIB +#include "bridge/qscriptobject_p.h" +#endif + using namespace std; namespace JSC { @@ -3468,8 +3472,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi structure = asObject(prototype)->inheritorID(); else structure = callDataScopeChain->globalObject()->emptyObjectStructure(); +#ifdef QT_BUILD_SCRIPT_LIB + // ### world-class hack + QScriptObject* newObject = new (globalData) QScriptObject(structure); +#else JSObject* newObject = new (globalData) JSObject(structure); - +#endif callFrame[thisRegister] = JSValue(newObject); // "this" value CallFrame* previousCallFrame = callFrame; @@ -3502,8 +3510,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi structure = asObject(prototype)->inheritorID(); else structure = scopeChain->globalObject()->emptyObjectStructure(); +#ifdef QT_BUILD_SCRIPT_LIB + // ### world-class hack + QScriptObject* newObject = new (globalData) QScriptObject(structure); +#else JSObject* newObject = new (globalData) JSObject(structure); - +#endif callFrame[thisRegister] = JSValue(newObject); // "this" value CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset); |