aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4objectiterator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use the correct macro to detect 64-bit value encodingThiago Macieira2015-10-291-1/+1
| | | | | | | We have a macro for it, so let's use it. Change-Id: I1d0f78915b5942aab07cffff140fa0ac23392362 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Simplify Object::getValueLars Knoll2015-09-151-2/+2
| | | | | | | | | | Object::getValue only needs the value/property getter. Because of this it's enough to pass it the Value stored in the member/arrayData and the property attributes. Like this we avoid the reinterpret_cast to a Property pointer. Change-Id: Ib6873526f9db22ed0e607e3617be5729b15271ab Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove type punning from QV4::Value.Erik Verbruggen2015-07-241-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The union in QV4::Value is used to do type punning. In C++, this is compiler-defined behavior. For example, Clang and GCC will try to detect it and try to do the proper thing. However, it can play havoc with Alias Analysis, and it is not guaranteed that some Undefined Behavior (or Compiler depenedent behavior) might occur. The really problematic part is the struct inside the union: depending on the calling convention and the register size, it results in some exciting code. For example, the AMD64 ABI specifies that a struct of two values of INTEGER class can be passed in separate registers when doing a function call. Now, if the AA in the compiler looses track of the fact that the tag overlaps with the double, you might get: ecx := someTag ... conditional jumps double_case: rdx := xorredDoubleValue callq someWhere If the someWhere function checks for the tag first, mayhem ensues: the double value in rdx does not overwrite the tag that is passed in ecx. Changing the code to do reinterpret_cast<>s might also give problems on 32bit architectures, because there is a double, whose size is not the same as the size of the tag, which could confuse AA. So, to fix this, the following is changed: - only have a quint64 field in the QV4::Value, which has the added benefit that it's very clear for the compiler that it's a POD - as memcpy is the only approved way to ensure bit-by-bit "conversion" between types (esp. FP<->non-FP types), change all conversions to use memcpy. Use bitops (shift/and/or) for anything else. - only use accessor functions for non-quint64 values As any modern compiler has memcpy as an intrinsic, the call will be replaced with one or a few move instructions. The accessor functions also get inlined, the bitops get optimized, so in all cases the compiler can generate the most compact code possible. This patch obsoletes f558bc48585c69de36151248c969a484a969ebb4 (which had the exact aliassing problem of the double and the tag as described above). Change-Id: I60a39d8564be5ce6106403a56a8de90943217006 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* Fix some function signaturesLars Knoll2015-06-151-2/+2
| | | | | | | | Add a const several places and pass values by pointer, not reference. This allows us to also get rid of some Scope's. Change-Id: I3b4c29c22511c947d024457e7b8fa2aaa6bec55d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-241-0/+1
| | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* More cleanupsLars Knoll2015-04-211-8/+8
| | | | | | | | Get rid of Value::asObject(), and pass const Managed pointers into some more vtable methods. Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Reduce dependenciesLars Knoll2015-03-201-2/+2
| | | | | Change-Id: I4190c1a6d8a06a130e50cb727feafa7cf11f21cd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Remove all remaining usages of ValueRefLars Knoll2015-01-231-4/+4
| | | | | Change-Id: Icd76d3d03fac2e57530e55f8ec15b97109dcdcbc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of Value::engine()Lars Knoll2015-01-121-6/+6
| | | | | | | | | This method is not guaranteed to return an engine. We're safer checking for the value being an object first and then getting the engine from there. Change-Id: I5c95e675337e545f2421613bd31c42d1e58d6f9a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make Managed inherit ValueLars Knoll2014-12-201-2/+2
| | | | | | | | This completes the first milestone towards being able to move objects across the GC heap. Change-Id: I8e6ce90254ea767188a31f0dc85b133534c87eb0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make Property uses GC safeLars Knoll2014-12-201-9/+8
| | | | | Change-Id: I5aa41a07a2d25e5c8a2d64bfa58a55fcd7aaf77e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix comparisons between Object pointersLars Knoll2014-12-201-3/+4
| | | | | Change-Id: Icedbe32984b5b8bcb807411aa9945436b4bffca9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the way we set the property name during iterationLars Knoll2014-12-201-12/+8
| | | | | | | This was broken due to the new inheritance scheme for Managed Change-Id: Ia9df50e7e655c3a812a01a2c78945e648aa444dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Return a Heap::Object in Object::prototype()Lars Knoll2014-12-171-21/+11
| | | | | Change-Id: Ice0265ae558ba14497421a5bbf25ee9db76adab5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Begin moving the data out of Managed objectsLars Knoll2014-11-081-2/+2
| | | | | | | | | | | We need to move the Data objects out of the Managed objects, to avoid lots of trouble because inner classes can't be forward declared in C++. Instead move them all into a Heap namespace. Change-Id: I736af60702b68a1759f4643aa16d64108693dea2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Let markObjects() operate directly on HeapObjectsLars Knoll2014-11-041-4/+4
| | | | | | | | | This decouples things a bit better and helps moving over to directly store heapobject pointers in other objects. Change-Id: I798f922e018b0a3ca6f8768e4a810187f34d82f6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changed Value to store Managed::Data pointers directlySimon Hausmann2014-11-041-8/+9
| | | | | | | | This is a step towards storing direct heap object pointers for the values on the JS stack, to avoid the costly indirection for data access. Change-Id: Ibb57ed6cf52a7088bbc95ee04ae3a4cb25b8c045 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: Get rid of String and Object pointers in ValueSimon Hausmann2014-11-041-6/+6
| | | | | Change-Id: I4f007d0437c9a5cc79fe35d960d40557366d46fe Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-10-141-11/+20
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4objectiterator.cpp src/qml/jsruntime/qv4objectiterator_p.h src/quick/scenegraph/qsgthreadedrenderloop.cpp Change-Id: Ia54a9acd96530aa6683c228597af0ca25eadec4f
| * Fix crash with foreach on arguments objectSimon Hausmann2014-09-111-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | We call fullyCreate() on the arguments object when it's initialized on an foreach iterator. That itself however might trigger an allocation, which in turn might collect the ForEachIteratorObject, which is missing a "ProtectThis" in its constructor. Change-Id: Ib8f7e39201e727cde91cbbe8a82cba78aa980f0d Task-number: QTBUG-40844 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | 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>
* | Fix Scoped(Value) assignment/construction on 32-bitSimon Hausmann2014-07-221-0/+8
| | | | | | | | | | | | | | Make sure to also set the tag value correctly. Change-Id: I3c6589d25b3a20f255581fb4c9248abfe6af3594 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of all uses of ObjectRefLars Knoll2014-07-221-25/+25
| | | | | | | | | | Change-Id: I705e2362dcda542f56826dadec6b0a6f15848788 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of StringRefLars Knoll2014-07-221-4/+10
| | | | | | | | | | | | | | | | 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 ObjectIterator to new storage schemeLars Knoll2014-07-221-2/+2
| | | | | | | | | | Change-Id: I35631089e6791349ade08c6ed063f1e8ab1bdaea 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>
* Make the Ref classes not template basedLars Knoll2014-02-071-8/+8
| | | | | | | | | | Move to a class hierarchy that mirrors the main classes. This will allow moving functionality over into the Ref classes, as the current Managed classes become mainly something that holds the data. This is required to make objects movable by the GC. Change-Id: I4ca88ab0e5d8c88c8dc56d51937990500a33e0d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the SafeObject classLars Knoll2014-01-311-5/+5
| | | | | | | | Having SafeValue is enough, and we can pass an ObjectRef instead of a SafeObject * for function calls. Change-Id: I4e1435105403f8091b43eeda01303f9602c74235 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Split ManagedVTable into two classesLars Knoll2014-01-211-1/+1
| | | | | | | | 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>
* Don't return a Property pointer in Object::advanceIteratorLars Knoll2014-01-201-12/+14
| | | | | Change-Id: Iac4cb2a2252b18e40455910e51e3e374df7c1e80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove Property * return value from ObjectIteratorLars Knoll2014-01-201-13/+20
| | | | | | | | The added side effect is that the QJSValueIterator is now somewhat faster. Change-Id: I01ba9f2a72a34224f5691130df69a91ab75b72e6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the nonStrictArgumentsObject flag in ManagedLars Knoll2014-01-031-2/+2
| | | | | Change-Id: I4ac58e9d87506ae930c2e44e6089f4af3cd9ccb2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Speed up arguments objectLars Knoll2013-11-221-0/+11
| | | | | | | | | | | | | | 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>
* Refactor marking GC'ed objectsLars Knoll2013-11-051-4/+4
| | | | | | | | | | | 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-1/+1
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some more uses of QV4::ValueLars Knoll2013-10-021-2/+2
| | | | | | | All remaining uses should be GC safe now. Change-Id: I05c962de6ab896f108f70caa1bf937a24e67bfe1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-021-23/+75
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct QV4::Value usageLars Knoll2013-09-281-3/+3
| | | | | | | | 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-1/+1
| | | | | | | | 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>
* Use StringRef for most methods in ObjectLars Knoll2013-09-221-1/+3
| | | | | Change-Id: I8e2dad0e9e34c5a549952bc0765cd57f6aa8aadf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-8/+8
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for Managed::get().Lars Knoll2013-09-181-2/+2
| | | | | Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move prototype pointer into QV4::InternalClassLars Knoll2013-09-021-1/+1
| | | | | | | | | | | | | The prototype is actually the same for most objects. By moving it into the internal class, we can save 8 bytes per object, as well as allowing for some future optimizations. Also fix a bug in the implementation of the Error prototype objects. Change-Id: I4d4b641055f644a9b088f27be34bfdb0446279b7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Restructure source codeLars Knoll2013-08-081-0/+129
Move the v4 engine classes from a subdir of qml/qml into two subdirs (compiler and jsruntime) of the qml module Remove an unsued qv4syntaxchecker class, and move the moth code directly into compiler. Change-Id: I6929bede1f25098e6cb2e68087e779fac16b0c68 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>