aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Change the object allocation schemeSimon Hausmann2014-07-221-3/+3
| | | | | | | | | Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert constructors for builtin functionsLars Knoll2014-07-221-69/+69
| | | | | Change-Id: I9db595e5d6ee20a291252566a38ac3bdfff900f6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-8/+8
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert ExecutionContext to new storage schemeLars Knoll2014-07-221-238/+238
| | | | | Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename Managed::managedData() to d() to be consistentLars Knoll2014-07-221-1/+1
| | | | | | | | No need to differentiate in the name anymore, as the data structures all inherit from each other now. Change-Id: Ia41f50ce4e521f9626d874311ceb57e0e194888b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert qqmlbuiltinfunctions to the new storage layoutLars Knoll2014-07-221-13/+11
| | | | | Change-Id: Idb075e97a5f62bbfe8086155d13a01d1dbc99c08 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move data of FunctionObject into an inner structLars Knoll2014-07-221-1/+1
| | | | | Change-Id: Ic00b1761565f9f8881b665a3fecca723239e2279 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-1/+1
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of different macros for vtable specializationsLars Knoll2014-07-221-1/+1
| | | | | | | Detect existence of a a vtable entry at compile time. Change-Id: Ieed5d34b063184bc4435b22c6685ac0e3fabf493 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid calling destroy() on most objectsLars Knoll2014-07-221-1/+1
| | | | | | | | | The method is now optional, and we can simply avoid calling it if all members an object has are themselves garbage collected. Change-Id: If560fce051908bcc10409ead1a7d8a5bd5fa71d2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support for translations in pure QJSEngine based environmentsSimon Hausmann2014-06-131-7/+26
| | | | | | | | | | | Re-add the QScriptEngine::addTranslatorFunctions API that brings back qsTr() and friends to pure QJSEngine based environments. The auto-test were also ported where applicable. Change-Id: Ib03e3495ef09eeea9e4c8341061499768caed307 Sanity-Review: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix potential null pointer dereferencingFrederik Gladhorn2014-05-301-2/+3
| | | | | | | | | These were found by http://www.viva64.com/en/b/025 most issues are rather cosmetic. Change-Id: I7cc12610aae6a43d26bedb9b480863c0695ddfa3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc: Polish property binding explanationsSze Howe Koh2014-05-161-10/+8
| | | | | | | | | - Minor rearrangements - Express things more clearly and/or concisely - Add links Change-Id: If1ed639609e39ed1a2c12aed3971da3ee2c8f8a0 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Remove V8 profiler serviceUlf Hermann2014-05-091-1/+0
| | | | | | | | | It's broken and useless and it sends confusing data to the profiler client. Task-number: QTCREATORBUG-12188 Change-Id: I944cf19a78ee4378d5773e7aa80876f199a0f03b Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Remove redundant QQmlBinding members.Michael Brasser2014-03-111-28/+25
| | | | | | | | | This reduces the size of QQmlBinding by 12 bytes. Task-number: QTBUG-37134 Change-Id: Id55257edec8cee88d863374e8a96d7eebbeaf523 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Remove the name member of FunctionObjectLars Knoll2014-03-071-1/+1
| | | | | | | | The data is anyway stored in the name property of the FunctionObject, and is not performance critical. Change-Id: If1784b0ec6f368bc474c246bb9c2c50d5e56b689 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add the features of QLoggingCategory to QML's debugging methods.Giorgos Tsiapaliokas2014-03-071-4/+10
| | | | | | | | | | It is now possible to modify the output of QML's debugging methods. Also the prefix of "qml" makes it possible to capture the output from the QML files using qInstallMessageHandler. This commit depends on qtbase/4967c7106568d5df0be4d40bf793583c7c6bdb69 Change-Id: I2c7a2cb96a0b91fd3249dc2dacbab63e6ac68243 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Infrastructure for supporting multiple profilers in qqmlprofilerserviceUlf Hermann2014-02-131-22/+6
| | | | | | | | | The concepts of "global" and "engine" profilers are introduced. Profilers can either be attached to specific QML engines and run in their threads or they can be unspecific global profilers running in arbitrary threads. Change-Id: I3862fc65c07ccb33a1ca08cd2425e4079d3ffc02 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Rename V8 profiler classes to V4Ulf Hermann2014-01-231-3/+3
| | | | | Change-Id: I54a71b83bdcaa4198b63a08572bc3d9d1bf8deea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Split ManagedVTable into two classesLars Knoll2014-01-211-5/+5
| | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make sure that profiling can only be started if debugging is enabled.Ulf Hermann2014-01-151-1/+3
| | | | | | | | | | | Enabling the profiler doesn't make much sense if there is no debug service as the messages can't be sent anywhere then. Furthermore, the profiler instance is only properly initialized if debugging is enabled and thus enabling profiling without debugging being enabled can cause problems. Change-Id: I784a110126d45a9a2bc9d9e14d9a22e2980c3a42 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Doc: Fix broken linksSze Howe Koh2013-12-301-2/+2
| | | | | Change-Id: I4c4577edde96978a986606bf30fbb925f871bd42 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
* Remove setVTable calls in performance critical areasLars Knoll2013-12-041-1/+1
| | | | | | | | | | Remove all the calls to setVTable that were in performance critical parts of the code. This now brings performance back to the level we had with the vtable inlined in the Managed objects. Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the vtable pointer from the object to the internal classLars Knoll2013-12-041-2/+2
| | | | | | | | This saves one pointer per object, and willmake other optimizations easier in the future. Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix qsTr() in .js contextJ-P Nurmi2013-12-041-1/+3
| | | | | | | | | Don't assume a four characters long file name suffix (.qml) Task-number: QTBUG-32850 Change-Id: I522c06b71bf1b38f32f2947a6c06017f83eb50be Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Simplify & speed up function callingLars Knoll2013-11-091-53/+53
| | | | | | | | | Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-051-3/+3
| | | | | | | | | | | Don't use recursive function calls anymore. Instead, push marked objects onto the JS stack, and then pop them off when their children are being marked. Should reduce stack memory usage, and improves performance by ~5%. Change-Id: I2d37d97579144fcba87ec8e9fd545dd220c01fbb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-9/+9
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid side effects when en exception has been thrown.Lars Knoll2013-10-291-13/+11
| | | | | | | | | | | | | | We don't want to check for exceptions after every single line on our runtime methods. A better way to handle this is to add the check in all methods that have direct side effects (as e.g. writing to a property of the JS stack). We also need to return whereever we throw an exception. To simplify the code, ExecutionContext::throwXxx methods now return a ReturnedValue (always undefined) for convenience. Change-Id: Ide6c804f819c731a3f14c6c43121d08029c9fb90 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Protect a few constructors against self destructionLars Knoll2013-10-111-0/+4
| | | | | | | | This gets most of qqmlecmascript to pass with aggressive and exact garbage collection. Change-Id: I93ecbfe55f62af68227cdf3b1ec2bd066f1cbdef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove usage of String pointers where not requiredLars Knoll2013-10-111-6/+12
| | | | | Change-Id: Ia533308a1641fab263d8faa8316455e8ade1c859 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't print garbage or crash when using console.logJan Arve Saether2013-10-031-8/+17
| | | | | | | | | | | | | | | | | The problem was that the ctor of QMessageLogger did not make a deep copy of the source or the function. Since the QByteArray returned from toUtf8() was only guaranteed to live within the statement it was used, the pointers that QMessageLogger held would point to released memory as soon as the QByteArray got destructed. This could only be reproduced if the logging framework tried to print the source file or the source function. In my case, I had set this environment variable to provoke this: $env:QT_MESSAGE_PATTERN="%{file}(%{line}):%{message}" Change-Id: I4ea4cf309c6c6420cef5bab0108a6cb2b2f9e841 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change exception handling APISimon Hausmann2013-10-021-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the exception handling API in the engine slightly, encapsulating any use of direct throw statements and catch blocks with concrete types. In the future we need to be able to change the way these are implemented, in order to ensure that the correct stack unwinding code is triggered for throw and re-throw. This patch separates the C++ exception object thrown from the V4 exception (that includes value, throwing context pointer) and stores the latter inside the engine. In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to move into the QV4 namespace directly. In addition the syntax for catching exceptions changes from try { ... } catch (QV4::Exception &ex) { ex.accept(context); QV4::ScopedValue exceptionValue(scope, ex.value()); } to try { ... } catch (...) { QV4::ScopedValue exception(scope, context->catchException()); } Context::catchException() checks if there's a "current" exception in the engine, and if not assumes that we caught an unrelated exception and consequently re-throws. partiallyUnwind() is also gone and replaced with rethrowException(), in order to encapsulate the re-throw. Lastly, in the future nesting try/catch blocks isn't going to be possible due to limitations in the common C++ ABI with regards to foreign exceptions. Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* qdoc: no longer recognizes the version nr in QML refsMartin Smith2013-10-021-6/+6
| | | | | | | | | | All QML references of the form <QML-module-name><QML-module-version>::<QML-type>::<member-name> have had the <QML-module-version> removed i. Task-number: QTBUG-33776 Change-Id: Idde279e0f254cd24ea44f9841662dd81a2c5bbc6 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Remove most uses of Value from qml/qmlLars Knoll2013-09-301-25/+27
| | | | | Change-Id: I409a8505a9e01f86d777bc694d24516d1c8f0c4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix API for Object::define*PropertyLars Knoll2013-09-281-5/+5
| | | | | | | use ValueRef instead of const Value &. Change-Id: I3fd0ca829870db27f036825d713c53dc0600be07 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove Value::fromString()Lars Knoll2013-09-281-13/+13
| | | | | | | | replaced with call to the GC safe ExceutionEngine::newString() method. Change-Id: I7258296e75ca724ff42b94a0d147bc33a05f8f68 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct QV4::Value usageLars Knoll2013-09-281-4/+5
| | | | | | | | Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-5/+5
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix CallContext to not hold arguments on the C stack anymoreLars Knoll2013-09-281-172/+172
| | | | | Change-Id: I35f46cce4f243d4b8b2bac9244f8fc26836f413b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc: Made \since commands in src/qml consistent.Jerome Pasion2013-09-251-1/+1
| | | | | | | | | | | | | | -QDoc displays the Qt version in the HTML output. -If there is only one argument to \since, QDoc assumes it is the Qt version. "QtQuick 2.1" -> "Qt 5.1" "QtQml 2.1" -> "Qt 5.1" "QtQuick 1.1" -> "Qt 4.8" Task-number: QTBUG-32172 Change-Id: I3c0da4dce8e44d717a6840bea250b4f0f9d78128 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Convert putIndexed()Lars Knoll2013-09-221-1/+1
| | | | | Change-Id: I7d02b0fdf45079d0f7afcfb6d3158dd60cb09f33 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert Managed::put() API to be GC safeLars Knoll2013-09-221-9/+14
| | | | | Change-Id: I09198ce372fa545372db389fac26828d21ad5731 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup Object::define*Property APILars Knoll2013-09-221-62/+62
| | | | | Change-Id: I99125908a9bc1d41a2642c409af9704def7a0832 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Start using StringRef for parameter passingLars Knoll2013-09-221-3/+3
| | | | | Change-Id: If2c41daeda2862cd1162c5da8163a9d62fe4111d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup ExecutionEngine::newBuiltinFunction() usagesLars Knoll2013-09-221-18/+5
| | | | | | | And change the return type to be GC safe Change-Id: I6d7513962370fea4072a3d8c6b2c6f2d1705992e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Further work towards an exact GCLars Knoll2013-09-221-3/+4
| | | | | | | | | | | Add some more convenience in the helper classes in qscopedvalue_p.h Make accesses to CallData safer, and change ExecutionEngine::newObject() to return a safe pointer. Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert some methods to use Returned<>Lars Knoll2013-09-181-10/+13
| | | | | Change-Id: I631606cb5ab3b35b72104e70092a5200dd235fbc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-26/+26
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>