aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fixes for argument objectsLars Knoll2014-01-091-0/+1
| | | | | | | | | 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-091-0/+3
| | | | | | | | 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>
* Move array data into it's own structLars Knoll2014-01-031-62/+65
| | | | | | | First step of separating the array data from Object. Change-Id: I5c857397f0ef53cff0807debdb1e405424e1046a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed::type and some flags into the vtableLars Knoll2014-01-031-6/+9
| | | | | | | | | | | | | 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>
* Remove setVTable calls in performance critical areasLars Knoll2013-12-041-2/+0
| | | | | | | | | | 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-8/+8
| | | | | | | | 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>
* Simplify & speed up function callingLars Knoll2013-11-091-4/+4
| | | | | | | | | 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-1/+1
| | | | | | | | | | | 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>
* Some minor optimizationsLars Knoll2013-10-191-2/+0
| | | | | Change-Id: Ib2e08e7c89ca59a48f8fd52b30981e5d7e60803b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid creating array attributes if possibleLars Knoll2013-10-141-3/+6
| | | | | | | | | | | Holes in arrays should be represented by an empty value, not by creating/setting array attributes. Reason is that the creation is irreversable, and slows down execution. This speeds up crypto.js by 10% Change-Id: I2e5472575479a5f2dbe53f59ecb8ed3aeab1be7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correctly set the vtbl for Boolean and NumberObjectLars Knoll2013-10-111-0/+2
| | | | | | | | Also accept a boolean primitive as input to Boolean.prototype.valueOf() Change-Id: I5b94d8d65b86e26860b9844eb4bf823577c8e924 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Smaller cleanupsLars Knoll2013-10-111-0/+4
| | | | | Change-Id: I0a7eee96ef7c92ad4a3c5963010e3ac66fe6ed3a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-021-17/+1
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: remove inplace operationsErik Verbruggen2013-09-301-5/+0
| | | | | | | | | Inplace operations are expanded when building the IR, so the neither the IR, nor the instruction selection backends or runtime need to handle them. Change-Id: Id01f9544e137dd52364cf2ed2c10931c31ddfff3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove more occurrences of QV4::ValueLars Knoll2013-09-301-13/+27
| | | | | Change-Id: I66c370680d7e6bee2e73a7a940aa96ab4009ec57 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix API for Object::define*PropertyLars Knoll2013-09-281-4/+4
| | | | | | | use ValueRef instead of const Value &. Change-Id: I3fd0ca829870db27f036825d713c53dc0600be07 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::toInteger(double) and related to PrimitiveLars Knoll2013-09-281-1/+1
| | | | | | | Also clean up a few other direct uses of Value Change-Id: Ie27d42c1b31b9e6d16d0a60071cb5e4e1c5b9e8b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-3/+3
| | | | | | | | 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>
* Convert the last methods in qv4object_p.hLars Knoll2013-09-221-7/+9
| | | | | | Change-Id: I4fda83a0832760c277e629d4e658da718c0bf92b Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix some more methods to take ValueRef'sLars Knoll2013-09-221-8/+8
| | | | | | Change-Id: Ia0e30ba98c16e51c9992027c7e5f78d4def8697a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Make sure ScopedArrayObject works as intendedLars Knoll2013-09-221-0/+5
| | | | | | | | We need a proper cast method for the class. Change-Id: I8f2e4b3201d70e8fc90148f1780fd377057947bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Convert Object::inplaceBinOp to be GC safeLars Knoll2013-09-221-7/+4
| | | | | Change-Id: I98a8591f4b556cc1d00271e6b389dc0d2c16e6ec Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert the remaining vtable methods to be GC safeLars Knoll2013-09-221-3/+3
| | | | | Change-Id: I679d1833609c41d71e8436ec0ba8a4624f0c4dd0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert putIndexed()Lars Knoll2013-09-221-3/+3
| | | | | Change-Id: I7d02b0fdf45079d0f7afcfb6d3158dd60cb09f33 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert Managed::put() API to be GC safeLars Knoll2013-09-221-5/+5
| | | | | Change-Id: I09198ce372fa545372db389fac26828d21ad5731 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a StringRef for Managed::get()Lars Knoll2013-09-221-3/+4
| | | | | | | | | also store "toString" and "valueOf" as identifiers in the engine and fix two places where we compared strings the wrong way. Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use StringRef for most methods in ObjectLars Knoll2013-09-221-6/+6
| | | | | Change-Id: I8e2dad0e9e34c5a549952bc0765cd57f6aa8aadf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup Object::define*Property APILars Knoll2013-09-221-7/+5
| | | | | Change-Id: I99125908a9bc1d41a2642c409af9704def7a0832 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a Safe<T> class and start using itLars Knoll2013-09-221-1/+1
| | | | | | | | | | The class denotes objects that are stored safely in areas controlled by the GC. These we can convert fast to a StringRef etc. Change-Id: I6b154eccaefddc42d4fafca55b7ee9e77179830c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Start using StringRef for parameter passingLars Knoll2013-09-221-2/+2
| | | | | Change-Id: If2c41daeda2862cd1162c5da8163a9d62fe4111d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Further work towards an exact GCLars Knoll2013-09-221-4/+11
| | | | | | | | | | | 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>
* Refactor our NaN boxing to be more efficientLars Knoll2013-09-181-6/+1
| | | | | | | | | | | | | * Use a unified way to store all Managed objects inside a Value, instead of distinguishing between strings and other objects. * On 64 bit we store pointers as pointers, so accessing them through Scoped<> objects is cheap. This implies that doubles are now stored in a mangled form (xor'ed with a mask). Change-Id: I582e0fb167a62c0c527c6bfa3452550e37944069 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods to return a Returned<>Lars Knoll2013-09-181-0/+1
| | | | | Change-Id: If294c9c4f574824c308b63a11da1337226180105 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Extend the ReturnedValue mechanism to pointers to Managed objectsLars Knoll2013-09-181-2/+6
| | | | | | | | | | | | | Add a Returned<T> that we can return instead of raw pointers to Managed objects. Start using the Returned<T> for a few methods. Also clean up all our classes to use the Q_MANAGED macro instead of manually defining their vtable. Change-Id: I0a2962e47f3de955cd2cd8474f8f3fcc9e36d084 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-2/+2
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert builtin methods to return a ReturnedValueLars Knoll2013-09-181-4/+4
| | | | | Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert lookups to use ReturnedValueLars Knoll2013-09-181-1/+1
| | | | | Change-Id: Idbcd1fbd2aa43775ce8c1a3d8fac29a6b58b678a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::getIndexed()Lars Knoll2013-09-181-3/+3
| | | | | Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for Managed::get().Lars Knoll2013-09-181-5/+9
| | | | | Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert ReturnedValue into a primitive (typedef to quint64)Lars Knoll2013-09-121-0/+2
| | | | | | | | | | | ReturnedValue is used to return values from runtime methods The type has to be a primitive type (no struct or union), so that the compiler will return it in a register on all platforms. They will be returned in rax on x64, [eax,edx] on x86 and [r0,r1] on arm. Change-Id: I38433e6fad252370dda5dc335d9c5be8f22e8c76 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Continue conversion to using scoped valuesLars Knoll2013-09-111-4/+4
| | | | | | | | | | | This converts all methods in qv4runtime_p.h to not use raw values in arguments anymore. The conversion of return values will be done in a separate commit. Change-Id: Ie6e8f3bed459d09cb831f7f87920b7eada161502 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize String.replace and RegExp.execLars Knoll2013-09-021-3/+2
| | | | | | | This speeds up the v8 regexp benchmark by a factor 2.5 :) Change-Id: Ibd6b18ee28181aa712429cbec4598984e0c69820 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup calls to Object::setPrototype()Lars Knoll2013-09-021-4/+8
| | | | | | | | Rather use the correct internalClass directly when constructing the objects. Change-Id: I8e916f1ce8f83d291c08ca6332fe85b1f57b90b5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move prototype pointer into QV4::InternalClassLars Knoll2013-09-021-2/+7
| | | | | | | | | | | | | 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>
* Remove unused arvument from Object constructorLars Knoll2013-09-021-1/+1
| | | | | Change-Id: I2c26bd8af9b352baed9b84a6b6401633ded4da85 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused constructorLars Knoll2013-09-021-1/+0
| | | | | Change-Id: Ibba688aea338c9f3deb33ae7488b7239ec9a485c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* wince: Build fix, assert() is not present in this platform.Sérgio Martins2013-08-291-0/+5
| | | | | Change-Id: Ib29f1411b9829bc9bf6a94e4fb23a33f955ee1b2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Silence MinGW/gcc-4.8.1 compiler warnings.Friedemann Kleint2013-08-261-53/+63
| | | | | | | | | | | | | | | | | Reorder V4::Object's and V4::Value's private object inline functions such that its definitions are visible from where they are being referenced. qv4object_p.h:418:13: warning: 'uint QV4::Object::arrayLength() const' redeclared without dllimport attribute after being referenced with dll linkage qv4object_p.h:430:13: warning: 'void QV4::Object::setArrayLengthUnchecked(uint)' redeclared without dllimport attribute after being referenced with dll linkage Change-Id: I49a3c9d1da637eaf038f53b29ec13c35253de9f1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize setting new properties on objectsLars Knoll2013-08-181-0/+1
| | | | | | | | | | When a property on an object is set for the first time, this triggers a change in internal class for the object. Record that change in the lookup, and do the same transition in the future. Change-Id: Ib0e8ac61ce3aaecb736532600740cec51996e3d6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Factor out protoHasArray and hasAccessorPropertyPeter Varga2013-08-171-0/+12
| | | | | | | | | | The Object::protoHasArray() function returns true if any object in the prototype chain contains an array element. The new member hasAccessorProperty of the Managed class is set true if the object has any accessor property. Change-Id: Ic29d303eb058d4faed2a47ed8fab18e376ccba68 Reviewed-by: Lars Knoll <lars.knoll@digia.com>