summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
Commit message (Collapse)AuthorAgeFilesLines
* Lazily construct the QScriptActivationObjectOlivier Goffart2009-08-131-4/+1
| | | | | | | | | | | We can store flags on the ReturnValueRegister entry in the stackframe header (as native function don't use that) Then when requesting an activation object we can lookup the flags to know if we should create it. This reduce a lot the cost of a native call. Reviewed-by: Kent Hansen
* Push frames when needed for native getter or settersOlivier Goffart2009-08-121-2/+6
| | | | | This is some other places where Qt native function may expect to have their own context
* Cantralize the place when we construct the default 'this' object that JSC ↵Olivier Goffart2009-08-122-27/+3
| | | | | | | | doesn't construct. Removes code duplication. This also indirrectly fixes the QMetaObjectWrapperObject where this was missing
* Refactor the way the JS stack are created for native functionOlivier Goffart2009-08-123-30/+66
| | | | | | | | | | 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
* Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Kent Hansen2009-08-124-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtscript-jsc-backend Conflicts: configure src/script/qscriptarray_p.h src/script/qscriptasm.cpp src/script/qscriptasm_p.h src/script/qscriptbuffer_p.h src/script/qscriptclass.cpp src/script/qscriptclassdata.cpp src/script/qscriptclassdata_p.h src/script/qscriptclassinfo_p.h src/script/qscriptclasspropertyiterator_p.h src/script/qscriptcompiler.cpp src/script/qscriptcompiler_p.h src/script/qscriptcontext_p.cpp src/script/qscriptcontext_p.h src/script/qscriptcontextfwd_p.h src/script/qscriptcontextinfo_p.h src/script/qscriptecmaarray.cpp src/script/qscriptecmaarray_p.h src/script/qscriptecmaboolean.cpp src/script/qscriptecmaboolean_p.h src/script/qscriptecmacore.cpp src/script/qscriptecmacore_p.h src/script/qscriptecmadate.cpp src/script/qscriptecmadate_p.h src/script/qscriptecmaerror.cpp src/script/qscriptecmaerror_p.h src/script/qscriptecmafunction.cpp src/script/qscriptecmafunction_p.h src/script/qscriptecmaglobal.cpp src/script/qscriptecmaglobal_p.h src/script/qscriptecmamath.cpp src/script/qscriptecmamath_p.h src/script/qscriptecmanumber.cpp src/script/qscriptecmanumber_p.h src/script/qscriptecmaobject.cpp src/script/qscriptecmaobject_p.h src/script/qscriptecmaregexp.cpp src/script/qscriptecmaregexp_p.h src/script/qscriptecmastring.cpp src/script/qscriptecmastring_p.h src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptengine_p.h src/script/qscriptengineagent_p.h src/script/qscriptenginefwd_p.h src/script/qscriptextenumeration.cpp src/script/qscriptextenumeration_p.h src/script/qscriptextqobject.cpp src/script/qscriptextqobject_p.h src/script/qscriptextvariant.cpp src/script/qscriptextvariant_p.h src/script/qscriptfunction.cpp src/script/qscriptfunction_p.h src/script/qscriptgc_p.h src/script/qscriptglobals_p.h src/script/qscriptmember_p.h src/script/qscriptnameid_p.h src/script/qscriptnodepool_p.h src/script/qscriptobject_p.h src/script/qscriptobjectfwd_p.h src/script/qscriptprettypretty.cpp src/script/qscriptprettypretty_p.h src/script/qscriptsyntaxcheckresult_p.h src/script/qscriptvalue.cpp src/script/qscriptvalue_p.h src/script/qscriptvaluefwd_p.h src/script/qscriptvalueimpl.cpp src/script/qscriptvalueimpl_p.h src/script/qscriptvalueimplfwd_p.h src/script/qscriptvalueiteratorimpl.cpp src/script/qscriptvalueiteratorimpl_p.h
* Call to JSC::Debugger's new events that where created inJedrzej Nowacki2009-08-111-0/+11
| | | | | | | | | | b62ab93d001d2f3238e24faa133720cb877e3023 commit. Workaround for multiple decorators problem. FunctionWrapper and NativeConstrWrapper needs access to original result value (from native function call). Solution was to move part of the NativeConstrWrapper's functionality (functionExit debugger's event) to FunctionWrapper::proxyConstruct.
* implement QScriptClass property query semantics of old back-endKent Hansen2009-08-101-1/+6
| | | | | Look up the property as a normal JS property before falling back to the dynamic query mechanism. This is the documented behavior.
* add configure options for (not) building the QtScript moduleKent Hansen2009-08-0714-56/+0
| | | | | | | | | | | | | | | | | | -script (default) and -no-script. This means we can get rid of the SCRIPT feature from qfeatures, since it's now handled by the new configure variable. It also allows us to get rid of all the QT_NO_SCRIPT ifdefs from the source files, since qmake isn't going to include those files for compilation when you configure with -no-script. The QtScriptTools module will be disabled if the QtScript module is not built. You'll have to build the old QtScript back-end (will be made available in a separate package), then build the QtScriptTools module yourself. Reviewed-by: Simon Hausmann
* fix regression in enumeration of QPropertiesKent Hansen2009-08-061-1/+1
|
* port commit 47c9e7b1b3551ff6dbe71590461a45ae398a9501 from qt/masterKent Hansen2009-08-062-6/+10
|
* finish implementation of QVariant.prototype.toString()Kent Hansen2009-08-061-16/+24
| | | | Behave like the old back-end.
* make iteration work for the global object againKent Hansen2009-08-062-6/+8
| | | | Follow-up to commit 520378cfedd63544a9689687256d2c89352ee561
* Updates getPropertyNames() on all javascript object to use the flagBenjamin Poulain2009-08-056-17/+17
| | | | | | | | getPropertyNames() now uses a flag to specify which property should be filtered. This flag should be used by all javascript objects. This patch fixes the changes introduced by e520df1f8678bd59adb341fb586f008a7de17fe8
* make QScriptEngine::newQMetaObject() workKent Hansen2009-08-052-64/+106
|
* add type info and attribute getters for function wrappersKent Hansen2009-08-052-0/+17
|
* don't store QScriptEngine pointer in native function wrappersKent Hansen2009-08-052-26/+28
| | | | | We can infer it from the JSC environment when the function is actually called.
* remove unused codeOlivier Goffart2009-08-041-1/+0
|
* move Global Object to its own fileKent Hansen2009-08-043-0/+266
|
* adapt to commit 014c4c63066fd3920594e6a58b02f314b5c88cdfKent Hansen2009-08-046-16/+26
|
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-313-11/+0
|
* Small Refactoring of QScriptOlivier Goffart2009-07-314-52/+26
| | | | | | | | | - Create a scope (activation object) for the native constructor in QScriptClass - put the isCalledasConstructor in the activation object (so i can clean up the QScriptContext - Remove the code duplication in all native functions. Aknoweldged-by: Kent
* QScriptValueIterator: fix missing non-enumerable valuesTor Arne Vestbø2009-07-316-17/+23
| | | | | | | | | | Added an extra argument to JSObject::getPropertyNames() that specifies if the non-enumerable properties (those with the DontEnum attribute set) should be included or not. Tried looking at using a unsigned as an attribute-inclusion or exclusion filter, but the semantics of either the calling or the callee code would be very strange so I opted out.
* Add missing fileOlivier Goffart2009-07-301-0/+88
|
* Move QScriptActivationObject to his own fileOlivier Goffart2009-07-303-37/+100
|
* set calledAsConstructor to true when function is called as constructorKent Hansen2009-07-292-0/+5
|
* Fix license headersOlivier Goffart2009-07-2910-44/+344
|
* Enter a scope when enterning a native function.Olivier Goffart2009-07-291-1/+68
| | | | | | | | | | | | | | so native function that would call engine->evaluate("var b = 'foo'); would not change the global object. The change in qscriptengine.cpp makes sure that the correct scope is used for the execution of QScriptEngine::evaluate. The changes in qscriptfunction.cpp push a new scope for native function calls. We might want to move that into QScriptContext later Reviewed-by: Kent Hansen
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-272-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | JSC requires that the global object is actually a JSGlobalObject instance, whereas QScriptEngine::setGlobalObject() allows any object to be set as the global object. The way we solve this is by proxying from an internal global object to the custom (user-set) object. We need to take care that the internal global object is never actually exposed through our API; a brilliantly named helper function, toUsableValue(), makes that happen. Evaluating "var a = 10" with a custom global object doesn't work yet; the variable always ends up in the internal Global Object. For variable assignments, JSC appears to bypass the normal JSObject::put() and instead use JSGlobalObject::copyGlobals{From,To}(), which means I can't intercept and proxy the assignments. This commit enough to get the Context2D example working. There's another bug with iteration of the built-in Global Object's properties (non-enumerable properties are always skipped by the JSC C++ API, whereas with QScriptValueIterator they should not be), but that's a totally separate issue.
* use engine's globalObject() instead of exec's lexicalGlobalObject()Kent Hansen2009-07-271-7/+7
|
* don't rely on custom global object to get GC callbackKent Hansen2009-07-271-2/+2
| | | | | | | | | | | Install custom ClientData on JSGlobalData instance instead. Also some cleanups to avoid globalObject et al being accessed directly. Killed the proxying scheme employed in setGlobalObject() since it didn't work; if you stored the original Global Object and replaced it with another object, then added properties to the new object, they would show up in the old object, too (because the old object would always proxy to whatever the current Global Object was).
* Remove the uncaughtException, use the JSC exception insteadBenjamin Poulain2009-07-271-3/+1
| | | | | | | | | Use the exception from JSC::exec instead of QScriptEngin::uncaughtException. A few more tests are passing for qscriptvalue and qscriptqobject. Reviewed-by: Kent Hansen
* Fix tst_QScriptExtQObject::objectDeleted()Benjamin Poulain2009-07-271-1/+2
| | | | | | | | Fix tst_QScriptExtQObject::objectDeleted(), the exception generated in the JSC script engine needs to be stored in uncaughtException of QScriptEngine. Reviewed-by: Kent Hansen
* introduce scriptEngineFromExec() helper functionKent Hansen2009-07-272-18/+20
| | | | | No need to expose the fact that we go via the Global Object to get an engine pointer.
* Implement qobjectProtoFuncFindChildren()Benjamin Poulain2009-07-221-1/+50
| | | | | | | | For matching the regular expression, the algorithm of JSCore is used instead of QRegExp, this is done to be consistent with the rest of ecmascript. Reviewed-by: Kent Hansen
* We cant rely on property attributes from JavaScriptCore for the setter and ↵Olivier Goffart2009-07-162-12/+0
| | | | getter
* start implementing constructors for QMetaObject wrappersKent Hansen2009-07-162-4/+110
|
* fix enumeration of QObject wrapper objectsKent Hansen2009-07-161-3/+1
| | | | | Don't add method names, only signatures. Respect the SkipMethodsInEnumeration option.
* fix some memory leaksKent Hansen2009-07-151-0/+1
|
* initial attempt at implementing QScriptEngine::setGlobalObject()Kent Hansen2009-07-151-4/+4
| | | | | Doesn't actually replace the global object, but rather has the standard global object act as a proxy to the custom one.
* store error and return true when throwing in getOwnProperty()Kent Hansen2009-07-151-2/+2
|
* implement QObject prototype objectKent Hansen2009-07-152-1/+13
|
* implement AutoCreateDynamicProperties optionKent Hansen2009-07-151-7/+7
|
* implement enumeration of custom script classesKent Hansen2009-07-151-1/+14
|
* implement QObject wrapper caching (PreferExistingWrapperObject)Kent Hansen2009-07-152-1/+48
|
* clear script exceptions when executing Qt methodsKent Hansen2009-07-151-0/+2
| | | | | | | The argument conversion logic checks for exceptions after attempting to convert each argument; this requires that there is initially no exception, otherwise it's going to bail out even if the conversion itself succeeded.
* add GC marking guardsKent Hansen2009-07-132-8/+19
| | | | | Caller is responsible for calling marked() before mark(), otherwise you might get infinite recursion.
* mark object data if we have itKent Hansen2009-07-131-0/+2
|
* implement ability to dynamically change class of script objectsKent Hansen2009-07-109-117/+800
| | | | | | | | | | | | | | | | | | | | | | | | | | With an object created by QScriptEngine::newObject(), it should be possible to call QScriptValue::setClass() to dynamically change the behavior of that object. Similarly, it should be possible to promote plain script objects to QObject (QVariant) wrappers by calling the overload of QScriptEngine::newQObject() (newVariant()) that takes a script object as the first argument. This commit implements this capability. The premise is the (internal) QScriptObject class, which inherits JSC::JSObject. It reimplements all the methods for getting/setting properties etc. Then there's a level of indirection to facilitate dynamic change of the class: Each QScriptObject can have a delegate associated with it that will handle operations on the object. By default there is no delegate, so the object behaves as a normal JS object, as you expect. However, once a delegate is set (e.g., when QScriptValue::setScriptClass() is called), QScriptObject will give the delegate the chance to handle the object operation. In addition to a delegate implementation for QScriptClass-based objects, there are also delegates for QObject and QVariant wrappers. These replace the QObjectWrapperObject and QVariantWrapperObject classes.
* QObject.prototype.toString: return undefined if this-object is not a QObjectKent Hansen2009-07-091-1/+1
| | | | Follow behavior of old back-end. Makes qscriptable test pass.
* invoke signal handler using JSC::call()Kent Hansen2009-07-091-8/+6
| | | | | Makes sure that new stack frame is set up if the function is native, and all that.