aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
* Fix crash related to BoundFunctionsFrank Meerkoetter2015-11-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | This fix prevents the crash documented in QTBUG-49076. To quote Erik on the cause of the crash: Call stack is probably: FunctionPrototype::method_bind -> BoundFunction::create -> mm::allocObject -> BoundFunction::BoundFunction -> Heap::FunctionObject -> (Scoped)FunctionObject::init -> engine::newObject -> ... -> mm::allocObject The call to Heap::FunctionObject in BoundFunction is the call to the parent class constructor, which causes an allocation. But at that point, BoundFunction's target is still zero-initialised (the real initialization happens first thing *after* the parent class' constructor is called). Change-Id: If256f59168867cba9c886642ebaacb1d56801da4 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use the correct macro to detect 64-bit value encodingThiago Macieira2015-10-292-5/+5
| | | | | | | We have a macro for it, so let's use it. Change-Id: I1d0f78915b5942aab07cffff140fa0ac23392362 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Fix qmlcompiler build on win32.Erik Verbruggen2015-10-291-2/+2
| | | | | Change-Id: Ie1239b6ba5f5ba77dd081ad6392d962822d124dc Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QML: Fix typeof context property.Erik Verbruggen2015-10-273-0/+32
| | | | | | | | This was missing from f21e8c641af6b2d10f0d7e7e0fc6a755dab3673c. Task-number: QTBUG-48524 Change-Id: I5cc6a979d965a1ef6b7fbc916a7ca9df868b459a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QML: Sanitize reading environment variables.Friedemann Kleint2015-10-221-1/+1
| | | | | | | | | | | Where possible, use qEnvironmentVariableIsSet()/ qEnvironmentVariableIsEmpty() instead of checking on the return value of qgetenv(). Where the value is required, add a check using one of qEnvironmentVariableIsSet()/Empty(). Change-Id: Ia8b7534e6f5165bd8a6b4e63ccc139c42dd03056 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* JS: Math.random(): fix range to not include 1.0.Erik Verbruggen2015-10-201-2/+7
| | | | | | | | | | | [15.8.2.14] specifies that the Math.random() returns a number greator or equal to 0, but less than 1. Libc however defines it to be less than or equal to 1, so we have to divide the returned value by RAND_MAX+1. Of course, in order to do this, we need to widen them to 64bits ints. Task-number: QTBUG-48753 Change-Id: Ia4d808014dbf2a5575f4226779214bf0d5981f49 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Properly resolve the context to create mutable bindings onLars Knoll2015-10-201-4/+13
| | | | | | | | | This fixes a regression introduced in 5.5, where eval() calls in strict mode would still modify outer properties. Change-Id: I3ab70b45217eea16da68a4537e3c107b76794f2c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Fix a crash when copying array dataLars Knoll2015-10-201-1/+1
| | | | | | | | | | | Regression from 5.5. d()->arrayData->alloc can be larger, but never smaller than the allocation of the other's array data. Change-Id: I7d2265768f9d6e6298bfbba0d674a4d0e642422f Task-number: QTBUG-48727 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Nikita Krupenko <krnekit@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Only set V4 debugger when service is enabledUlf Hermann2015-10-151-1/+0
| | | | | | | Otherwise different debug services could steal each other's debugers. Change-Id: Ic0a50333d21c7d20a7124240ea598f8446400ae3 Reviewed-by: hjk <hjk@theqtcompany.com>
* QmlDebug: Split QV4::Debugging::Debuggerhjk2015-10-144-31/+44
| | | | | | | | | | ... into a pure interface and a QV4::Debugging::V4Debugger implementation. This is in preparation of a second implementation of this interface to be used with 'native mixed' debugging. Change-Id: I3078dcfe4bdee392a2d13ef43a55ca993e7b88d8 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* Libraries: Fix single-character string literals.Friedemann Kleint2015-10-132-3/+4
| | | | | | | Use character literals where applicable. Change-Id: I294fc4cb5cbbd23df9735ba2b398118f37cbe08a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-0645-0/+495
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-022-2/+11
|\ | | | | | | | | | | | | Conflicts: src/quickwidgets/qquickwidget.cpp Change-Id: I3e2326bc86a9d3adaafbe3830b75ce9afa81c45b
| * Fix compilation with ICC on WindowsThiago Macieira2015-09-022-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QV4::Managed is not copyable and its default constructor is deleted. However, it and classes derived from it are exported, which on Windows means the compiler will instantiate all possible functions and add to the DLL. ICC on Windows, unlike MSVC, attempts to instantiate the default constructor of the derived classes (like CallContext) and then the build fails due to the deleted Managed() constructor. Instead, use V4_MANAGED to mark each and every managed class as non- default-constructible and non-copyable. Only one note: the V4_MANAGED macro in QV4::Managed itself takes different parameters, so it needs to be slightly different. Task-number: QTBUG-48063 Change-Id: I42e7ef1a481840699a8dffff140007c65a7a35db Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | CleanupsLars Knoll2015-09-251-32/+22
| | | | | | | | | | Change-Id: I68b5253eafc0f3786e4aa671b388a8f4c78c9ed7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Reduce memory consumption of signal handlersLars Knoll2015-09-254-8/+23
| | | | | | | | | | | | | | | | | | Move the connect/disconnect methods for signal handlers into their prototype, so that we don't need to define them per instance anymore. Change-Id: Iac1e6d1dd7bce86730dbb6c51e2c3f79713641f7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Smaller cleanupsLars Knoll2015-09-252-12/+14
| | | | | | | | | | Change-Id: I68f7ea476cb00a571908b7ec0a036f8517b091d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Fix SparseArray::deleteNodeRon Hashimoto2015-09-251-7/+4
| | | | | | | | | | | | | | | | | | SparseArray::deleteNode should modify size_left only if the deleted node had a right child Change-Id: I0f3504a5c6568dbd9e392bf83eaf3f9780eb2b84 Task-number: QTBUG-46022 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | 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>
* | Cosmetic improvements to marking of objects during GCLars Knoll2015-09-251-4/+5
| | | | | | | | | | Change-Id: I79a7093c7086ea7f34252f097f18fe7c835053aa Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Speed up creation of Array literalsLars Knoll2015-09-253-9/+22
| | | | | | | | | | | | | | Gives around 10% speedup on the v8 splay benchmark. Change-Id: I47f64e7b73bde59ac3bdd2c94fc199ecfbbf290e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add method to convert identifiers back into QV4::String objectsLars Knoll2015-09-253-1/+20
| | | | | | | | | | | | | | | | Allocating a new String for the Identifier is wasting both memory and CPU. Let's rather extract it from the IdentifierTable. Change-Id: Ibb9b2ac9775fefce74602d6954586195cdd5814e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Speed up QQmlEngine constructorLars Knoll2015-09-252-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Freezing the global object using a script is pretty slow, esp. given that the script needs to be compiled as well. Rather do it programmatically. The old code actually had a bug that would only cause the global object to be frozen, not it's children. The new code fixes this, but doesn't completely freeze the objects. Instead it makes all the existing properties of the global object and it's children readonly, but still allows extending existing objects with new properties. Change-Id: I0d7331cdc89a0ac717b8ed3b1a490b2a3742de02 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix read of uninitialized value (undefined behavior)Thiago Macieira2015-09-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 92836d052efb6d8073136e8507083f93fb60bb80 fixed the type punning but introduced undefined behavior on 32-bit systems. Detected by GCC 5.2 qv4value_p.h:96:55: error: ‘v.Qti386::QV4::Value::_val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] qv4scopedvalue_p.h:199:15: note: ‘v.Qti386::QV4::Value::_val’ was declared here Trace: starting at qv4scopedvalue_p.h:199 Value v; v = o; => Value &operator=(Heap::Base *o) { setM(o); => Q_ALWAYS_INLINE void setM(Heap::Base *b) { quint32 v; memcpy(&v, &b, 4); setValue(v); } => Q_ALWAYS_INLINE void setValue(quint32 v) { setTagValue(tag(), v); } => Q_ALWAYS_INLINE quint32 tag() const { return _val >> 32; } The call to tag() reads from _val before it is initialized. Up until C++11, uninitialized variables simply had an indeterminate value. Starting with C++14 (see N3914, resolution of DR1787), reading that variable not as an unsigned char has undefined behavior. See 8.5 [dcl.init] p12: ... When storage for an object with automatic or dynamic storage duration is obtained, the object has an indeterminate value, and if no initialization is performed for the object, that object retains an indeterminate value until that value is replaced (5.18). [...] If an indeterminate value is produced by an evaluation, the behavior is undefined except in the following cases: [list of cases that use unsigned char] Change-Id: I42e7ef1a481840699a8dffff1406852f2badabca Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* | Fixes to Error objectsLars Knoll2015-09-225-138/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | Move the name and message property into the prototype as per JS spec. Only define the message property in the object itself if the value used for construction is not undefined. In addition, clean up creation of the objects and centralize it in a few template methods. Change-Id: I014017b710575b30bf4e0b0228111878f5c73b9a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move remaining objects to new constructor syntaxLars Knoll2015-09-2211-67/+35
| | | | | | | | | | | | | | Also disable the old way of constructing objects. Change-Id: Ib4e69087cd563ae1481da116d6caf97876239798 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Convert FunctionObjects to new allocation syntaxLars Knoll2015-09-2211-67/+58
| | | | | | | | | | Change-Id: I269c20abdc7f9eb0d71a2d2d485d622b65405762 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Simplify new construction schemeLars Knoll2015-09-229-27/+56
| | | | | | | | | | | | | | | | Declare the default prototype and internal class in the class itself. Change-Id: I08c2b42aa61a886580061336ae60cef8dedc0f03 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | move error objects over to new construction schemeLars Knoll2015-09-224-94/+119
| | | | | | | | | | Change-Id: I533c7bf90d49aee10b5661fd15a98e013b1169bd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Convert variant object and ObjectProtoLars Knoll2015-09-224-14/+12
| | | | | | | | | | Change-Id: I5ee3b453b74f5832997aca68d04979302f9afac5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Use the new construction scheme for RegExpObjectsLars Knoll2015-09-225-56/+46
| | | | | | | | | | | | | | | | Gives around 10% speed improvement on the v8 regexp benchmark. Change-Id: Iad37bcbc79ccbfb92f65852b660364c919862a75 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move more objects over to the new allocation schemeLars Knoll2015-09-2211-85/+66
| | | | | | | | | | Change-Id: I0241efe10d115f8e4a646f840e47e220eb6cfc18 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Inline property data into the objectLars Knoll2015-09-224-26/+62
| | | | | | | | | | | | | | | | | | | | | | | | Append the part of the objects property data that is known ad instantiation time to the object itself and by that avoid creating a separate MemberData. Saves some memory and should speed up object creation. Currently implemented only for Object and ArrayObject. Change-Id: I7693bf2f3a28fb718522398ebb94ac115e021fa4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add DataView unsigned integer getter/setters with correct casingsNobuaki Sukegawa2015-09-211-6/+14
| | | | | | | | | | | | | | | | | | | | According to the spec, unsigned integer getter/setters should be cased "Uint". http://www.ecma-international.org/ecma-262/6.0/#sec-dataview.prototype.getuint8 For backword compatibility, this diff does not remove mis-cased methods. Change-Id: I8e65dca12b8358376dbb3c519246c8abca0d47b0 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Remove getterFrank Meerkoetter2015-09-162-3/+2
| | | | | | | | | | | | | | | | Emphasize this is something internal Change-Id: Ifd92be0d25d7e0767819b8162c2602608916bc10 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Adapt to the new QV4::MemberData APIFrank Meerkoetter2015-09-161-2/+1
| | | | | | | | | | | | | | | | The size of the allocation can not change to an exact size'd alloc() can be used here. Change-Id: I479997efe8af15932d424019237683d89e945ed9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Adapt to the new QV4::MemberData APIFrank Meerkoetter2015-09-161-1/+1
| | | | | | | | | | | | | | This allocation doesn't grow so use an exact sizes one. Change-Id: Ib0117b3a1932bcdc26a4aac6759a08db43a90225 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of propertyAt in ObjectLars Knoll2015-09-153-17/+53
| | | | | | | | | | Change-Id: I3022b3c5c1ae90530ef5ca88e0b88a2fd1102e73 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Replace __getPropertyDescriptor__ with a getValueOrSetter callLars Knoll2015-09-153-37/+46
| | | | | | | | | | | | | | This one returns a pointer to a Value instead of a property. Change-Id: I66e16526cc61d1ff3564cae983881c30b9106b54 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Don't return Property * from ArrayData::insertLars Knoll2015-09-153-10/+9
| | | | | | | | | | Change-Id: Ibabee04a17f5b2f3ba993cd61cbe64c897031f71 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Further reduce usage of PropertyLars Knoll2015-09-154-30/+35
| | | | | | | | | | | | | | | | | | 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-156-20/+24
| | | | | | | | | | | | | | | | | | | | 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>
* | Simplify Object::putValue()Lars Knoll2015-09-153-4/+7
| | | | | | | | | | Change-Id: I1cc43f0081f63aed27c82875192e0f415ec995d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | CleanupLars Knoll2015-09-153-8/+8
| | | | | | | | | | | | | | | | The property is always value based, so there's no need to cast to a Property* when returning it. Change-Id: I095a940197aedac90ad9f5491ccb9af0ca53d722 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Encapsulate the remaining direct accesses to Object::memberDataLars Knoll2015-09-152-6/+18
| | | | | | | | | | Change-Id: I17f202cf58dc355524b89a456e6722d41e444ca1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | CleanupsLars Knoll2015-09-159-80/+79
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Further cleanupsLars Knoll2015-09-155-11/+11
| | | | | | | | | | | | | | Reduce usage of ScopedContext. Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Don't compute the QString whenever we need to know the v4 string lengthAleix Pol2015-09-151-1/+1
| | | | | | | | | | | | | | The length is already computed in the len attribute anyway. Change-Id: I1a406175edd9127b9b425eb21703e2184f5a3cd7 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Fix typoLars Knoll2015-09-152-4/+4
| | | | | | | | | | Change-Id: I9bfc96096ec5e2c8bd4d3c5bad13fc78ae657962 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Rename currentExecutionContext to currentContextLars Knoll2015-09-1510-50/+50
| | | | | | | | | | | | | | | | Now that the other method is gone, let's use the shorter currentContext Change-Id: I2a6fb3b77f83a1ffdf314ad29081e303d17030ed Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>