aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
* Lookup::lookup should not return a Property pointerLars Knoll2014-01-203-17/+49
| | | | | Change-Id: I5c9858f636c199b9cbe7cb2bffa03db14b6e1ae4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-175-28/+30
|\ | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/imports/dialogs/DefaultFileDialog.qml src/imports/widgets/qquickqfiledialog.cpp Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
| * Merge remote-tracking branch 'origin/release' into stableSimon Hausmann2014-01-163-10/+0
| |\ | | | | | | | | | Change-Id: Id18709cb0a4d85ffdadffa28aef98323367292d4
| | * Fix failing context->next != 0x1 assertionSimon Hausmann2014-01-163-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After commit bf173fe5da381c88343296ca33ef6b06389c6d20 context objects are always on the GC heap and no more in that special linked list or stack allocated, so the next pointer became dangling/uninitialized and asserting on it was bound to fail randomly. Since we no more allocate contexts on the stack, we can safely remove the assertion. Task-number: QTBUG-35917 Change-Id: I104bd129c6c32f46a6302052f563abdf926cb879 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
| * | Do not crash if /proc is not mountedAlbert Astals Cid2014-01-152-18/+30
| |/ | | | | | | | | | | | | | | When proc is not mounted pthread_getattr_np fails, so default to 1MB stack in getStackLimit and to exactGC in MemoryManager Change-Id: Ic7515fd420f2d39a656808d24a3915a657722891 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix bad cast of virtual class to base class via reinterpret_castThiago Macieira2014-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang 3.4 found it: qv4managed_p.h:202:9: error: 'reinterpret_cast' to class 'QQmlDelegateModelGroupChangeArray *' from its base at non-zero offset 'QV4::Managed *' behaves differently from 'static_cast' [-Werror,--Wreinterpret-base-class] QV4::Managed and QV4::Object are non-virtual classes (they have no virtual table). I'm not sure if they are (C++11) standard layout, but they seem to fit the bill. However, QQmlDelegateModelGroupChangeArray has virtual functions, so the QV4::Managed sub-object in that class does not start at offset zero. That means reinterpret_cast'ing the base to the derived class is *wrong*, even if we're just calling a static function. In any case, we're static_cast'ing in the next line anyway, so this can't hurt. Change-Id: Icc796f7ecf8f41f859ea5fc877f5db5c87799964 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Cleanup: change signature of Object::insertMember()Lars Knoll2014-01-097-48/+37
| | | | | | | | | | | | | | | | | | | | | | | | Methods returning a Property pointer have to be removed, so that we can move over to store member data requiring only one value for the common case of data properties. This will in the long term reduce memory consumption on 64 bit systems quite a bit. Change-Id: I78de3794ec7b3bc5db13aa57275d3f08fa9d470a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Smaller code cleanupLars Knoll2014-01-092-24/+13
| | | | | | | | | | | | | | Move the check for isEmpty() into ArrayData::getProperty. Change-Id: I1791ced706afadbb2f45883cb1b3915f40500b71 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rework array handling for JS objectsLars Knoll2014-01-0926-771/+1261
| | | | | | | | | | | | | | | | | | Split up ArrayData into two classes, one for regular arrays, one for sparse arrays and cleanly separate the two cases. Only create array data on demand. Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fixes for argument objectsLars Knoll2014-01-094-4/+14
| | | | | | | | | | | | | | | | | | Fix a possible infinite recursion, and a corner case where we wouldn't set the correct data when writing to the argument object Change-Id: Ia64b9f62e9b881e24d74e23d96d5eb27805a126f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add Object::hasOwnProperty()Lars Knoll2014-01-094-9/+15
| | | | | | | | | | | | | | | | This allows us to remove more getOwnProperty calls. This will be required later on to extend our array handling. Change-Id: I7b7f5887990cd443accf51891644fdfbb849cf35 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-081-1/+1
|\| | | | | | | Change-Id: Ied8d65aaf57e897a3dbc4df100744a594e8ee2cf
| * [ChangeLog][QtQml] Fix JavaScript Array.pop() not updating the internal ↵Simon Hausmann2014-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | array length correctly While the length property was reporting the correct value, the internal array length was out-of-sync. Task-number: QTBUG-35979 Change-Id: I68820a349cf1ce88c6aabc6a2301a8a861018a10 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Move array data into it's own structLars Knoll2014-01-0312-318/+321
| | | | | | | | | | | | | | First step of separating the array data from Object. Change-Id: I5c857397f0ef53cff0807debdb1e405424e1046a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of the nonStrictArgumentsObject flag in ManagedLars Knoll2014-01-036-9/+10
| | | | | | | | | | Change-Id: I4ac58e9d87506ae930c2e44e6089f4af3cd9ccb2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use the flags to check whether a Managed is of a certain typeLars Knoll2014-01-032-6/+5
| | | | | | | | | | Change-Id: I740c4b7e26bdb9d9f40c1c46615cc68f679e036f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix compiler warning about wrong reinterpret_castLars Knoll2014-01-031-4/+4
| | | | | | | | | | | | | | | | | | No need to use reinterpret_cast's in the type checking for the Managed casting. A static cast works just as well (as it's actually used two lines further down). Change-Id: Ie531098eddddda7e9f151eaedc136cbeab14f473 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move Managed::type and some flags into the vtableLars Knoll2014-01-0331-81/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | Move the type flag into the vtable to free up these bits in the Managed class, and not have to set them at object construction time. As we often need to know whether a Managed object is a Object, FunctionObject or String, add some bitflags to test for these to the vtable. Change-Id: I7d08ca044544debb307b55f124f34cb086ad9e84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Clear out memory in the GC, not when constructing objectsLars Knoll2014-01-032-4/+2
| | | | | | | | | | | | | | | | Object construction shouldn't need to zero initialize itself, let's rather do this in the GC, where we can use fast memset's. Change-Id: I2f9efa1729183b0d737de5a84f92af319b2c5631 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Do not call InternalClass::changeVTable directlyLars Knoll2014-01-032-4/+6
|/ | | | | | | | vtable changes need to happen when the internal class is being constructed, not later on. Change-Id: Ibb9515745c9fc3507a5a90b4cc50a33e2e0d3f99 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixes: qml memory corruption on Androidaavit2013-12-171-0/+10
| | | | | | | | Bionic pthreads reports too small stack size for main thread. Change-Id: I3d33229e76101a847309c723d534844ffb2d2042 Reviewed-by: Andy Nichols <andy.nichols@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-121-2/+7
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlcompiler.cpp Change-Id: I802731139d47c5b733dd805f7bf432d67d7331e1
| * Fix a crash in JSON.parseLars Knoll2013-12-041-2/+7
| | | | | | | | | | | | | | | | | | | | Properly set members that are actually array indices and don't crash when trying to set those. Task-number: QTBUG-35383 Change-Id: I04d4b65c27e97a2e9db19541ed46ee1bb202f780 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Fix regression in QML string list concatenationsSimon Hausmann2013-12-111-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | String lists and other QList property types (wrapped as QQmlSequence) should behave like arrays and have the Array prototype. Therefore it should be possible to pass them also as parameter to concat and they get composed correctly, i.e. the individual items get appended instead of the list being appened as one item. In the spec for concat this "special" casing should be applied if the "class internal property" is "Array", and concat appears to be the only place where this check is done. Therefore this patch adds another exception to match the expected behavior in QML and extends the "internal class is Array" meaning to QML list types. This is a regression from Qt <= 5.1.x Task-number: QTBUG-33149 Change-Id: Iab9522ac3c4ae6b746e790a99d87501b1cc1b655 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix data layout of Managed classLars Knoll2013-12-051-4/+4
| | | | | | | | | | | | | | | | The internal class should really be the first member. The flags should go away over time. Change-Id: Id2373a438e2af63a55704819c9dd5569c3895080 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix some header guardsLars Knoll2013-12-043-4/+4
| | | | | | | | | | Change-Id: Ib696c79754cc238e3f4fa356c461a07d9f06d6e7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Encapsulate the current context and fix it's usageLars Knoll2013-12-0428-156/+151
| | | | | | | | | | | | | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove setVTable calls in performance critical areasLars Knoll2013-12-0419-73/+95
| | | | | | | | | | | | | | | | | | | | 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-0438-226/+281
| | | | | | | | | | | | | | | | 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 a bug in the code for evalLars Knoll2013-12-041-5/+5
| | | | | | | | | | | | | | | | | | When eval was being used as an indirect call, the code didn't reset the current context properly before returning from the eval call. Change-Id: Id5c7e9a897101d25593ef0f3b9945adaf19360b3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add a static toArrayIndex() method to QV4::StringLars Knoll2013-12-042-3/+11
| | | | | | | | | | | | | | | | This avoids a hack in QV4::Codegen where we created a V4::String on the stack to convert to an array index. Change-Id: I9a88d45817bbcde52a4037a52fbae299b8c9cb1a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Optimize ExecutionContext::setPropertyLars Knoll2013-12-041-3/+12
| | | | | | | | | | | | | | | | | | | | No need to call hasProperty followed by put. Instead get the property descriptor and call putValue for it. Improves v8-bench by 5%. Change-Id: Ied047126c651c033f7ad4c27deaeec08e5fee7f9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use an internalClass to represent formals and locals in CallContextsLars Knoll2013-12-047-67/+65
| | | | | | | | | | | | | | | | | | | | formals and locals in a CallContext where so far accessed through a linear search in ExecutionContext::getProperty. Fix this by introducing an internalClass for the Function used by the call context. Change-Id: I1141efa12b19d6de4a354bfd6e769c5ffcb8898b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove unused inline wrapperLars Knoll2013-12-044-10/+7
| | | | | | | | | | | | | | | | | | The wrapper method for Function::code() was still there from the times we used C++ exceptions. It's not needed any more, so get rid of it. Change-Id: I2ec25fbca71eeef9d7a94a38b5adfa42e4de3a84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Speedup JS instanceof operatorLars Knoll2013-12-047-58/+50
| | | | | | | | | | | | | | | | Cache the prototype of the functionobject, and inline hasInstance. This removes a vtbl method and speeds things up quite a bit. Change-Id: Ic68f301f7e09763d445a98bffa2cd201303f902e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Initialize variableLars Knoll2013-12-041-0/+1
| | | | | | | | | | Change-Id: I37b14a406ebb9cf87fef20426a94725a2441b7cd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix JavaScript signal connect on alias without other handlersSimon Hausmann2013-11-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The changed handlers for aliases are connected lazily in the engine. QQmlPropertyPrivate::flushSignal is responsible for that and called in other places, for example when installing a onSomeAliasPropertyChanged handler. However we were missing a call to flushSignal when doing onSomeAliasPropertyChanged.connect(...), i.e. using the JavaScript connect API. Task-number: QTBUG-30493 Change-Id: Ia3f008626fd7af3f2cfbdd30d13fb83158bed4d5 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-285-29/+44
| | | | | | | | | | | | | | | | | | | | | | * Resolve lookups in namespaces at compile time and instruct the SSA optimizer to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem) requires neither reading the namespace nor the type. * Add support for accelerated lookup of attached properties Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Prospective fix for crashes when sorting JS arrays on WindowsSimon Hausmann2013-11-271-6/+2
| | | | | | | | | | | | | | | | | | | | std::sort doesn't seem to like sorting empty arrays, so check the size before sorting. Task-number: QTBUG-33658 Change-Id: I841259939ea3bf850d23c129744c322ed46a95fe Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | 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>