aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Specialize CJump into JumpEq and JumpNeLars Knoll2014-02-071-5/+10
| | | | | | | | | | | | | | | | This avoids the bool invert in the instruction stream, and some additional code in the VME. Change-Id: I0ea675a2e3d07c1b8c5234b888d8d9683bcee330 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove a memset that is not requiredLars Knoll2014-02-071-0/+2
| | | | | | | | | | | | | | Keep it in debug builds to ease debugging. Change-Id: I334872d3c0ef30b5f09fb5febfc2129a3b450bca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add specialized instructions for right and left shiftLars Knoll2014-02-071-0/+16
| | | | | | | | | | | | | | | | These give a measurable speedup as the critical code paths are now inline. Change-Id: I3cee8a432fbe96d66ba1e6bd277a38e624a50c14 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Simplify some runtime methodsLars Knoll2014-02-071-15/+1
| | | | | | | | | | | | | | | | This gives as performant but simpler code, as the first line in toInt() checks if the value is integercompatible. Change-Id: I15d0ade231719116ca1c6c03a86106b7f5aaa9aa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove two unused parameters from VME::run()Lars Knoll2014-02-072-5/+6
| | | | | | | | | | | | | | | | These parameters are not used outside the function itself anymore, so we can safely remove them. Change-Id: I1694481c05a9927fc78a59ffb7fec43a88e85ac8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add a MoveConst instruction to the interpreterLars Knoll2014-02-071-0/+4
| | | | | | | | | | | | | | This simplifies and speeds up loading of constants Change-Id: I05b4f7a34abd4ed6416fa800a31debbb28b37104 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Make the Ref classes not template basedLars Knoll2014-02-0719-123/+140
| | | | | | | | | | | | | | | | | | | | Move to a class hierarchy that mirrors the main classes. This will allow moving functionality over into the Ref classes, as the current Managed classes become mainly something that holds the data. This is required to make objects movable by the GC. Change-Id: I4ca88ab0e5d8c88c8dc56d51937990500a33e0d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rename Referenced to ManagedRefLars Knoll2014-02-0710-65/+52
| | | | | | | | | | | | | | | | | | | | First step of removing the templates here and turning this into a class hierarchy. This is required, so we can move all member methods into the Ref classes and make objects movable during GC. Change-Id: Ie14af07fd3e72a7d84a528d0042189ff12ba21bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move Referenced together with ManagedLars Knoll2014-02-072-81/+90
| | | | | | | | | | | | | | | | The two classes belong logically together (as the Managed base type and a generic pointer to a Managed object). Change-Id: I65691669a7169a4514cadf7ab3e744c090851c6b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix memory management issue with accessorsSimon Hausmann2014-02-072-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | The earlier pattern of Property p; p.setSetter(new (mm) setterFunction); p.setGetter(new (mm) getterFunction); carries the risk of the second allocation garbage collecting the first one. Consequently we need to put these values onto the JS stack, using a simple ScopedProperty wrapper. Change-Id: Ib29ea3b1eab95595dd6dfbb86fea282d23e3d899 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Move PersistenValue and WeakValue into it's own fileLars Knoll2014-02-056-324/+426
| | | | | | | | | | | | | | | | They deserve having their own set of files, and it helps reduce dependencies. Change-Id: Ifd4394f88ef51cbccc61bf92dd20636f570141d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Smaller performance fixesLars Knoll2014-02-053-12/+14
| | | | | | | | | | | | | | | | | | | | Move commonly used variables in the ExecutionEngine to the beginning of the struct to increase cache locality. Keep the engine pointer in a register in the interpreter to save one memory load per instruction. Change-Id: If2540c66b62685701511f410aff495c0a20ca694 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove an unused constructorLars Knoll2014-02-052-5/+1
| | | | | | | | | | | | | | | | | | | | Fortunately we don't use this constructor anymore. This also allows us to fix the assert in qv4managed. Now we finally enforce that every managed object must have an internal class and a vtable. Change-Id: Idf9081c20633b44b79970fec4cc4d1ec5e6a6f7c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add a special Debug instruction to the interpreter and use itLars Knoll2014-02-052-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoid having to check for the debugger at every instruction we execute. Instead we only add debug instructions at the beginning of every line and every basic block when we have a debugger. This still allows interrupting the JS execution at any time (as we can't loop inside a basic block), and single stepping through lines. But it has no overhead when the debugger is not running and a lot less when it is running. Change-Id: Ib17170b42944b608fc6caa1891082205dd2b2763 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | Fix occasional crashes in canvas getImageData and other placesSimon Hausmann2014-02-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | In some places we allocate custom array objects and in the constructor we call setArrayType, which will allocate the array's data through the GC. In all of these cases we need to make sure that the array object itself is protected from garbage collection, because while in the constructor it may not be yet in the scope the callee has usually set up. Change-Id: I96b7af4ae00fd809067e12bacd6563984c5e9240 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | alloca() is declared in stdlib.h on BSD systemsGabriel de Dietrich2014-02-021-3/+1
| | | | | | | | | | | | | | | | | | | | | | ... except on Darwin. Bonus change: Updated auto-tests trying to include 'alloca.h'. This is a follow up on 24c43a5748b8502. Change-Id: I299de00bf0dca7842470b158282daea221a10f2d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use lookups for get/setElement in the interpreterLars Knoll2014-01-311-0/+11
| | | | | | | | | | | | | | Significantly speeds up crypto.js Change-Id: Icd3d59bea3fe4427e93e9e10e3526178e8de859c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove unused macroLars Knoll2014-01-311-9/+0
| | | | | | | | | | Change-Id: Ie7044aecad59197fd2cab17d5ddcc7c44ad2ad84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move ValueRef into qv4value_p.hLars Knoll2014-01-313-61/+80
| | | | | | | | | | | | | | The ref class belongs logically together with the value. Change-Id: I40c0908715cbc8b2a5c51d2544cb06fcd8e25365 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Disentangle some includesLars Knoll2014-01-317-22/+30
| | | | | | | | | | | | | | | | | | ScopedValue should require less dependencies. Hopefully we can then move it together with the main class definition at some point (ie. move ScopedValue int qv4value_p.h; similar for the other types). Change-Id: Ie7b31715cb718a90dba40845c7ae785a29855062 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move Encode into qv4value_p.hLars Knoll2014-01-312-45/+49
| | | | | | | | | | | | | | This is where the class logically belongs. Change-Id: I366013aad2c9b6324ae82ab5f3250f1d9c719da4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | CleanupsLars Knoll2014-01-3130-221/+206
| | | | | | | | | | | | | | | | | | | | Remove SafeValue, it was used to port over to an exact GC. Since we now have that, we can now safely merge it with QV4::Value again. Also rename SafeString to StringValue for better naming consistency. Change-Id: I8553d1bec5134c53996f6b0d758738a0ec8a2e4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Get rid of the SafeObject classLars Knoll2014-01-314-9/+20
| | | | | | | | | | | | | | | | Having SafeValue is enough, and we can pass an ObjectRef instead of a SafeObject * for function calls. Change-Id: I4e1435105403f8091b43eeda01303f9602c74235 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move ArrayElementLessThen to qv4arraydata.cppLars Knoll2014-01-313-43/+43
| | | | | | | | | | | | | | This is the only place the class gets used. Change-Id: Iebb0cba7af30c1b2da68f67596c349d5e20c5053 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rename some filesLars Knoll2014-01-3122-779/+779
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Implement Lookup::indexedSetterLars Knoll2014-01-313-1/+63
| | | | | | | | | | | | | | | | | | 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>
* | Fix a bug in qmljs_set_element and improve it's performanceLars Knoll2014-01-311-4/+8
| | | | | | | | | | | | | | | | | | | | Avoid expensive function calls for setting indexed properties in the common case. The spec requires us to read the value before writing it to check whether it's empty. In that case we need to fall back to the slow implementation that checks the proto chain. Change-Id: If278ba81f170d35c18135d2f8661459262e7e606 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Simon Hausmann2014-01-246-2/+125
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-246-2/+125
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/dialogs/qquickmessagedialog.cpp src/imports/dialogs/qquickmessagedialog_p.h src/qml/debugger/qqmlprofilerservice_p.h src/qml/jsruntime/qv4regexpobject.cpp tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d
| | * Make compile on DragonFly BSD.Alex Blasche2014-01-213-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Platform Specific Changes][BSD] Fixed compile errors on DragonFly BSD and potentially FreeBSD. Task-number: QTBUG-35867 Change-Id: Iea90b93672c34f8a4b56e9afc4dbfb82cc993548 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| | * Add support for deprecated RegExp (constructor) propertiesSimon Hausmann2014-01-202-2/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were apparently part of ancient EcmaScript specs, aren't even listed anymore in any recent spec (not even as deprecated), but apparently they are part of what the web supports as well as previous versions of Qml. So this patch implements them. Task-number: QTBUG-36244 Change-Id: I1b9ea7ea09fceb6a486f615837a71e41aae12de4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| | * Fix uninitialized variable in debug buildsSimon Hausmann2014-01-171-0/+3
| | | | | | | | | | | | | | | | | | | | | Initialize size to zero in both constructors. This should fix UMRs. Change-Id: I6888f667b3dc6b2e72e58b54288c3c88df3ced71 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | | Allocate the ArrayData object and it's data togetherSimon Hausmann2014-01-247-172/+170
| | | | | | | | | | | | | | | | | | | | | | | | Reduce the amount of allocations required for Arrays, and allows freeing the array data more easily in the GC. Change-Id: I3e3213f089c45c83a227038ce444aa60b2735b7f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | | Change virtual methods in ArrayData to take Object pointerLars Knoll2014-01-2411-133/+120
|/ / | | | | | | | | | | | | | | | | 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>
* | Turn ArrayData into a Managed objectLars Knoll2014-01-239-145/+86
| | | | | | | | | | | | | | | | | | Memory manage ArrayData. Once the ArrayData is moved to be inline inside the object, this will save quite some time for allocating and freeing arrays. Change-Id: I19a520161d41bfe3d83f377af0b41db4ac5b99e4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | fix whitespaceOswald Buddenhagen2014-01-223-18/+18
| | | | | | | | | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Split ManagedVTable into two classesLars Knoll2014-01-2148-456/+316
| | | | | | | | | | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Adjust method naming to be closer to ManagedLars Knoll2014-01-213-21/+37
| | | | | | | | | | | | | | | | Also make markObjects() virtual, to be in line with Managed. Change-Id: I3e7682216660e2027c02c9181e541b12310902f3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Reorder members in ManagedVTableLars Knoll2014-01-214-26/+26
| | | | | | | | | | | | | | | | This is to prepare splitting it up into a several type dependent vtables. Change-Id: I5de8234e40ffc73fab47d43f4a1b30d244fc6ad9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use lookups for indexed accessesLars Knoll2014-01-202-0/+78
| | | | | | | | | | | | | | This speeds up reading array data from objects significantly. Change-Id: I5d17a7b3e7583a16dc76d1ee6cbc1d7134e4c2fa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add a SimpleArrayData classLars Knoll2014-01-2012-243/+259
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>