aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
* Reorder members in ManagedVTableLars Knoll2014-01-214-26/+26
| | | | | | | | This is to prepare splitting it up into a several type dependent vtables. Change-Id: I5de8234e40ffc73fab47d43f4a1b30d244fc6ad9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use lookups for indexed accessesLars Knoll2014-01-202-0/+78
| | | | | | | This speeds up reading array data from objects significantly. Change-Id: I5d17a7b3e7583a16dc76d1ee6cbc1d7134e4c2fa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a SimpleArrayData classLars Knoll2014-01-2012-243/+259
| | | | | | | | | | | | | | | | This makes the ArrayData class 'pure virtual'. SimpleArrayData now contains the implementation of simple arrays. This makes the separation between simple and sparse arrays a lot cleaner. It also allows us to move len and offset from the base class into the SimpleArrayClass. This fixes some bugs where we accessed len for sparse arrays leading to some buggy behavior. Added a virtual length() method to ArrayData to query the highes used index in the Array. Change-Id: Iab2ba2a48ebe5b7031759eeb4ebe02b4d86233f0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Save memory on array dataLars Knoll2014-01-2013-226/+340
| | | | | | | | | | | | | | | | | | | | | Store a simple vector of Values in the array data, instead of a Vector of Property's. This halfes the memory consumption on 64bit and simplifies our code. If an indexed property gets converted to an accessor property, we simply convert the ArrayData into a SparseArrayData. Add support in SparseArrayData to allocate double slots (two Value's) to hold a full Property in case someone sets an accessor on an indexed property. Some methods still return a Property*, but this is safe, as only the first Value in the Property pointer will ever get accessed if the Property doesn't contain an accessor. Change-Id: Ic9b0f309b09a2772a328d947a10faaf3be9fe56f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changes to the structure of PropertyLars Knoll2014-01-203-36/+35
| | | | | | | | | | Put the getter into the regular value, and the setter into the next value following. Like this we can compress property data to only use 8 bytes per property for regular properties and simply allocate two slots for accessor properties. Change-Id: I330b95dbd583ebc2658fed79d37ac3b53492c0cd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixes to sparse array handlingLars Knoll2014-01-202-41/+43
| | | | | | | | | | deleting entries in sparse arrays could lead to rather unexpected results where values got moved to wrong indices, as we didn't correctly update the size_left values in the red-black tree. Change-Id: If71fcc04d39f257194394cb4f734d0db14b92b69 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Small bug fixLars Knoll2014-01-201-1/+1
| | | | | Change-Id: I5c670d898cd7a049de6f8a78d966df1c6fbde2c5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix a small bug in queryIndexed() for StringObjectsLars Knoll2014-01-201-3/+3
| | | | | | | | | The string is immutable, thus queries indexing into the string data need to return Attr_NotWritable|Attr_NotConfigurable (see 15.5.5.2 of the ecma spec). Change-Id: I180d983b04a209c29fcd37b11682999b57bc42fe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't return a Property pointer in Object::advanceIteratorLars Knoll2014-01-2013-72/+70
| | | | | Change-Id: Iac4cb2a2252b18e40455910e51e3e374df7c1e80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove Property * return value from ObjectIteratorLars Knoll2014-01-203-17/+25
| | | | | | | | The added side effect is that the QJSValueIterator is now somewhat faster. Change-Id: I01ba9f2a72a34224f5691130df69a91ab75b72e6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* clean up Object::has(Own)PropertyLars Knoll2014-01-205-26/+43
| | | | | | | | | | hasProperty is now implemented by calling hasOwnProperty on the proto chain. In addition, it should be slightly faster and doesn't use API that returns a Property pointer anymore. Change-Id: I6312d83ccfed3f0a1a8ec4c72c436a426d6eab44 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* 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>