aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove prohibited uses of underscore + capital letterThiago Macieira2016-01-081-1/+1
| | | | | | | | | | | | | | All identifiers starting with an underscore and a capital letter are reserved to the compiler and must never be used by the user code. Try to find a better name or, in the worst case, move the underscore to the last position in these identifiers. See commit cf63c63d558227fdbef09699c261560e7474f5ea in qtbase for a case of such an identifier causing a build breakage when the compiler began treating it specially (it was _Nullable). Change-Id: I1d0f78915b5942aab07cffff140f9f39c29f0fdf Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Fix a couple of container detachmentsSérgio Martins2016-01-051-1/+1
| | | | | Change-Id: I0def20d858de7721771702907b7a431b5fb90a1f 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>
* 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-141-2/+2
| | | | | | | | | | ... 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>
* Reduce memory consumption of signal handlersLars Knoll2015-09-251-0/+1
| | | | | | | | | 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>
* Speed up creation of Array literalsLars Knoll2015-09-251-0/+20
| | | | | | | Gives around 10% speedup on the v8 splay benchmark. Change-Id: I47f64e7b73bde59ac3bdd2c94fc199ecfbbf290e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fixes to Error objectsLars Knoll2015-09-221-36/+24
| | | | | | | | | | | | | 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-221-2/+2
| | | | | | | 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-221-26/+26
| | | | | Change-Id: I269c20abdc7f9eb0d71a2d2d485d622b65405762 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Simplify new construction schemeLars Knoll2015-09-221-21/+21
| | | | | | | | 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-221-16/+29
| | | | | Change-Id: I533c7bf90d49aee10b5661fd15a98e013b1169bd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert variant object and ObjectProtoLars Knoll2015-09-221-6/+4
| | | | | Change-Id: I5ee3b453b74f5832997aca68d04979302f9afac5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use the new construction scheme for RegExpObjectsLars Knoll2015-09-221-9/+16
| | | | | | | | 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-221-20/+17
| | | | | Change-Id: I0241efe10d115f8e4a646f840e47e220eb6cfc18 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Inline property data into the objectLars Knoll2015-09-221-11/+7
| | | | | | | | | | | | 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>
* Further cleanupsLars Knoll2015-09-151-2/+2
| | | | | | | Reduce usage of ScopedContext. Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix typoLars Knoll2015-09-151-2/+2
| | | | | Change-Id: I9bfc96096ec5e2c8bd4d3c5bad13fc78ae657962 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Rename currentExecutionContext to currentContextLars Knoll2015-09-151-7/+7
| | | | | | | | Now that the other method is gone, let's use the shorter currentContext Change-Id: I2a6fb3b77f83a1ffdf314ad29081e303d17030ed Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Cleanup usage of ExecutionEngine::currentContextLars Knoll2015-09-151-4/+4
| | | | | Change-Id: Ic79d6da162375928ec25871cd0341daeab6483d2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Store the stack of executioncontext's on the JS stackLars Knoll2015-09-151-24/+21
| | | | | | | | | | | | | | | | This saves one pointer per allocated execution context. Now every execution context that is pushed, allocates two Values on the js stack. One contains the context itself, the other one the offset to the parent context. Things are a bit tricky for with and catch scopes, as those are called from the generated code, and can't open a Scope anymore. In addition, all methods iterating over the js stack frames need to work with ExecutionContext pointers, not ScopedContext's. Change-Id: I6f3013749d4e73d2fac37973b976ba6029686b82 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Reduce usage of context->parentLars Knoll2015-09-151-0/+1
| | | | | Change-Id: I31bb8019783311a7e6065e2aac7fec67c1120ebf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Explicitly push/pop ExecutionContextsLars Knoll2015-09-151-0/+2
| | | | | | | | Avoid the implicit push inside the execution context constructor and rather make this explicit in the code. Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of the qmlContextObject methodLars Knoll2015-09-151-9/+6
| | | | | Change-Id: Id8c0d9e15dd85b3818e283ab6769a49bb2e6d0f7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move the qmlSingletonWrapper method out of the contextwrapperLars Knoll2015-08-201-0/+21
| | | | | | | One more step towards removing the class alltogether. Change-Id: Ic9f6794eb3c5c6605ee43ad23a6d432ebbf321a1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-3/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * Fix warning about returning address of local variable by MSVC2015 in ↵Friedemann Kleint2015-07-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | qv4engine.cpp. qtdeclarative\src\qml\jsruntime\qv4engine.cpp(179) : warning C4172: returning address of local variable or temporary: dummy Disable warning as using the address is intended. Change-Id: Ide894a8dc2fb94f11d0455723c46567c84d91f8d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * V4: track C++ heap usage for Strings in the MemoryManagerErik Verbruggen2015-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and do a GC run when it exceeds a threshold. The issue with Strings is that they hold on to QString instances that store the real content. However, the GC only sees the light-weight JS handle, and doesn't take the size of the backing content into account. So it could happen that big QStrings accumulate in the heap as long as the GC didn't reach its threshold. The newly introduced unmanaged heap threshold is upped by a factor of two when exceeded, and lowered by a factor of 2 when the used heap space falls below a quarter of the threshold. Also grow the threshold if there is enough space after running the GC, but another GC run would be triggered for the next allocation. There is a special case for Heap::String::append, because this method will copy the data from the left and right substrings into a new QString. To track this, append notifies the memory manager directly of the new length. The pointer to the memory manager is stored in Heap::String, growing it from 40 bytes to 48 bytes (which makes it still fit in the same bucket, so no extra memory is allocated). Task-number: QTBUG-42002 Change-Id: I71313915e593a9908a2b227b0bc4d768e375ee17 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * QtQml: Fix const correctness in old style castsThiago Macieira2015-07-091-2/+2
| | | | | | | | | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c958364a2e9859 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Encapsulate and protect all accesses to the vtable of Heap objectsLars Knoll2015-08-101-4/+4
| | | | | | | | | | | | | | | | This is required, so we can safely access the vtable even while we're marking objects during GC. Change-Id: I34f56b61b4bca0d0742faf607eb5ab8b2c30685e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Use the QmlContext to access properties of the scope objectLars Knoll2015-08-101-0/+2
| | | | | | | | | | | | | | | | | | Add some runtime methods to access properties of the scope object directly (using the QmlContext), and generate proper code to call those. Change-Id: I0b29357c9a3b9ad53ba568ec6cb763e8ecb10f21 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add ability to retrieve and use the QmlContext from our generated codeLars Knoll2015-08-101-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Our generated code (JIT and interpreter) should operate on the QML context to retrieve QML related things. That's better than operating on 4 different temps. So this commit introduces the QML context as a temp in the code we generate for QML. The next commits will move things over to use that context with specialized runtime methods instead of using generic subscript/get calls on the different subobjects. Change-Id: Ia05cf339de9cdd23003f35cf78ede17d2590f8de Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Cleanup retrieval of scope and context objectsLars Knoll2015-06-181-1/+13
| | | | | | | | | | Change-Id: I9c6174181f950bc4f829727dc6acdfe82fa4e894 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Clean up ExecutionContext's for QMLLars Knoll2015-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Create a specialized QmlContext instead of re-using a call context with a QQmlContextWrapper as activation object. This saves some memory and opens up the route to getting rid of the context wrapper in a future commit. Change-Id: I1591c73932a08564fddf5137ac05bbc6f31dd4d5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Store a Heap::String pointer in StringObjectLars Knoll2015-06-171-2/+2
| | | | | | | | | | Change-Id: I926c5bb2dd4f1613af6737d4200e568f0ec13d58 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Store rootcontext in a GC safe wayLars Knoll2015-06-171-5/+5
| | | | | | | | | | Change-Id: If81d638c0ccd2b34df918ae5055e309f4eae031f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix some function signaturesLars Knoll2015-06-151-47/+45
| | | | | | | | | | | | | | | | 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 qv4qmlextensionsLars Knoll2015-06-151-13/+1
| | | | | | | | | | | | | | | | It only contained the proto for the value type wrapper. Instead just create it lazily, but reserve space on the js stack for it. Change-Id: I2301549b6dc4007bd5ac848e1dca25aafd583c4a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove explicit marking of the typedarray constructorsLars Knoll2015-06-101-3/+0
| | | | | | | | | | | | | | These objects live on the JS stack and are thus marked implicitly. Change-Id: I8295d8096d0a47861e0092c36e16b95db458de3c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the StringValue members of ExecutionEngine onto the JS stackLars Knoll2015-06-101-85/+49
| | | | | | | | | | Change-Id: Ib55c05f1730b7659e2f6fee7e1fa79c10c759167 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-041-0/+8
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine_p.h src/quick/items/qquickitemsmodule.cpp src/quick/items/qquicktext.cpp src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/tst_qquickwindow.cpp Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
| * Makes it possible to extract all data from a QML DropAreaAleix Pol2015-05-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | There's many types that aren't being covered by DropArea API, such as images. getDataAsString is not acceptable, since fromUtf8 chokes on reading non-utf8. This patch introduces getDataAsArrayBuffer method that won't try to convert the data into a QString and simply pass a QV4::ArrayBuffer, that internally keeps a QByteArray. Change-Id: I65411b3d365ee6c5e13effd9167156771ee08a05 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Fix MSVC warning about unused variableSimon Hausmann2015-05-191-0/+1
| | | | | | | | | | Change-Id: I9b2f21dd7cfc82a9da9aa3e4c60d47fa07fdceaf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * MSVC: Fix compiler warningKai Koehne2015-05-191-0/+1
| | | | | | | | | | | | | | | | | | Fix compiler warning introduced in commit d76921e3082cd31: jsruntime\qv4engine.cpp(1626) : warning C4100: 'v' : unreferenced formal parameter Change-Id: I1f2b74f8e3fb14019f6e28b407d0336b0812c573 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
| * QML: fix mixed debug/release build on OSX.Erik Verbruggen2015-05-121-5/+1
| | | | | | | | | | | | | | | | | | | | Dyld will take the debug library and link it against the release versions of the frameworks. (Using the debug versions is an option to dyld when starting an application.) This requires all symbols in both debug and release libraries in frameworks to be the same. Change-Id: I6d96bcdf8577f1dffc63c508cb7adc0db2acc486 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Add protection against "wrong" marking in debug buildsSimon Hausmann2015-05-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | To protect against situations where we accidentally mark an object that belongs to a different engine - there are many possible entry points - this patch adds an assertion in debug builds for this situation. When it happens, it will point more or less directly to the code that tries to push an object to the wrong JS stack for marking. This helped in the investigation of QTBUG-44895 Change-Id: I311b9ff6d282d52e725044b03a62cd77085536be Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-04-281-1/+9
|\| | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I075e742da8396a268d97d3ab34bcd9e0c0cf001f
| * Merge remote-tracking branch 'origin/5.4' into 5.5Simon Hausmann2015-04-271-1/+9
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp Change-Id: I715b8a78b74cbe0dcaf599367fd6e08af4858e11
| | * QML: do not check stack size if stack grows upRolf Eike Beer2015-04-211-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On architectures where the stack grows upwards (i.e. HP PA-RISC) the stack limit calculation fails because the variables used to check the offset are usually close to the bottom of the stack, which is in this case the origin of the stack grows. Since these machines are a rare obscurity simply assume that everything is fine on these machines. The few people that are indeed running QML on such machines will probably be able configure their stack size properly by default. Task-number: QTBUG-44268 Change-Id: Ia83a39179a0f6e0602ba7a5032d386e12d8d1ba3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Move evalfunction and thrower onto the js stackLars Knoll2015-04-241-5/+3
| | | | | | | | | | | | | | | Change-Id: I3a0abe13d802aff8998d1c64f86b5a8f98c8335f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>