aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge "Merge branch 'release' of ↵Lars Knoll2013-11-261-1/+8
|\ \ | | | | | | | | | ssh://codereview.qt-project.org/qt/qtdeclarative into stable" into refs/staging/stable
| * | Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative ↵Simon Hausmann2013-11-261-1/+8
| |\| | | | | | | | | | | | | | | | into stable Change-Id: I0bf06be69927d5961f1bdb4948c3572ef6111923
| | * V4 Use getrlimit on Darwin to get the stack size for the main threadAndy Nichols2013-11-201-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out pthread_get_size does not return the correct size when it is called from the main thread, so to workaround you call getrlimit instead Without this change, most QML applications are broken on iOS. Change-Id: I9a61494de26caa3d7be7e46a991e6d6d0514ce17 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Fix MSVC-64-warnings about truncation of integers.Friedemann Kleint2013-11-261-3/+4
| | | | | | | | | | | | | | | Change-Id: Ib92ce4b7e42061bb1892957f04cbfc1fcfe43615 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | | Fix MSVC-64-warning about shift word size.Friedemann Kleint2013-11-261-1/+1
|/ / | | | | | | | | | | | | | | jsruntime\qv4mm.cpp(301) : warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?). Change-Id: I6a4ca024d43776e16a323fdb8c35a339b74e6c09 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-253-0/+10
| | | | | | | | | | | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | IR Cleanup, resolve ID objects through array subscriptsSimon Hausmann2013-11-253-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | ...instead of a special MEMBER type. This allows removing the type member from V4IR::Member altogether (and thus unshadow from V4IR::Expr::type). By not requiring the base of a id lookup member expression to be a NAME, we can also speed up repeated id lookups by fetching the id object array wrapper only once per function. Change-Id: I3e9b8f498d32ace4a0cc2254f49e02ecc124f79c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Improve type interference for QObject propertiesSimon Hausmann2013-11-252-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate QObject properties in member expressions across temporaries as part of the type interference SSA pass. This replaces the earlier attempt to resolving QObject properties in fieldMemberExpression() in the codegen, but it was incomplete and now things like the following are fully resolved: var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name With this patch Temp gets a helper structure with a function pointer, initialized to aid the resolution of properties in Qt meta objects. This structure is propagated into the temps until it reaches the next member expression that uses the temp. Similarly QObjectType is added as IR type, next to VarType. The resolution inside the SSA type interference pass also requires passing through the QQmlEngine from the upper caller levels, in order to resolve the property type to a potential QMetaObject property. Change-Id: I14c98fa455db57603da46613ce49c174d0944291 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Saner and simpler way to handle line numbers for JITed codeLars Knoll2013-11-222-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | Instead of storing the current instruction pointer in the ExecutionContext, we might as well directly store the current line number there. Leads to simpler code, works cross platform and should also be faster. Change-Id: Ifb7897cf8dbe8a962505fe876aa3ed43283ebb06 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Turn execution contexts into Managed objectsLars Knoll2013-11-229-62/+85
| | | | | | | | | | | | | | | | | | | | This finally gives proper memory management for ExecutionContexts. So far they had been garbage collected but where still allocated using standard malloc/free(). This allows us to collect the contexts faster and speed up context creation. Change-Id: I02e642391d55eaa59ab3f4c2720a2ac71259caf4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add support for large items to the memory managerLars Knoll2013-11-221-2/+39
| | | | | | | | | | | | | | | | This is required, so we can track ExecutionContexts through the regular memory manager. Change-Id: I1bd2e2ef275e6e9e1f364a35affbb991f4377b05 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Speed up arguments objectLars Knoll2013-11-226-23/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't fully create the arguments object unless required. In the 95% use case, we can avoid creating any array based data structures for the arguments object and directly manipulate the functions arguments. only create the full data structure for the other 5%. Speeds up the raytrace test by 50%, gives around 10% overall on v8-bench. Change-Id: If727d28b96585e83314f544031a6c3ca1817ea19 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use lookups for create_property (ie. new foo.bar)Lars Knoll2013-11-223-5/+27
|/ | | | | | | | This is not used that often, but it removes one more place where we do lookups by name. Change-Id: I9f798b8b4a64be3fdf3e53090e4288724c9d2b22 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: fix Array.indexOf() for QStringListLiang Qi2013-11-201-1/+1
| | | | | | | | | Autotest is included. Task-number: QTBUG-33542 Change-Id: I46c3a81006019c6613a3d35aa018217f85a15d0b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
* Greatly reduce memory consumed by QQmlEngine instancesLars Knoll2013-11-193-29/+112
| | | | | | | | | | | | | | | | Due to a inefficiency in our InternalClass implementation, we were not sharing the string and attribute table between internal class instances. This was extremely inefficient with the Qt object, as it created around 1000 internal classes with large string and property tables. With the patch these tables are now shared. Reduces memory consumption of a QQmlEngine instance from around 6.5M to a couple of 100k. Change-Id: Ib763f31deca0808c000ac2c30aa0b05e806bda40 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix compilation on QNXFabian Bumberger2013-11-191-1/+1
| | | | | | | pthread_getattr_np is not available there, so we use the default implementation (1MB stack limit) for now. Change-Id: Ia1f3cbbcd846998b688541c0b576ef42f22ac8b6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix compiler warnings with mingw64.Erik Verbruggen2013-11-182-27/+29
| | | | | | | Task-number: QTBUG-34152 Change-Id: Ibb93d1cac8c343a7ca34ce7d010f24fc56ba89df Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix small bug in array sortingLars Knoll2013-11-181-3/+3
| | | | | | | Task-number: QTBUG-34321 Change-Id: I33089499f730bce16a9dfdda04cc8402602bc5fa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make comparison of singletons and qobjects workAlbert Astals Cid2013-11-182-0/+12
| | | | | | | | | | | Otherwise you can end up with some weird situation in which you have two objects, you print them and then you print the comparison and get a Foo(0x858480) b Foo(0x858480) a == b false Task-number: QTBUG-34651 Change-Id: Id2444d919f039be085eb5ed9112345db691540a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix interaction between head room and appending in arraysLars Knoll2013-11-183-7/+7
| | | | | | | | | | We reserve space on both ends of the JS array for appending and prepending. Make sure they interact well with each other and don't cause any memory corruption. Task-number: QTBUG-34853 Change-Id: I184280178690e3cb12ab9b199a8436b32383af38 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Limit the amount of memory we allocate on the stackLars Knoll2013-11-186-3/+93
| | | | | | | | | | | | | | | | | | | Setup limits for both the C and the JS stack, and check them before entering functions. If we run out of space, throw a RangeError exception. Be careful and recheck the stack bounds when things go outside. This catches the case where the engine got moved to another thread changing the stack boundaries. Windows currently uses an unsafe fallback implementation, this needs to be fixed later on. Task-number: QTBUG-34568 Change-Id: I22fbcbec57b28f9cc8a49e12f1cc6e53e4f07888 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix === operator for value typesLars Knoll2013-11-152-3/+6
| | | | | | | | | Fix === comparison for urls and other QML value types. Task-number: QTBUG-33546 Change-Id: I4a7066e6bbc7de7c599fe2c7b2fdfb75e0ff5196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't crash when trying to assign to null.propLars Knoll2013-11-151-0/+2
| | | | | | | | | | Fixes a regression introduced during the exception handling refactoring. Task-number: QTBUG-34544 Change-Id: Ib751274d759030db3e5d3b1380b30dc07ec85f83 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 debugging: fix step-over and step-out.Erik Verbruggen2013-11-144-37/+54
| | | | | | | | | | | | | | | | - step-out: only stop if we’re leaving the context for the function we previously stopped at, so intermediate calls between the current position and the end do not stop the engine - step-over: set breakpoints on all lines in current function and continue to run. When hitting a breakpoint, see if we are in the same context, because recursive calls might happen. Breakpoints on all lines are needed, because the (pure) next line might be jumped over (like when doing step-over a single-line then clause, where the next line might be in the else clause). Change-Id: Idf35dc740ca64fae5079162162906490a96af2a7 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Allow passing qmlRegisterSingletonType QObjects to C++ as QObject*Albert Astals Cid2013-11-141-0/+7
| | | | | | | | | | | | | At the moment you can pass them as their FinalType* or as one of their ParentType* but not as QObject* which does not make much sense to me Task-number: QTBUG-34617 Task-number: QTBUG-30730 Change-Id: Id5cfb7bbb123456ef43f44f33b450f8966a7641a Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix native compilation on linux/arm with gcc 4.7.2Erik Verbruggen2013-11-131-1/+1
| | | | | | | | | | | /disk/qt5-dev/qtdeclarative/src/qml/jsruntime/qv4function.cpp: In instantiation of ‘int QV4::LineNumberMappingHelper<field, SearchType>::lowerBound(int, int, SearchType) [with int field = 0; SearchType = int]’: /disk/qt5-dev/qtdeclarative/src/qml/jsruntime/qv4function.cpp:142:49: required from here /disk/qt5-dev/qtdeclarative/src/qml/jsruntime/qv4function.cpp:106:13: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] cc1plus: all warnings being treated as errors Change-Id: Ic97d6a2a9acd392d565e9c66f30159552473e092 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property dependency generation for accelerated QML QObject propertiesSimon Hausmann2013-11-125-15/+17
| | | | | | | | | | | | | | The previous approach of collecting the dependencies through an IR visitor doesn't work, because it relies on a fixed structure - for example MEMBER(NAME, prop) - which we can't guarantee (it's usually MEMBER(TEMP, prop)). But it turns out that we can only pre-calculate dependencies for context, scope or id properties, so we can do that right away in the QML specific JS codegen, store that information in the IR function and use it from there in the data structure generator as well as in the isel as a parameter to getQObjectProperty to tell the run-time whether capture is required or not. Change-Id: I33711c3420d6534c653c2a6a4284f0fc12e941cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix Object::getArrayHeadRoom()Lars Knoll2013-11-121-0/+1
| | | | | | | | | | The method didn't adjust the size of the allocated array properly, leading to crashes when being called repeatedly. Task-number: QTBUG-34723 Change-Id: Ib58e7dcab6d0f5f46f3cf342eb541c1cc6b6cdc6 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Debugging with V4Erik Verbruggen2013-11-106-244/+817
| | | | | | | | | Currently missing, but coming in subsequent patches: - evaluating expressions - evaluating breakpoint conditions Change-Id: Ib43f2a3aaa252741ea7ce857a274480feb8741aa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove stray warn_off in pri fileLars Knoll2013-11-091-2/+0
| | | | | Change-Id: I9abf1180aecbd2e87fa7f52b51ad1c59665723fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove debug outputEskil Abrahamsen Blomfeldt2013-11-091-1/+0
| | | | | | | | | Some applications (like e.g. the Tweet Search example) prints out a ton of these "scanEscape" messages to the console. Change-Id: Ibfa9c4780705167693c7fb6af8cad1e312549a5f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move Primitive::emptyValue() to qv4value_def_p.h.Friedemann Kleint2013-11-092-9/+8
| | | | | | | | | | | | Silence MinGW-warnings: warning: 'static QV4::Primitive QV4::Primitive::emptyValue()' redeclared without dllimport attribute after being referenced with dll linkage Task-number: QTBUG-34152 Change-Id: Id6971a20f1901022ab0d1c8f1834b135c71510ae Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initialize variableLars Knoll2013-11-091-0/+1
| | | | | Change-Id: I540b08bd1c60215a63cad1233f09e060b70df66f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify & speed up function callingLars Knoll2013-11-0941-461/+456
| | | | | | | | | 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>
* Generalize check for localtime_rKai Koehne2013-11-081-6/+6
| | | | | | | | | | | | | | | Use the _POSIX_THREAD_SAFE_FUNCTIONS define to decide whether localtime_r is available, instead of guessing by Mingw-w64 version. This copies the logic of qdatetime.cpp in qtbase, and should fix compilations with older Mingw-w64 versions. It replaces ce3e8f93c. Task-number: QTBUG-34038 Change-Id: Iee8a9aa61d2af3e069e6365c40f81007c479d147 Reviewed-by: Mark Brand <mabrand@mabrand.nl> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Initialize variables before using them.Sérgio Martins2013-11-061-0/+2
| | | | | Change-Id: I7cd5a17259814b3f2405b63d7f4d2a0fd30cae4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Replace QString::fromUtf8() with QString::fromLatin1() for literalsKai Koehne2013-11-061-1/+1
| | | | | | | The literals are all latin1 strings, and fromLatin1() is much faster. Change-Id: I25af0358a0a4aa2e973349c027cfac50b7589429 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Fix build on WinRTAndrew Knight2013-11-062-2/+2
| | | | | | | | Disable JIT and avoid unsupported functions under WinRT. Also add MSVC's ARM flag to the double conversion white list. Change-Id: I22ec340a20b113fdeefb802ac61812f78a527895 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Ensure the this object is set correctly to the scope object in binding ↵Simon Hausmann2013-11-051-2/+0
| | | | | | | | | expressions This is a regression from 5.1 Change-Id: I61ad372a02d937c195dad74bd9fcb8fd4410d97a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Smaller optimisationsLars Knoll2013-11-051-8/+6
| | | | | Change-Id: Idb35d57801472e73b4e77b83e129dbb2a484b734 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove 2 unused macrosLars Knoll2013-11-051-3/+0
| | | | | Change-Id: I095673b56166f47969583e9aff30bcef1e50a674 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move conversion of this object into generated codeLars Knoll2013-11-055-18/+19
| | | | | | | | | | | | When a non strict mode function uses the this object, we need to make sure it's being correctly converted into a object before being accessed. So far this was being done by ScriptFunction::call. Move this into the generated code to avoid overhead for methods not using 'this', and simplify our ScriptFunction::call() implementation. Change-Id: I739f4a89d29ed8082ce59e48d1523776224fc29d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't initialize locals for simple script functionsLars Knoll2013-11-051-3/+0
| | | | | | | There are not being used anyway. Change-Id: Id61b023eeb9d61bbee2874a5fd5005ba9fb08fca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Minor optimisationsLars Knoll2013-11-052-31/+34
| | | | | | | Remove a couple of function calls. Change-Id: I5abc6d96df52787ee7c433239807c851eb9a6d41 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove code that's not required anymoreLars Knoll2013-11-051-17/+0
| | | | | | | | | The StackSaver class is not required anymore, as we don't throw C++ exceptions anymore, and masm/moth generated code always cleans up the JS stack. Change-Id: If49d952230f8bd074f3b9353f56c07c8c5134752 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't run the GC too oftenLars Knoll2013-11-051-8/+13
| | | | | | | | | | Some test cases were badly trashing the GC, running it way too often. Fix this by only running the GC after we allocated more than 50% of the amount of available items. Change-Id: Icfe6d0730552ef2298963de706213ebc9e3e342c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimise string additionsLars Knoll2013-11-056-33/+98
| | | | | | | | Small optimisation for string additions, also add one more check for exceptions in the code where required. Change-Id: I6c14bc88ea5d03f7eeed0e0168c5195f9f823693 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix rounding behavior of Qml when assigning doubles to integer propertiesSimon Hausmann2013-11-051-1/+1
| | | | | | | | | | | | The engine used to round, but that is inconsistent with ECMAScript's way of converting doubles to integers by truncation. With this patch we can also enable the propagation of integer type information into the IR, but we have to be careful not to utilize it when writing properties. Change-Id: I04af4879ba5131349eca2eeff2b27f4598f5267b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-0537-167/+177
| | | | | | | | | | | 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>
* Enable JIT for WinCE.Sérgio Martins2013-11-041-2/+2
| | | | | | | | Demos work, 120 unit-tests pass, some failures unrelated to JIT. Change-Id: I641d31cc08dc7961fa46d7b95666178699317f61 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>