aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v8/qv8engine.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Reserve a double slot for accessor propertiesLars Knoll2014-03-071-2/+4
| | | | | | | | | | Reserve two slots in the internal class for accessor properties. This opens up reducing the default storage required per data property to one Value. In practice this implies cutting the required memory in half. Change-Id: Ifed897852bbdfd810018f0d6b049fca6690ead2c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Reduce memory usage for object literals with integral keysSimon Hausmann2014-02-161-2/+7
| | | | | | | | | | | | Be more aggressive about using sparse arrays for object literals than for regular array handling, to reduce the memory usage in this use case. The current heuristic is that indices over 0x1000 switch to sparse, which means a simple { "3000" : "test" } creates a long vector instead of a sparse array. Task-number: QTBUG-36803 Change-Id: Id05c76f0f597cd016114cd27ec54effbebe26e48 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change virtual methods in ArrayData to take Object pointerLars Knoll2014-01-241-4/+4
| | | | | | | | | Pass a pointer to the underlying object instead of the ArrayData to virtual methods that modify the arrayData. This prepares for allocating the ArrayData together with the array itself. Change-Id: I66fe187f8b1e4d382ab243a518dbde5f18a1d16d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a SimpleArrayData classLars Knoll2014-01-201-12/+6
| | | | | | | | | | | | | | | | 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>
* Allow assignment of a QML Locale object to a C++ QLocale property.Mitch Curtis2014-01-141-1/+4
| | | | | | | Task-number: QTBUG-36125 Change-Id: I58454db0c47684aed3e95c52a8135fd5fd6bf2f9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: change signature of Object::insertMember()Lars Knoll2014-01-091-2/+3
| | | | | | | | | | | | 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>
* Rework array handling for JS objectsLars Knoll2014-01-091-11/+15
| | | | | | | | | 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>
* Clean up handling of illegal names and enable in new compilerSimon Hausmann2014-01-061-3/+2
| | | | | | | | | | Access to the identifier hash may not be thread-safe from the loader thread, so use a QSet copy instead (which is cheap because we don't detach). This also enables the checking for illegal types again. Change-Id: I8c3ec1fd0fc01cce3269e206f479a90bdbbc89dd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move array data into it's own structLars Knoll2014-01-031-8/+8
| | | | | | | First step of separating the array data from Object. Change-Id: I5c857397f0ef53cff0807debdb1e405424e1046a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use qCpuHasFeature because the check can be optimized out of existenceThiago Macieira2013-12-101-1/+1
| | | | | | | | | qCpuHasFeature also checks the compiler flags of this particular build. If the feature was enabled by the compiler in this .cpp, then no runtime check is performed and the test becomes an unconditional true. Change-Id: Ibb7d333e59a0f4ed06b7d0056547177fd69658a0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-3/+3
| | | | | | | | | | | 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>
* For x86 builds, try to detect SSE2 availability early and bail outSimon Hausmann2013-11-091-0/+7
| | | | | | | | | | ...instead of potentially just crashing. This is for the rare case of somebody trying to run a QML2 based application on a Pentium 3 from before 2001 or older. Change-Id: Ia5606fe28ef5579654ec939c86830af70dbb84d7 Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Lars Knoll <lars.knoll@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>
* Smaller cleanupsLars Knoll2013-10-111-13/+25
| | | | | Change-Id: I0a7eee96ef7c92ad4a3c5963010e3ac66fe6ed3a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct usages of Managed pointersLars Knoll2013-10-111-3/+3
| | | | | Change-Id: I32f61b7919797eef51a8705695787175b76244c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-021-4/+3
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most uses of Value from qml/qmlLars Knoll2013-09-301-5/+5
| | | | | Change-Id: I409a8505a9e01f86d777bc694d24516d1c8f0c4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove Value::fromString()Lars Knoll2013-09-281-2/+2
| | | | | | | | replaced with call to the GC safe ExceutionEngine::newString() method. Change-Id: I7258296e75ca724ff42b94a0d147bc33a05f8f68 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct QV4::Value usageLars Knoll2013-09-281-2/+2
| | | | | | | | Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make API of QV4::JsonObject GC cleanLars Knoll2013-09-281-9/+13
| | | | | Change-Id: Ie7f2d63402c9486b30caf5866af8c747026c091d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods in QV8EngineLars Knoll2013-09-261-11/+19
| | | | | Change-Id: I5b059b41842b4a6d9541525b3955d2b64c0011c3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move more API over to use ValueRefLars Knoll2013-09-261-84/+89
| | | | | Change-Id: I372f1f3e3e78d45912a913f437e622e0acfc9646 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make parts of qv8engine_p.h GC safeLars Knoll2013-09-261-6/+8
| | | | | Change-Id: Iaa15423cedc307a09b3cd7287272d93d7a604caf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-5/+10
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix cases where mark() would access uninitialized memoryLars Knoll2013-09-221-8/+12
| | | | | Change-Id: I4e07e20d30ba57759a0ece1c298a02b098718b33 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert Managed::put() API to be GC safeLars Knoll2013-09-221-2/+4
| | | | | Change-Id: I09198ce372fa545372db389fac26828d21ad5731 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a Safe<T> class and start using itLars Knoll2013-09-221-1/+3
| | | | | | | | | | 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>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-221-2/+1
| | | | | | | | | | emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Further work towards an exact GCLars Knoll2013-09-221-4/+6
| | | | | | | | | | | 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>
* Convert more methods to return a Returned<>Lars Knoll2013-09-181-11/+14
| | | | | Change-Id: If294c9c4f574824c308b63a11da1337226180105 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert a few more methods in ExecutionEngine to use protected pointersLars Knoll2013-09-181-7/+7
| | | | | Change-Id: I2e6b1b9dff52bbd16f35a00152c9ac557f8346eb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-88/+81
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods to use ReturnedValueLars Knoll2013-09-181-3/+4
| | | | | | | Change Exception.value() and a few other places. Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::getIndexed()Lars Knoll2013-09-181-5/+14
| | | | | Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-1/+1
| | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Require a ValueScope for ScopedCallData as wellLars Knoll2013-09-181-1/+2
| | | | | | | | This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue when converting to String or ObjectLars Knoll2013-09-121-1/+1
| | | | | | | | Also rename Value::toQString() to Value::toQStringNoThrow(), and add a throwing toQString() method for JS use. Change-Id: I821b33fc61abb7d08839df965fd337685f61a545 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move CallData onto the JS stackLars Knoll2013-09-111-4/+5
| | | | | Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make it possible to handle pointers to QObject derived in QML.Stephen Kelly2013-09-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This way, properties of QObject derived types can be read in QML code for example: Q_PROPERTY(MyObject* obj READ obj CONSTANT) Previously, only QObject* types could be read by QML: Q_PROPERTY(QObject* obj READ obj CONSTANT) This meant that multiple properties and methods had to be created for classes which were relevant to both QML and non-QML code. This patch lifts that restriction. As a consequence, we can also remove a Q_EXPECT_FAIL from the qqmllanguage unit test. That test was introduced in commit 92562eacbc3c (Allow signal parameters which are custom QML object-types, 2012-07-13) to document knowledge of the limitation while fixing it as much as possible. Task-number: QTBUG-26662 Change-Id: Ic85fa73c6f3655189438ec509765bae2eab9993a Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move prototype pointer into QV4::InternalClassLars Knoll2013-09-021-2/+2
| | | | | | | | | | | | | 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>
* change calling convention for JS function callsLars Knoll2013-09-021-2/+4
| | | | | | | | | | | | This allows faster pass through of the data if we have nested calls. Also make sure we always reserve at least QV4::Global::ReservedArgumentCount Values on the stack to avoid stack corruption. Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the JS Api into it's own folderLars Knoll2013-08-081-1/+1
| | | | | Change-Id: I7ef371ff929387097862121b73a7a5863b51ccf1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix qqmlecmascript::sequenceConversionThreads with aggressive GCSimon Hausmann2013-07-011-4/+4
| | | | | | | | | | | During the deserialization of a sequence, make sure that when the collector runs during the filling of the array, that partially filled array is marked properly. Fixed setting of arrayDataLen in other similar places as well. Change-Id: I19926f733c7c7d1398b11b48c1c37f43e7099ead Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert QV8Engine::illegalNames() to use the identifier hashLars Knoll2013-06-281-2/+3
| | | | | Change-Id: I436c2a17e417cb311f10290a4cc6e5b728b4b7be Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the context argument from Managed::callLars Knoll2013-06-221-1/+1
| | | | | Change-Id: I0895f9a94af47c8aab1dc93579921737e9516f7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove context parameter from Manged::put.Lars Knoll2013-06-221-1/+1
| | | | | Change-Id: Ib99e726ffbb20463d45a8444b4fbdfe32cd6dbef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove context parameter from Managed::getIndexedLars Knoll2013-06-221-2/+2
| | | | | Change-Id: Ibc6271dbe789ef5ed063d8650ee36978f7c18021 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix conversion of variantlists to ArrayObjectsLars Knoll2013-06-211-1/+3
| | | | | | | Fixes a crash in the qquickmultipointtoucharea test Change-Id: Ic1ca5220e5e7a569e3cc499ba120296fb885d6c0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix some bugs related to QJSValueLars Knoll2013-06-141-1/+1
| | | | | | | | | | | | | Give PersistentValuePrivate a virtual destructor. This makes sure we properly delete things as QJSValuePrivate inherits from it. Also always access the QV4::Value through getValue() before passing it off into the JS engine, so that we properly convert a QString based JSValue into a QV4::String. Change-Id: I4c6cb8d0e043e0d7f66fa545abe898e189051049 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>