summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4isel_masm.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move JIT infrastructure into it's own directoryLars Knoll2014-02-221-2603/+0
| | | | | | | | This is a starting point to clean up some of the code base for the JIT. Change-Id: I388ce8df7d4ab87095e227cf36643f4be2594b7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid some unneccesary instructions in swapValuesLars Knoll2014-02-221-13/+15
| | | | | | | | If source and target values are of the same type, there's no need to write the type to the stack once again. Change-Id: I3e1600407012f7bd7f2e5ba91b279b0421be9e68 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Mask rhs of shift operations in the IR for constantsLars Knoll2014-02-221-44/+37
| | | | | | | Saves an instruction for shifts with contants Change-Id: Ia12355d2fe2b9f80631056cda5edd79b45189e99 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Slightly simplify generated code for conversion to intLars Knoll2014-02-221-3/+1
| | | | | | | | Take only one branch for integers, and save one instruction in total. Change-Id: I496f11fb3f080f71e9f415ebb4201228c63471b8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 JIT: enable register allocator on Linux/ARM.Erik Verbruggen2014-02-171-2/+29
| | | | | Change-Id: Ieab86edebcc265063904e78c8c8d0014ace64199 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: move registers for regalloc out of method.Erik Verbruggen2014-02-171-24/+38
| | | | | | | | | This is a clean-up: by moving the description of the registers available for allocation out of the run method, the method gets easier to read, and the lists are easier to extend when adding more platforms. Change-Id: I840a15cda0e02488b7e038aa23cedd23508ed736 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-111-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
| * V4 JIT: save/restore ebx (GOT ptr) on linux/x86.Erik Verbruggen2014-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | On linux/x86, ebx is used to store the global offset table. When using this register for temporary values, we have to save it at the entry of a generated function, and restore it before doing calls and at the end. Task-number: QTBUG-36289 Change-Id: I30194be3ce44f58b793ee52f6201906bcb68d46a Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | CleanupsLars Knoll2014-01-311-6/+6
| | | | | | | | | | | | | | | | | | | | 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>
* | Implement Lookup::indexedSetterLars Knoll2014-01-311-95/+7
| | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-241-5/+14
|\ \ | |/ | | | | | | | | | | | | | | | | | | 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
| * Don't write into the callers stack frameLars Knoll2014-01-241-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | Never usee addressForArgument when arguments are passed in registers, as it points into the callers stack frame. The address was used as a temporary location when encoding a unsigned return value. The code has now been rewritten to only use registers instead. Change-Id: Id85b668a5a74dbd6c41621a9672e53a1cb5f242b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use lookups for indexed accessesLars Knoll2014-01-201-0/+8
| | | | | | | | | | | | | | This speeds up reading array data from objects significantly. Change-Id: I5d17a7b3e7583a16dc76d1ee6cbc1d7134e4c2fa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rework array handling for JS objectsLars Knoll2014-01-091-5/+6
| | | | | | | | | | | | | | | | | | 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>
* | Move array data into it's own structLars Knoll2014-01-031-3/+3
|/ | | | | | | First step of separating the array data from Object. Change-Id: I5c857397f0ef53cff0807debdb1e405424e1046a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 IR: reverse propagate int32 truncation.Erik Verbruggen2013-12-041-25/+84
| | | | | Change-Id: I5cb0c7798d0e530f3137710bf0e723bd7b64dc89 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused inline wrapperLars Knoll2013-12-041-2/+2
| | | | | | | | | The wrapper method for Function::code() was still there from the times we used C++ exceptions. It's not needed any more, so get rid of it. Change-Id: I2ec25fbca71eeef9d7a94a38b5adfa42e4de3a84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-281-3/+6
| | | | | | | | | | | * Resolve lookups in namespaces at compile time and instruct the SSA optimizer to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem) requires neither reading the namespace nor the type. * Add support for accelerated lookup of attached properties Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative ↵Simon Hausmann2013-11-261-2/+11
|\ | | | | | | | | | | into stable Change-Id: I0bf06be69927d5961f1bdb4948c3572ef6111923
| * Fix out of bounds array access when index is integer and negativev5.2.0-rc1Simon Hausmann2013-11-251-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | When the index is a double, the branchTruncateDoubleToUInt takes care of branching when the index is negative, but when it's an integer we need to perform that check ourselves. Without the patch it's rather easy to cause the application to crash. Change-Id: If908923ddc2077b3fb3dd42350f038ff0072e8e1 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-0/+5
| | | | | | | | | | | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | IR Cleanup, resolve ID objects through array subscriptsSimon Hausmann2013-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | ...instead of a special MEMBER type. This allows removing the type member from V4IR::Member altogether (and thus unshadow from V4IR::Expr::type). By not requiring the base of a id lookup member expression to be a NAME, we can also speed up repeated id lookups by fetching the id object array wrapper only once per function. Change-Id: I3e9b8f498d32ace4a0cc2254f49e02ecc124f79c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Improve type interference for QObject propertiesSimon Hausmann2013-11-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate QObject properties in member expressions across temporaries as part of the type interference SSA pass. This replaces the earlier attempt to resolving QObject properties in fieldMemberExpression() in the codegen, but it was incomplete and now things like the following are fully resolved: var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name With this patch Temp gets a helper structure with a function pointer, initialized to aid the resolution of properties in Qt meta objects. This structure is propagated into the temps until it reaches the next member expression that uses the temp. Similarly QObjectType is added as IR type, next to VarType. The resolution inside the SSA type interference pass also requires passing through the QQmlEngine from the upper caller levels, in order to resolve the property type to a potential QMetaObject property. Change-Id: I14c98fa455db57603da46613ce49c174d0944291 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Saner and simpler way to handle line numbers for JITed codeLars Knoll2013-11-221-19/+2
| | | | | | | | | | | | | | | | | | | | | | | | Instead of storing the current instruction pointer in the ExecutionContext, we might as well directly store the current line number there. Leads to simpler code, works cross platform and should also be faster. Change-Id: Ifb7897cf8dbe8a962505fe876aa3ed43283ebb06 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use lookups for create_property (ie. new foo.bar)Lars Knoll2013-11-221-2/+11
|/ | | | | | | | This is not used that often, but it removes one more place where we do lookups by name. Change-Id: I9f798b8b4a64be3fdf3e53090e4288724c9d2b22 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix property dependency generation for accelerated QML QObject propertiesSimon Hausmann2013-11-121-3/+3
| | | | | | | | | | | | | | The previous approach of collecting the dependencies through an IR visitor doesn't work, because it relies on a fixed structure - for example MEMBER(NAME, prop) - which we can't guarantee (it's usually MEMBER(TEMP, prop)). But it turns out that we can only pre-calculate dependencies for context, scope or id properties, so we can do that right away in the QML specific JS codegen, store that information in the IR function and use it from there in the data structure generator as well as in the isel as a parameter to getQObjectProperty to tell the run-time whether capture is required or not. Change-Id: I33711c3420d6534c653c2a6a4284f0fc12e941cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix out of bounds array index in the generated JIT codeLars Knoll2013-11-121-3/+5
| | | | | | | | | When converting a double to int, make sure we check for >= 0 before using it, otherwise we get out of bounds accesses. Task-number: QTBUG-34635 Change-Id: If72e116c08fe1dff03cd88ce510cf8b96d249b92 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* V4 interpreter: remove stack-slot allocator.Erik Verbruggen2013-11-121-66/+0
| | | | | | | | | | The life-ranges are only valid when the IR is in SSA form. So the use of them in the interpreter after converting out of SSA form introduced bugs. Instead, allocate a stack-slot for each unique temporary, and re-use the code for this from the JIT. Change-Id: I294f1116064f0b85996cf96a0b408b41a3c785e2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Simplify & speed up function callingLars Knoll2013-11-091-2/+2
| | | | | | | | | Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Generate inline code for "foo == null/undefined"Lars Knoll2013-11-051-12/+76
| | | | | Change-Id: I81f5708034ed50207afde697e377e8f265cbcd1c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move conversion of this object into generated codeLars Knoll2013-11-051-0/+5
| | | | | | | | | | | | When a non strict mode function uses the this object, we need to make sure it's being correctly converted into a object before being accessed. So far this was being done by ScriptFunction::call. Move this into the generated code to avoid overhead for methods not using 'this', and simplify our ScriptFunction::call() implementation. Change-Id: I739f4a89d29ed8082ce59e48d1523776224fc29d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimise string additionsLars Knoll2013-11-051-2/+9
| | | | | | | | Small optimisation for string additions, also add one more check for exceptions in the code where required. Change-Id: I6c14bc88ea5d03f7eeed0e0168c5195f9f823693 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-9/+13
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid unnecessary saving of the instruction pointer in the JITSimon Hausmann2013-11-011-1/+7
| | | | | | | | We only need to save it when the line number changes, not for each and every call. Change-Id: I1a6fdf97abd3dd654bbd97d2a99cd09e9c20f64f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-311-2/+2
| | | | | | | | | | The QQmlContextData stores the JS objects of imported scripts in a QList<PersistentValue>. Instead of indexing into that list, this patch changes ctxt->importedScripts to be a JavaScript array, that in the IR we can index via subscript. Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement loading of resolved imported scriptsSimon Hausmann2013-10-311-1/+6
| | | | | | | | We can resolve the use of names that refer to imported scripts at compile time and load them at run-time by index through context->importedScripts. Change-Id: I681b19e7d68dbf3b9a68af00b4cea2a9254c2d78 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement setting of values to resolved QObject propertiesSimon Hausmann2013-10-311-0/+6
| | | | | | | | After the resolution of a property, we can set it by index at run-time instead of via name resolution. Change-Id: I479599dabe343cf9e6582dcda12291aebfcce418 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for resolving meta-property access for the scope and context ↵Simon Hausmann2013-10-311-0/+15
| | | | | | | | | | | | | | | | | objects at QML compile time This avoids having to do a string lookup for ids and in the import cache at run-time, before we can do a string hash lookup in the property cache. Instead we resolve final properties in the context and scope object at compile time and look them up at run-time using their index instead. The dependencies to these properties are also tracked separately and recorded in the compiled data. This is merely the initial patch. There's a lot left to do, such as having specialized getter and setters for specific property types. Setters are missing altogether right now and will fall back to name lookup. Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up id object lookupsSimon Hausmann2013-10-291-0/+5
| | | | | | | | | | | | | | | | | We can resolve lookups for objects referenced by id at QML compile time and use a run-time helper to extract the id object out of the QML context data by index instead of name. Dependencies to id objects are also tracked at compile time and registered separately before entering the generated function code. The lookup of id objects is encoded in the IR as special member lookups. Members will also then in the future be used to for property lookups in context and scope properties, as well as any other property lookups in QObjects where we can determine the meta-object. Change-Id: I36cf3ceb11b51a983da6cad5b61c3bf574acc20a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove qv4unwindhelper classLars Knoll2013-10-291-14/+0
| | | | | | | | This class is not required anymore to generate stack traces, as we now store the required information in the JS context stack. Change-Id: I3893c805ca89dda70efde07fdd120e7dfaf3639f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement new exception handling for mothLars Knoll2013-10-291-1/+7
| | | | | | | | | Add the required instructions and check for exceptions in the engine before storing any results. Change-Id: Ibfaf904d659859e8012920270825211ba202c63d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework IR code generation for try/catch/finallyLars Knoll2013-10-291-3/+8
| | | | | | | | | | | | | | | | | | Simplify the generated code. Add a special block to catch exceptions thrown inside a catch() statement. store the exception on the stack when entering finally and rethrow it at the end. This ensure correct behavior for break/continue/return statements inside finally. Don't check for exceptions after calling push_catch_scope and pop_scope in the JIT'ed code. This can lead to infinite loops when throwing inside an exception handler. Change-Id: I67e9325794e2fd25b0773b21e02fbaadb43faab0 Change-Id: Ic1ea9c0c43eec1d49177dc1ab4552a1da04e96fe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework exception handlingLars Knoll2013-10-291-65/+13
| | | | | | | | | | | | | | Start the work to remove c++ exceptions from our JS exception handling. Rather rely on engine->hasException. Check the flag after we return from any runtime call in the JIT. Implement new try/catch handling code in qv4codegen and for the JIT that doesn't rely on exceptions. As an added bonus, we can remove the Try statement in the IR. Change-Id: Ic95addd6ae03371c43c47e04cac26afdce23a061 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: Avoid unnecessary irModule->functions.indexOf callsSimon Hausmann2013-10-201-1/+1
| | | | | | | | | With a growing number of functions per module, these calls become expensive and are unnecessary. defineFunction in the code generator can simply return the correct index right away. Change-Id: I8ab56a3083bf215674a1b46c502b415be694e465 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix build on ARM in ARM mode (instead of thumb2)Simon Hausmann2013-10-171-0/+4
| | | | | | | | | | We don't support the traditional ARM assembler (yet), only JIT on thumb2. In order for us to reliably check that, we have to wait until the pre-processor runs, which this patch achieves by moving all JIT enable/disable decisions into qv4global_p.h Change-Id: I7eff5b4fbf1cd26297a08dee16984ad867358113 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* inline get_element callsLars Knoll2013-10-141-9/+91
| | | | | | | | | | | Inline calls to get_element if the base is an object with a simple array structure, and the index is an integer number. Implemented for 64bit only for now, saves ~25% on crypto.js Change-Id: I3e34a6409169d90d3937f62264707d52a6c2f9f7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix a small bug in conversion to SInt32Lars Knoll2013-10-141-8/+0
| | | | | | | | | If the truncation from double returned out of bounds, the code was not generating the right call to the fallback method on 64 bit. Change-Id: I6a126dd013c5b6373762beef0c1459fae1c26ef2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement >>> inline for the JIT backendLars Knoll2013-10-121-2/+11
| | | | | | | | | The unsigned right shift operations can use a signed int as input, unifying the handling with the other shift operations. The only difference now is in the type of the return value. Change-Id: Ia9b83568951d1c1c77322d07cd734e2c37d34573 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* V4 JIT: clean-up conversion functions and add toUInt32.Erik Verbruggen2013-10-121-18/+61
| | | | | Change-Id: I7ac685145fa41db2a0e02c4d15d1d287d80621f8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Optimise code generation for convertTypeToSInt32Lars Knoll2013-10-111-5/+52
| | | | | | | | Add 64 bit code patch and avoid some duplicated calculation in 32 bit mode Change-Id: I0e111de8ac4e733aa8802c49b4b15d785688d7ea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>