summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
Commit message (Collapse)AuthorAgeFilesLines
* Implement property versioning inside the declarative engineAaron Kennedy2011-01-272-0/+6
| | | | Task-number: QTBUG-13451
* Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11Martin Jones2011-01-1920-20/+20
|\
| * Update copyright year to 2011.Jason McDonald2011-01-1020-20/+20
| | | | | | | | Reviewed-by: Trust Me
* | Symbian compile fixKai Koehne2010-12-171-1/+1
| | | | | | | | | | | | | | | | armv5 complained that the call to QChar::category() was ambiguous, because there is a version taking an uint, and a version taking ushort as argument. Reviewed-by: Christiaan Janssen
* | Small optimization of enum detection in script.Michael Brasser2010-11-122-0/+9
|/ | | | Reviewed-by: Martin Jones
* Don't crash if QScriptClass property getter returns an invalid valueKent Hansen2010-11-081-0/+12
| | | | | | | | | | | | | It's possible that a class claims to have a property of a given name (i.e. queryProperty() returns true), but returns an invalid value for that property. In that case we should silently convert the value to undefined, otherwise the value may wreak havoc in JS. This is a regression from Qt 4.5 (pre-JavaScriptCore-based), which had this check. Task-number: QTBUG-15079 Reviewed-by: Jedrzej Nowacki
* Fix memory leak in QtScript variable objectKent Hansen2010-08-102-2/+2
| | | | | | | | | | | | | | | The d-pointer is of type JSVariableObjectData*, but JSVariableObjectData doesn't have a virtual destructor. Hence we must cast the d-pointer to our subclass when deleting. In particular, this will ensure that the destructor of the symbolTable member is called, which will deallocate the table storage. (For QScriptActivationObject this did not cause a leak in practice, because its symbolTable is always empty, and JSC's hash table uses lazy allocation.) Task-number: QTBUG-12479 Reviewed-by: Olivier Goffart
* QScriptDeclarativeObject: we need to save the current stack pointer.Olivier Goffart2010-07-271-2/+2
| | | | | | | in DeclarativeObjectDelegate::put, else we cannot get a proper backtrace in the debugger. Reviewed-by: Kent Hansen
* Use custom static scopes to improve QML/JavaScript performanceKent Hansen2010-06-255-0/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new internal JS object type, QScriptStaticScopeObject, that enables the JS compiler to make more aggressive optimizations of scoped property access. QScriptStaticScopeObject registers all its properties in a symbol table that the JS compiler has access to. If the compiler finds the property in the symbol table, it will generate the fast index-based op_{get,put}_scoped_var bytecodes, rather than the dynamic (slow) op_resolve and friends. If the compiler _doesn't_ find the property in the symbol table, it infers that it's safe to skip the scope object when later resolving the property, which will also improve performance (see op_resolve_skip bytecode). QScriptStaticScopeObject is only safe to use when all relevant properties are known at JS compile time; that is, when a function that has the static scope object in its scope chain is compiled. It's up to the user of the class (e.g. QtDeclarative) to ensure that this constraint is not violated. The API for constructing QScriptStaticScopeObject instances is not public; it lives in QScriptDeclarativeClass for now, an internal class exported for the purpose of QML. The instance is returned as a QScriptValue and can be manipulated like any other JS object (e.g. by QScriptValue::setProperty()). The other part of this commit utilizes QScriptStaticScopeObject in QtDeclarative in the two major places where it's currently possible: 1) QML disallows adding properties to the Global Object. Furthermore, it's not possible for QML IDs and properties to "shadow" global variables. Hence, a QScriptStaticScopeObject can be used to hold all the standard ECMA properties, and this scope object can come _before_ the QML component in the scope chain. This enables binding expressions and scripts to have optimized (direct) access to e.g. Math.sin. 2) Imported scripts can have their properties (resulting from variable declarations ("var" statements) and function declarations) added to a static scope object. This enables functions in the script to have optimized (direct) access to the script's own properties, as well as to global properties such as Math. With this change, it's no longer possible to delete properties of the Global Object, nor delete properties of an imported script. It's a compromise we make in order to make the optimization safe. Task-number: QTBUG-8576 Reviewed-by: Aaron Kennedy Reviewed-by: Olivier Goffart Reviewed-by: Jedrzej Nowacki
* Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration ↵Qt Continuous Integration System2010-04-221-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into 4.7-integration * 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (71 commits) Revert "Attempt at fixing compile failure introduced by 4.6 merge in qpaintengine_vg.cpp" Attempt at fixing compile failure introduced by 4.6 merge in qpaintengine_vg.cpp Fixing the wrong QUrl usage When on Symbian use smaller files. correctly position glyphs for complex languages Removed inneccessary QGlyphLayout::offsets initialization. Fix mirrored characters for RTL text in Symbian QNAM: Add a code comment related to the cache tst_QSystemSemaphore::processes fixed for WinCE tst_qsystemsemaphore: fix deployment of lackey.exe for WinCE tst_qsharedmemory: create multiple instances of lackey.exe on WinCE tst_qsharedmemory: fix deployment of lackey.exe for WinCE fix compilation of tst_sharedmemory on Windows CE QtScript: regression with instanceof operator for QMetaObject wrappers examples/widgets/stylesheet fix mainwindow.ui QStyleSheetStyle: fix memory leak on base style change QNAM HTTP: Fixed a bug when getting empty files with pipelining Fix window transparency on Symbian. Tweak the 'normalGeometry' of the widget before setting it. Use QDesktopWidget as a status pane observer on Symbian. ...
| * Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Thiago Macieira2010-04-211-1/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/openvg/qpaintengine_vg.cpp src/script/bridge/qscriptqobject_p.h tests/auto/bic/tst_bic.cpp
| | * QtScript: regression with instanceof operator for QMetaObject wrappersKent Hansen2010-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tell JavaScriptCore that QMetaObject wrappers can be used as the second operand to instanceof; this is done by setting the ImplementsHasInstance flag. We don't actually have to implement hasInstance() because the default implementation does the right thing. Task-number: QTBUG-8366 Reviewed-by: Olivier Goffart
* | | QScript: use JSC::NativeFunctionWrapper instead of JSC::PrototypeFunction ↵Olivier Goffart2010-04-192-6/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when possible JSC::NativeFunctionWrapper is a typedef to either JSC::PrototypeFunction or JSC::JSFunction depending if we are running JIT or not. When using JIT, JSC::JSFunction is faster, as it allow JIT to do the native call dirrectly. The difference is that in that case, the JS stack is not fully set up so we have to be carefull. Unfortunately, it is not possible to make FunctionWrapper inherit from JSC::NativeFunctionWrapper, because JSFunction is slightly bigger, and we cannot fit in a Cell Reviewed-by: Kent Hansen
* | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-03-301-4/+17
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (24 commits) qdoc: Added <div> elements to some html output for class references. Fix compile error on mingw. MONILITY-645 Do not override alternate background color in Plastique Fix QComboBox ignoring foreground role in some styles Fix compilation on HP-UXi: _SC_MONOTONIC_CLOCK isn't defined Fix compilation with Sun CC: Ensure that we return QPair<long,long> in all cases. Update PLATFORM(SPARC64) to CPU(SPARC64) jui files are no c++ ... scan some more file types by default Support EtchDisabledText with spin box on Windows style QNAM HTTP: Fix invoking a method when being destructed right now Fixed a typo in the QDoubleValidotor doc. Trivial fix to JavaScriptCore to fix building with MSVC 2010 Autotest: oops, fix oops: remove qguard from auto.pro Autotests: oops, remove last traces of QGuard Remove QGuard. Unskip test that used to crash QtScript: Add yet more missing API shims ...
| * | QtScript: Add yet more missing API shimsKent Hansen2010-03-261-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - for QScriptEngine and QScriptContext; we don't control what the JSC functions are doing, so it's better to have shims than not to have them (which can cause something to blow up), even if they might not be strictly necessary as of this writing. - for QScriptDeclarativeClass; otherwise the identifiers might be created/destroyed in the wrong engine. - for QScriptValueIterator destructor; otherwise the identifiers might be destroyed in the wrong engine. This is an attempt to fix a crash in Bauhaus, but it might still be crashing (i.e. still some shims missing, somewhere) ;(
* | | Correctly construct boolean JSValue'sAaron Kennedy2010-03-301-3/+9
|/ / | | | | | | Task-number: QTBUG-9205
* | QtScript: Add missing API shim for signal handlingKent Hansen2010-03-261-0/+1
| | | | | | | | | | | | The signal handling bypasses the public QScriptValue API (it calls JSC::call() directly), hence we need to insert a shim to make sure that the correct identifier table will be used.
* | QtScript: Add QObjectWrapOption for not exposing slotsKent Hansen2010-03-241-1/+2
| | | | | | | | | | | | | | | | | | This makes it possible to have a prototype object in place that handles all slot calls, rather than having the slots be recreated in each wrapper object. Task-number: QTBUG-3637 Reviewed-by: Simon Hausmann
* | Merge branch '4.6-s60' into 4.7-s60axis2010-03-221-1/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe mkspecs/common/symbian/symbian.conf src/gui/graphicsview/qgraphicswidget.h src/gui/kernel/qapplication.cpp src/gui/text/qtextlayout.cpp src/openvg/qpixmapdata_vg.cpp src/s60installs/s60installs.pro tools/runonphone/main.cpp tools/runonphone/serenum_unix.cpp qtextlayout.cpp fixed up together with Eskil. Kept the configure.exe from 4.7 without recompile.
| * QScriptClass-implemented constructors lead to application crashKent Hansen2010-03-191-1/+3
| | | | | | | | | | | | | | Add missing popContext() to balance the pushContext(). Task-number: QTBUG-8364 Reviewed-by: Olivier Goffart
* | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7Alan Alpert2010-03-1715-306/+197
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: configure.exe src/declarative/util/qdeclarativelistmodel.cpp tools/qml/qml.pro
| * | QtScript: Improve performance of type resolution when calling slotsKent Hansen2010-03-101-10/+13
| | | | | | | | | | | | | | | | | | | | | Don't call QVector::append(). We know what the size of the vector will be, so size it initially and work on QVector::data() directly. Reviewed-by: Jedrzej Nowacki
| * | Update src/3rdparty/javascriptcore and adapt src/script to the changesKent Hansen2010-03-1015-296/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Update qscriptvalueiterator test to expect length property when iterating arrays and strings. - Use EvalExecutable::create() instead of EvalExecutable constructor. The constructor is private. - Reimplement getOwnPropertyDescriptor() in all custom script objects. - Remove all reimplementations of getPropertyAttributes(). It doesn't exist in trunk anymore (getOwnPropertyDescriptor() is used instead). - Remove checkDontDelete argument from deleteProperty() reimplementations. The purpose of this argument was to support deleting properties with attribute Undeletable from C++. But it was quite an invasive patch to JavaScriptCore, and it doesn't seem worth it. If this feature is really crucial it should be re-done upstream. One of the tests needed to be updated so it's not sensitive to the C++ undeletability. - Adapt getOwnPropertyNames() reimplementations to signature change. - Add missing QScriptObject structure flags, otherwise we don't get all virtual calls. - Remove our patch for reporting column numbers in the debugger callbacks. It was just too intrusive. As with the checkDontDelete issue, this should be redone upstream if it's really important. In 4.7, QScriptEngineAgent will always report a column number of 1. Other compilation fixes: - InternalFunction::name() takes an ExecState* argument, not GlobalData* - ScopeChain::globalObject is no longer a function but a member variable - ScopeChainNode constructor takes a GlobalObject argument - Heap::collect() is called collectAllGarbage() - JSValue::strictEqual() takes an ExecState* argument - Debugger::exception() takes a bool hasHandler argument - Debugger no longer reports column number (we decided to drop that patch from JSC) - UString doesn't have operator+=(char*) - Update the autotests to reflect the columnNumber=1 change. - Add helper class to avoid crashing inside JSC. Ever since r52856 in WebKit trunk, this is needed. There are probably a lot of other public API functions that need this guard as well, but I'll add them as they are discovered. - Update mkdist-javascriptcore tag, exclude a few more files. - Set ENABLE_JSC_MULTIPLE_THREADS=0 define on Mac due to r52355 in trunk. Reviewed-by: Simon Hausmann
* | | Merge remote branch 'qt/4.7' into qml-4.7Qt Continuous Integration System2010-03-102-50/+73
|\ \ \ | |/ / | | | | | | | | | Conflicts: src/declarative/util/qdeclarativestateoperations.cpp
| * | Don't needlessly call pushContext() when reading propertiesKent Hansen2010-03-051-15/+18
| | | | | | | | | | | | | | | | | | | | | It's only necessary to push a QScriptContext when properties are read from an object that inherits QScriptable. Postpone the decision of pushing a context until we know whether the object is a QScriptable.
| * | QtScript: Don't needlessly make deep copies of function namesKent Hansen2010-03-052-35/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QObject binding uses the function name to determine whether a meta-method is an overload. This was implemented quite naively by copying the name from the signature into another array before comparing it. This could cause several unnecessary memory allocations, since storing the name is really only needed when there is an exception (e.g. ambiguous call). Instead, use strncmp to compare only the relevant characters of the original (non-copied) method signature. This makes normal slot invocation from QtScript up to 15% faster. Reviewed-by: Jedrzej Nowacki
* | | Integrate QML's object ownership with the JS collectorAaron Kennedy2010-03-094-0/+25
|/ / | | | | | | | | | | | | QML now behaves in a way similar to QtScript when it comes to QObject ownership. QT-2803
* | QScript: Test against QMetaType::QVariant instead of against the stringOlivier Goffart2010-03-041-23/+14
| | | | | | | | | | | | | | now that QVariant is known to QMetaType, we can test for the metatype id instead of doing string comparison Reviewed-by: Kent Hansen
* | Fixes tst_QScriptExtQObject::connectAndDisconnectOlivier Goffart2010-03-041-8/+6
| | | | | | | | | | | | | | | | | | Now that QVariant is known to QMetaType, it has an ID. This is much more robust as before. This would have fail if QVariant, would have been registered by the user. Reviewed-by: Kent Hansen
* | Perform latin1 conversion directly on JSC::UStringKent Hansen2010-03-011-11/+11
| | | | | | | | | | | | | | | | | | This conversion needs to be as fast as possible since it's performed every time you access a QObject property from QtScript. Hence, we should avoid going via QString and instead do the conversion ourselves. Reviewed-by: Jedrzej Nowacki
* | Avoid calling out to public API in the QtScript implementationKent Hansen2010-02-184-72/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason to construct QScriptValues when JSC::JSValues can be operated on directly. A benchmark showed that ~10% of the time for reading a QObject property from a script was spent just creating and destroying QScriptValue temporaries. It's time to finally get rid of this potential bottleneck, not just in the QObject integration but everywhere. This change refactors the code so that all internal operations are performed on JSC::JSValue (most importantly, conversion from/to Qt types), and the public API functions are just thin wrappers around these. E.g. instead of doing enginePrivate->scriptValueFromJSCValue(jsValue).toQObject() the implementation now does QScriptEnginePrivate::toQObject(jsValue) Other operations are delegated to the engine implementation in similar style. Task-number: QTBUG-8304 Reviewed-by: Jedrzej Nowacki
* | Compile.Warwick Allison2010-02-031-0/+1
| |
* | Merge branch '4.6' of ../qt into kinetic-declarativeuiAaron Kennedy2010-01-201-1/+8
|\ \ | |/ | | | | | | Conflicts: src/corelib/kernel/qobject.cpp
| * Remove QtScript connection when receiver QObject has been deletedKent Hansen2010-01-191-1/+8
| | | | | | | | | | | | | | | | | | | | | | We don't want to have to listen to the destroyed() signal for every receiver object of a connection, and likewise we don't want to create a QObject to handle each connection; instead, remove the connection lazily at signal emission time after we've detected that the receiver has been deleted. Task-number: QTBUG-7313 Reviewed-by: Simon Hausmann
* | Merge branch '4.6' of ../qt into kinetic-declarativeuiAaron Kennedy2010-01-191-1/+2
|\ \ | |/
| * don't assert when calling QtScript-wrapped method of deleted QObjectKent Hansen2010-01-181-1/+2
| | | | | | | | | | | | Make it behave the same as the old (4.5) back-end. Reviewed-by: Jedrzej Nowacki
* | Fix possible crashAaron Kennedy2010-01-152-4/+9
| | | | | | | | The QScriptValue does not always have a valid QScriptEngine.
* | Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic ↵Aaron Kennedy2010-01-1418-19/+182
|\ \ | | | | | | | | | into kinetic-declarativeui
| * \ Merge branch '4.6' of git://scm.dev.nokia.troll.no/qt/qt into ↵Warwick Allison2010-01-1418-19/+182
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | kinetic-declarativeui Conflicts: bin/syncqt src/corelib/io/qurl.cpp
| | * Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-01-1118-18/+18
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (71 commits) QNAM HTTP Code: Cache socket state inside ensureConnection() tst_qhttpnetworkconnection: Test also HEAD in some tests tst_qhttpnetworkconnection: Relax condition in getMultipleWithPriorities QNAM HTTP Code: When starting new request, prefer connected sockets. typo fix Added the 'framecapture' WebKit example to the default build. Fix code example fix typo in qreadwritelock's documentation QNAM HTTP: Don't call d_func() so often QNAM HTTP: Fix readBuffer maximum size. QNAM HTTP: Optimize eatWhitespace() QNAM HTTP: Check if socket already tries to connect. network internals: fix build on S60 [syncqt] Make -separate-module work with WebKit's directory structure doc: Corrected explanation of when append() does nothing. doc: Added clarification about allocating space for the 0 terminator. Add a way to access the normalised URL in QUrl. [syncqt] Make it possible to synchronize headers for a separate module [syncqt] Make it possible to override the base directory network internals: start HTTP GET requests right away when called ...
| | | * Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-01-0718-18/+18
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: QIODevice: Fix readAll() Temporary hackiesh solution to prevent BOM in the xml data. Fixed qxmlstream autotest when using shadow builds. Attempt at readding the capital P headers for Phonon Remove special Phonon processing from syncqt. Use the lowercase/shortname.h headers for Phonon includes Fixes a crash when setting focus on a widget with a focus proxy. Update copyright year to 2010 doc: Clarified activeSubControls and subControls. Remove warning "statement with no effect" doc: Clarified that .lnk files are System files on Windows.
| | | | * Update copyright year to 2010Jason McDonald2010-01-0618-18/+18
| | | | | | | | | | | | | | | | | | | | Reviewed-by: Trust Me
| | * | | Correctly determine QScriptValue::isQObject() for QObjects using theMichael Brasser2010-01-112-0/+6
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | QScriptDeclarativeClass. Task-number: QTBUG-6178 Reviewed-by: Kent Hansen Reviewed-by: Aaron Kennedy
| | * | Implement QScript::QObjectDelegate::getOwnPropertyDescriptorOlivier Goffart2010-01-054-1/+164
| | |/ | | | | | | | | | | | | | | | | | | This is needed for the fix for QTBUG-5749 that follow Reviewed-by: Kent Hansen Task-number: QTBUG-5749
* | | Support calling in QScriptDeclarativeClassAaron Kennedy2010-01-144-3/+58
|/ /
* | CompileAaron Kennedy2010-01-121-1/+1
| |
* | Optimization: Add QScriptDeclarativeClass::ValueAaron Kennedy2010-01-113-5/+199
| | | | | | | | | | | | | | This class is essentially the same as QScriptValue, but it is faster as it doesn't reference objects. Thus, they might be collected if the gc runs. For return values from QScriptDeclarativeClass this isn't a problem, of course.
* | Correctly determine QScriptValue::isQObject() for QObjects using theMichael Brasser2009-12-172-0/+6
| | | | | | | | | | | | | | | | | | | | | | QScriptDeclarativeClass. This allows us to pass QObjects to QML-defined functions which expect a QVariant (and will presumably help in other cases where we expect transparent QObject <-> QVariant conversion in the engine). Task-number: QTBUG-6178 Reviewed-by: Aaron Kennedy
* | Introduce experimental binding optimizerAaron Kennedy2009-12-141-0/+1
|/ | | | Enable with QML_EXPERIMENTAL=1
* Fix garbage collection issue with script-owned objects with connectionsKent Hansen2009-11-301-13/+14
| | | | | | | | | | This reinstates the pre-4.6 behavior: A script-owned C++ object that's not referenced anymore should be garbage collected, even if it has connections. In order to achieve this, the "weak" reference to the C++ object's wrapper must be invalidated. Task-number: QTBUG-6366 Reviewed-by: Simon Hausmann