aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup: Remove last traces of QQmlScriptSimon Hausmann2014-03-191-2/+2
| | | | | | | | | | What remains is the code for removing .pragma from script source code (and replacing it with white-space to preserve line/column numbers). The previous code even returned the value of the pragmas, but for the remaining caller sites that value isn't used, so we can just return void. Change-Id: I16db15da236970660b817d6c4493005365a7a1af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up script importsSimon Hausmann2014-03-192-8/+5
| | | | | | | | | | Move the .pragma and .import script extraction out of qqmlscript and into qqmlirbuilder, where it can populate a QQmlIR::Document. Changed the script part of the type loader to use that, which also allowed eliminating the m_source member and m_metaData. Change-Id: Icc64d219fff5666679a02e6afda73f7edfca132b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use Q_ASSERT instead of assertLars Knoll2014-03-193-11/+8
| | | | | Change-Id: I6185b59a7dfd6977ce82581ab4385e07d78f13f6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixes to for...in statementLars Knoll2014-03-191-1/+1
| | | | | | | | | | | Properly convert the argument to an object if it's not null or undefined as mandated by the standard. Add a similar test case for the with statement. Change-Id: Idd8e245e8dae4803eb0e2010e3d43bb912670444 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize construction of SimpleArrayDataLars Knoll2014-03-193-2/+5
| | | | | Change-Id: I7f8a0ac8a368af23534378e8c31d820b3b9f1f4c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Small optimization to RegExpLars Knoll2014-03-183-1/+14
| | | | | | | | | Also add markObjects() calls to all the identifiers we keep around in the engine. It's probably pure luck this hasn't caused any issues until now. Change-Id: Ie31d19793efa53867e4e240ba548070dcde32ec1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add some specialized lookups for two internal classesLars Knoll2014-03-183-28/+187
| | | | | | | | | | | | 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>
* Minor optimization: Avoid some QString constructorsLars Knoll2014-03-181-1/+1
| | | | | | Change-Id: I51af67e9ba4076216142e05b5de5b2e8f8c526bc Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix crash when calling concat on an empty arraySimon Hausmann2014-03-151-0/+2
| | | | | | | | | Make sure to create the array data. The earlier called copyArrayData() doesn't have to do that. Task-number: QTBUG-37506 Change-Id: I6671769fcd471234c4c2eaa1614aa61266db0e5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix CompiledData::CompilationUnit object leakLiang Jian2014-03-131-5/+0
| | | | | | | | Don't ref CompiledData::CompilationUnit in constructor of ScriptFunction since its has been referenced in its base class Change-Id: I9ad2d6e190c2ac11de4ccd63015c81d2dead3971 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow maximum block size to be specified as an environment variable.Michael Brasser2014-03-131-3/+11
| | | | | | | | A smaller maximum block size helps limit RAM usage on constrained systems, at the cost of more frequent garbage collection. Change-Id: Iba07d9cc628e3178dfaad35664c631844540bc9d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't crash when a signal/slot connection outlives the engineSimon Hausmann2014-03-121-2/+7
| | | | | | | | | | In the test case in the bug, the signal was emitted from the QApplication destructor (somewhere from the qpa plugin when the platform windows were destroyed) Task-number: QTBUG-37351 Change-Id: Ieec59e12be10bab1428743b80eecdf22ef9d8bf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove redundant QQmlBinding members.Michael Brasser2014-03-111-3/+4
| | | | | | | | | This reduces the size of QQmlBinding by 12 bytes. Task-number: QTBUG-37134 Change-Id: Id55257edec8cee88d863374e8a96d7eebbeaf523 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix linkingSimon Hausmann2014-03-111-1/+1
| | | | | | | Add some missing exports Change-Id: I0c250231e902b6efeda257951ee5653ea363e288 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Allow detaching V4 debuggers in agent destructorUlf Hermann2014-03-111-0/+3
| | | | | | | | We don't know in which order the QML engines and the debug service are deleted on shutdown. Change-Id: I9d23b3c88eee125a93c5b0f8ea85466013233737 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup our runtime methodsLars Knoll2014-03-1116-433/+420
| | | | | | | | | 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>
* Fix copying of Property'sLars Knoll2014-03-1012-45/+67
| | | | | | | | | | Data properties don't contain valid data in the set field if they are being stored in Objects. Thus we should never access that field unless we are dealing with accessor properties. Change-Id: I19dcbaee7ebd042ae24387f92a93571d75ca578a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 JIT: enable JIT on win64.Erik Verbruggen2014-03-081-1/+1
| | | | | Change-Id: I640d507c33fd4c4df6d6284b473df5cea9e5c4b4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use an array of Value's for Object::memberDataLars Knoll2014-03-0710-95/+81
| | | | | | | | | | 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>
* Reserve a double slot for accessor propertiesLars Knoll2014-03-073-43/+114
| | | | | | | | | | 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>
* Move some methods from ExecutionContext to CallContextLars Knoll2014-03-073-42/+35
| | | | | | | | This is where they really belong. Slightly simplifies and cleans up the code. Change-Id: Ib5782c1f57c761c46f4bc52c3d496220299f8ac9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Better way of retrieving the prototype property for FunctionObjectsLars Knoll2014-03-074-65/+31
| | | | | | | | | Make sure FunctionObjects always have the prototype property at index 0. This way we can speed up the instanceOf operator even more, and at the same time save 16-28 bytes of memory per FunctionObject. Change-Id: I8527bc8f9dc7b04a9db8395b5f05bab47ddc21ce Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the name member of FunctionObjectLars Knoll2014-03-074-13/+29
| | | | | | | | The data is anyway stored in the name property of the FunctionObject, and is not performance critical. Change-Id: If1784b0ec6f368bc474c246bb9c2c50d5e56b689 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Reduce memory consumption of FunctionObjectLars Knoll2014-03-076-52/+39
| | | | | | | | | Remove varCount and formalParameterCount members in FunctionObject and retrieve them from the CompiledFunction instead. Change-Id: I8a6cdc6d354b0f33da9d67a4c3dbfe8a7cc96176 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix test failure in qqmldebugjs autotestLars Knoll2014-03-071-1/+2
| | | | | | | | | | | | | | The debugger should only have one breakpoint that can be set per line. Nevertheless, we should have proper line number information available in case we stop at other places. We also need a debug instruction before the return statement, so that step out will always find a last stopping point in the parent frame. Change-Id: I86145fc244148f106a4a97ce69ab60b568c8dac6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fixes to breakpoint handlingLars Knoll2014-03-072-31/+25
| | | | | | | | Make sure stepping works correctly, and we always break at a valid breakpoint. Change-Id: I6a3032b3ae204484b8a92b2031904a7f681c7f80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a Line instruction to the interpreterLars Knoll2014-03-077-115/+15
| | | | | | | | | | This unifies the way we handle line numbers in the JIT and Interpreter. Remove the now unused lineNumberMapping code and data. Change-Id: I1d60b1fbb77e70b531fa73d93410683e84dd1e3c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify our breakpoint handlingLars Knoll2014-03-073-260/+63
| | | | | | | | | | | | | | | | | Only store a Hash of break points in the debugger, instead of the involved logic that currently adds and removes break points. Add the current line number to the Debug statements in the interpreter, and pass them on to the debugger for checking whether we should really break. This adds a slight additional overhead to running inside the debugger, but greatly simplifies the logic and doesn't require modifying the bytecode anymore. This in turn opens up the possibility to run the debugger on JIT generated code later on. Change-Id: If2a3ae8f8d08b69a3a704cbbe0a84000f917a32e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused ExecutionEngine::allFunctionsLars Knoll2014-03-031-1/+0
| | | | | Change-Id: I69a736ac7920a10667949475600460ee43d61480 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused codeSizesLars Knoll2014-03-034-50/+2
| | | | | Change-Id: I13c7d9dda7cd1e771079f6fdaa175008b3a3e0e5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove nArguments and name from QV4::FunctionLars Knoll2014-03-036-30/+14
| | | | | | | | Saves 12 bytes per Function Change-Id: I9a495805f9201eb6162a520ff5c2defeb73dc37a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix some typosSergio Ahumada2014-03-031-1/+1
| | | | | Change-Id: Iea540b768232ea423ea7f04e41655198931cf36d Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix calls to overloaded slots for QObjects not created by QMLSimon Hausmann2014-03-021-1/+15
| | | | | | | | | | | If we don't have a property cache, we need to fall back to a slower method of determining the overload methods. We have the code for that in RelatedMethod, once we determine that we're calling overloads, but we never hit that code path because we did not _initially_ determine that the method was an overload. Task-number: QTBUG-37157 Change-Id: I8ff39156e5668236b3797400b4086ed545624398 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve memory usage in QML/V4 engine.Michael Brasser2014-02-287-13/+13
| | | | | | | | | | | | | | * Don't create prototype Object for bindings and signal handlers. It is inaccessible and not required. This saves one Object-sized allocation per binding. * Shrink the size of QQmlContextWrapper by removing the v8 member variable. * Shrink the size of QObjectWrapper by moving the destroy identifier to the engine. Change-Id: I76e84e4c0581e97a19d2e959f814ac84d9c431fa Task-number: QTBUG-37134 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Determine whether or not an object literal requires a sparse array at ↵Simon Hausmann2014-02-243-8/+11
| | | | | | | compile time Change-Id: Ieb7f6ee97a4f251f1e2369850ebb9e2931f84ac1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up object literal handling with integral indicesSimon Hausmann2014-02-243-47/+26
| | | | | | | | | | | | | | | | | | | | | * Object literals with array indices are now created with one run-time call, instead of an initial one for non-integral keys followed by sub-sequent define_builtin_property calls. * Cleaned up propert name retrieval. Instead of using a visitor, it's easier to define a virtual method on the PropertyName type. The visitor doesn't buy us much as it's not possible to recurse within property names, and this way we can use it also from the function scanner to correctly determine the number of arguments needed for object literal initalizations. * Similarly the duplicated/common name member for all property assignments has been moved into PropertyName, for convenient access without AST casts. * Removed now unused builtin_define_property/settergetter functions from IR, run-time and moth. Change-Id: I90d54c81ea5f3f500f4f4a9c14f7caf5135e7f9f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up our internal namespacesLars Knoll2014-02-237-21/+21
| | | | | | | | QQmlJS::MASM -> QV4::JIT QQmlJS::V4IR -> QV4::IR Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify some runtime codeLars Knoll2014-02-224-49/+42
| | | | | | | Simpler code and delivers the same performance. Change-Id: Ifd0398f0c123f4c21998f518574cf74cd7cf7e09 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-181-7/+12
|\ | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4functionobject.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h Change-Id: Id164f6c3b45501aa466908659ec4e3b957323753
| * Fix spurious binding loop errors in QtQuick Controls and other placesSimon Hausmann2014-02-161-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 5dc7649f5ad7dca6e13707e827d001c3f118a6ef caused this regression, as a result of lazy binding evaluation and self-referencing objects: import QtQml 2.0 QtObject { property QtObject objectRef : subObject property QtObject blah: QtObject { id: subObject property int value: 42 property int blah: objectRef.value } } When blah is evaluated, we now lazily initialize objectRef - as opposed to previously throwing an exception and then when objectRef gets initialized we re-evaluate blah due to its dependency. So while evaluating "objectRef.value" for blah, we initialize objectRef by evaluating "subObject", and after doing that we write the "objectRef" property. That triggers a change notification, and since the objectRef reference for blah is a compile-time known dependency, the change notification triggers a re-evaluation of "blah", which is the binding loop. What's wrong here is that we register the pre-defined captures before the code execution, when we should register them after the evaluation, or strictly speaking after flushing pending bindings, like it is the case for individual properties in bindings where we could not pre-determine the depenencies. Change-Id: I9fb0c7583cba9d9b71c9ada2791fe87574f6ef44 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Reduce memory usage for object literals with integral keysSimon Hausmann2014-02-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Satellite profiler for V4Ulf Hermann2014-02-126-6/+293
| | | | | | | | | | | | | | | | Self-contained profiler for V4. By itself it doesn't have any connections to qqmlprofilerservice. Change-Id: I471a6119e07eab9c5f4712a16835be49c8886d1a Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Simon Hausmann2014-02-124-9/+12
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-114-9/+12
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
| | * Fix exception thrown in slot without Qml EngineSimon Hausmann2014-02-071-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't crash when an exception is thrown in a JS slot but we don't have a Qml engine. Change-Id: I1530d5c1c8cb9b9b33b9fdd0d45639fd4a0516f7 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| | * Fix alignment exception in newCallContext on ARMSamuli Piippo2014-02-062-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CallContext::locals was not at multiple of 8, which caused an alignment exception on ARM. Size for the context is also increased. Change-Id: I136418f89945cd3fec74463659107c6dab7cad0a Reviewed-by: aavit <eirik.aavitsland@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| | * [Regression] Fix lazy binding evaluationSimon Hausmann2014-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 04774bb14c81688f86a2b31b8624bde8ebf59062 long time ago introduced the concept of fixed order binding initialization with lazy evaluation, where a bit is reserved for each binding that indicates whether it's been initialized the first time or not. When reading a property on a QObject, we'd check if the corresponding binding for the property has been initialized or not and flush (i.e. execute) the binding if necessary. As part of the V4/V8 clean-up, commit 1eb41200948ab414f1c47d93123b41c547a993df removed the StoreV8Binding instruction, which made the call for setting the this-binding-is-not-evaluated-yet bit. Nowadays we only use StoreBinding, for which this optimization was never implemented (and not needed really). Now that we have a unified JS code path, we need to set the pending binding bit and also make sure that we call flushPendingBinding for any JS side property access (accelerated or not). Also flushPendingBindingImpl had two bugs: * In an attempt of trying to find the binding to flush, it could happen that we'd try to flush a previously destroyed binding (m_mePtr is null), so the b variable would remain the first binding in the object and we'd flush the wrong one (instead of none). Added a missing check to verify that the property index matches. * Also resetting the mePtr must be done through clear(), to ensure that the pointer in bindValues in the VME is also cleared, to avoid re-enabling the same binding again in complete(); Task-number: QTBUG-36441 Change-Id: Icdb0c8fb036051fd5d6c4d33b10cd0c0ed9a9d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| | * V4: Array.push() on QStringList should invoke putIndexed()Alberto Mardegan2014-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrapped sequence types should cause putIndexed() method to be called when Array.push() is used. Fix suggested by Simon Hausmann. [ChangeLog][QtQml] Fix JavaScript Array.push() not working on QStringList properties. Task-number: QTBUG-36491 Change-Id: Id04409dd7466a943d8ea8d57cd0514e8de732480 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | | Add a function dumping out a GBMI stack trace of the V4 engine.Friedemann Kleint2014-02-121-0/+35
|/ / | | | | | | | | | | | | | | | | | | Add an exported C-function dumping the JS stack trace which can be invoked by a debugger with the address of an execution context it finds in a complete stack trace. Task-number: QTCREATORBUG-11144 Change-Id: I5314f6b24868f12d4f9dedd1c261658957e581ba Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove add/sub/mul instruction specializations for numbersLars Knoll2014-02-071-18/+0
| | | | | | | | | | | | | | | | | | | | These instructions did hurt more than help, as they converted ints to doubles. Since the regular add/sub/mul runtime methods have fast paths for both ints and doubles, we're better off using those instead. Change-Id: I0b7a6f95818943bfc8a0669c1c56f7db4e7246e0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>