aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fall back to the correct methodLars Knoll2015-09-251-1/+1
| | | | | | | | This avoids one indirection in the called code and should allow the compiler to generate slightly better code for this lookup. Change-Id: I6ca8063496015fa74d7f48a7c038dfdd29bb2dd2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Further reduce usage of PropertyLars Knoll2015-09-151-8/+8
| | | | | | | | | Using Property * as return value is something I wanted to get rid of for a long time. As this interferes with storing properties inline in the Object, now is a good time to finally do the work :) Change-Id: I30594bad9a4cea5d9d606ebe02d7f3e707b4263a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Simplify Object::getValueLars Knoll2015-09-151-4/+8
| | | | | | | | | | 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>
* CleanupsLars Knoll2015-09-151-31/+25
| | | | | | | | | | | There's only one place where we need to resize our member data, namely when we call setInternalClass() on an object. In addition, encapsulate the access to the memberdata better in preparation for inline property data later on. Change-Id: Ia34d0253d5d1792f1d7c4981556d78375fa7a755 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Cleanup usage of ExecutionEngine::currentContextLars Knoll2015-09-151-7/+7
| | | | | Change-Id: Ic79d6da162375928ec25871cd0341daeab6483d2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move the StringValue members of ExecutionEngine onto the JS stackLars Knoll2015-06-101-1/+1
| | | | | Change-Id: Ib55c05f1730b7659e2f6fee7e1fa79c10c759167 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move more objects from the v4 engine to the js stackLars Knoll2015-04-241-3/+3
| | | | | | | Convert most of the prototype objects in the v4 engine. Change-Id: I365f290493c20973bc991b6a383649836e42a16a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move exceptionValue and globalObject from the Engine onto the JS stackLars Knoll2015-04-241-7/+7
| | | | | | | | | We'll need to move all GC'ed objects currently stored in ExecutionEngine onto the JS stack for easier management in a new garbage collection scheme. This is the start of that change. Change-Id: Ib3ad8e846875dade8a807ea79f063173d40e4aad 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>
* Rename Heap::Base::as() to cast()Lars Knoll2015-04-211-3/+3
| | | | | | | | The as() methods in other places to dynamic type checking, whereas cast() methods are basically the same as a static_cast. Change-Id: Iacd0174824b41b8fad05d6b55b1e62e3b44a31db Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* More cleanupsLars Knoll2015-04-211-7/+7
| | | | | | | | 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>
* Get rid of asManaged()Lars Knoll2015-04-211-15/+15
| | | | | Change-Id: I853417fdf1cc339f7d43a006c20e1626b6bfb288 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Further cleanupsLars Knoll2015-04-161-1/+1
| | | | | | | | | The get and getIndexed vtable methods should take a const Managed pointer. Start cleaning up the asFoo() methods in Value and Managed by removing asArrayObject() and asErrorObject(). Change-Id: Ibd49bf20773ef84c15785b7ac37a7bc9fd4745d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Wrap members in Object in a Heap::PointerLars Knoll2015-03-201-3/+3
| | | | | Change-Id: I0d132592487255027c215da21fbec15b23b00624 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>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-99/+99
| | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use QV4::ScopedObject typedef instead of actual typeOleg Shparber2015-01-031-1/+1
| | | | | Change-Id: I0b68c534ea513a7c230b12114f6b42b069f9864b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use QV4::ScopedString typedef instead of actual typeOleg Shparber2015-01-021-1/+1
| | | | | Change-Id: I64ecbf6cea463387a70e909ecc5f9165d22a7b0f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Return a Heap object from the getter()/setter() methods of PropertyLars Knoll2014-12-201-8/+8
| | | | | | | | | | We actually need to put the returned value into a ScopedFunctionObject before calling it, as the Property could get deleted during the call leading to a dangling pointer. With a GC that moves objects this will become even more important. Change-Id: I43bece6f80eb3501c1291065846e230a59ae8aed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most of the places where getPointer() is usedLars Knoll2014-12-201-3/+3
| | | | | | | This is no longer required, and simply uglifies the code Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Return Heap::ExecutionContext for currentContext()Lars Knoll2014-12-191-7/+7
| | | | | Change-Id: I155ab996e24d7f36761d2ea62a04774e16469b34 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Return a Heap::Object in Object::prototype()Lars Knoll2014-12-171-74/+75
| | | | | Change-Id: Ice0265ae558ba14497421a5bbf25ee9db76adab5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move prototype back from the vtable into ObjectLars Knoll2014-12-111-3/+3
| | | | | | | | This is the only way we can support a GC that moves objects around in memory. Change-Id: I1d168fae4aa9f575b730e469e762bc5b5549b886 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Better encapsulate access to the global objectLars Knoll2014-12-111-7/+7
| | | | | Change-Id: I8a76112d821cb3fc172ba0d16ee8410d39b4422a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix arrayData accesses in qv4lookup.cppLars Knoll2014-12-101-12/+12
| | | | | Change-Id: I39a2e4f14afda2c0e909584682ef24a8b030025b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove two reinterpret_casts in ObjectLars Knoll2014-11-221-28/+28
| | | | | Change-Id: I921cd8129acb47cffd58be9551a6925c4f296d41 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changed InternalClass to store Identifier* instead of String*Simon Hausmann2014-11-211-4/+2
| | | | | | | | | All members are identifiers anyway, so this gets rid of a ### and also simplifies some of the call sites by removing the need for a scoped string. Change-Id: Ic6b550cdb97afa5a4b0fa7e9b13e7768ed3f6bd8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix run-time string handling with regards to the new heapSimon Hausmann2014-11-211-63/+71
| | | | | | | | | | | | | | | | | Changed runtimeStrings to be an array of Heap::String pointers instead of indirect String pointers. Later that member along with other GC related members will go into a managed subclass. Meanwhile the generated code no more loads String pointers directly but just passes the index into the run-time strings to the run-time functions, which in turn will load the heap string into a scoped string. Also replaced the template<T> Value::operator=(T *m) with a non-template overload that takes a Managed *, in order to help the compiler choose the non-template operator=(Heap::Base *) overload. This allows removing a bunch of Value::fromHeapObject calls. Change-Id: I20415c0549d33cca6813441a2495976b66d4c00e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use the engine instead of the context where it makes senseLars Knoll2014-11-151-5/+3
| | | | | Change-Id: I17a3b6f4b3c076107dc9a8de667ac526566ea6e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: remove Value::toString/Object overloads taking a contextLars Knoll2014-11-151-5/+5
| | | | | Change-Id: I4cb63c3cc4eb9bb81f10f9826f80e581b4e1990c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change signature or runtime methods to take an engine pointerLars Knoll2014-11-121-22/+22
| | | | | | | | | This makes a lot more sense in the long term and is the more maintainable solution, once the GC starts moving objects around in memory Change-Id: I8f327c0f5b5b0af38c5fe1a217852ee8c4a5c2fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert methods in RuntimeHelpers to take an engine pointerLars Knoll2014-11-121-2/+2
| | | | | | | This is safer and cleaner than to use a context pointer. Change-Id: Id5ef4e6667571897cd029125a0bdc18ce299da6d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Data for Number/Boolean/ArrayObject into the HeapLars Knoll2014-11-081-1/+1
| | | | | Change-Id: Ifc1c38b00f1b6b11e69caeb195429e2dd4c05d4f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Begin moving the data out of Managed objectsLars Knoll2014-11-081-4/+4
| | | | | | | | | | | 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>
* Get rid of Members and directly store MemberData::Data pointersLars Knoll2014-11-071-28/+28
| | | | | | | And do the same change for ArrayData. Change-Id: Ia1ae56bd0ff586c9b987e15af7a53f395a37054a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the throw methods from ExecutionContext to ExecutionEngineLars Knoll2014-11-041-3/+3
| | | | | | | | The methods don't require a context, and thus shouldn't be implemented there. Change-Id: If058e0c5067093a4161f2275ac4288aa2bc500f3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't check the this pointer for 0 in member functionsLars Knoll2014-10-271-1/+1
| | | | | | | | | | | | This actually violates the C++ standard that defines that you aren't allowed to call member functions on an invalid object. Instead insert the 0 pointer checks on the caller side where required. Change-Id: I8be3c3831594bb6482e9ef6de6e590ec437ac0f8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework our simple array implementationLars Knoll2014-10-271-7/+8
| | | | | | | | | | | Implement the simple array as a circular buffer instead of an array with head room. This fixes a couple of severe issues with performance and memory management if the array is being used as a queue. Task-number: QTBUG-41421 Change-Id: I146ad8a874407c108aa8fe1eae68e9957e154847 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Convert String to new constructor syntaxLars Knoll2014-07-221-1/+1
| | | | | Change-Id: I07f7667d3d72a7d72e6717d194de8d7b15435777 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-6/+6
| | | | | | | | 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 ExecutionContext to new storage schemeLars Knoll2014-07-221-7/+7
| | | | | Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move ArrayData over to new data layoutLars Knoll2014-07-221-11/+11
| | | | | Change-Id: Ic51f37bea030b196f0fa35ab21e618447edaa25d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move object data into internal structureLars Knoll2014-07-221-39/+39
| | | | | Change-Id: I1fcccd535ed356e736468337bd450270cd290044 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-61/+61
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Garbage collect member dataLars Knoll2014-04-041-3/+3
| | | | | | | | Move the allocated member data into the garbage collected area, so that we can avoid using malloc/free for it. Change-Id: I20625efa67ecd60238568742b74854b0c8cb2e3e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add some specialized lookups for two internal classesLars Knoll2014-03-181-26/+166
| | | | | | | | | | | | Some methods are being called with two different types of objects, alternating between them. This adds a specialized lookup for that case. Speeds up the splay test by ~20%. Also create a clean path to a fallback lookup instead of going back to the generic lookup and then alternating. Change-Id: I3082d70d27155ef5f2cf2b680d227c6dd389956d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup our runtime methodsLars Knoll2014-03-111-2/+2
| | | | | | | | | Move all our runtime methods into the QV4::Runtime struct and give them nicer names without underscores. Sort them logically and remove a few unused methods. Change-Id: Ib69b71764ff194d0ba211aac581f9a99734d8180 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use an array of Value's for Object::memberDataLars Knoll2014-03-071-25/+25
| | | | | | | | | | This cuts the memory required to store properties in an object in half for the common case. Accessor properties require two slots inside memberData, but data properties only one. Change-Id: I0bab1b88ca9ed5930abf065c77c89985b9ed5320 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement Lookup::indexedSetterLars Knoll2014-01-311-0/+57
| | | | | | | | | use this instead of the generic runtime method. This gives around 10% speedup for array heavy Javascript such as crypto.js. Change-Id: Ic8f478c5b18893f2ef49e3f658b1ef24ae22e64f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>