aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Rework array handling for JS objectsLars Knoll2014-01-091-1/+1
| | | | | | | | | 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>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-281-0/+1
| | | | | | | | | | | * 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>
* Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-0/+1
| | | | | | | | | 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-1/+1
| | | | | | | | | | | | ...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>
* Use lookups for create_property (ie. new foo.bar)Lars Knoll2013-11-221-1/+2
| | | | | | | | 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-1/+1
| | | | | | | | | | | | | | 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>
* Move conversion of this object into generated codeLars Knoll2013-11-051-0/+1
| | | | | | | | | | | | 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-1/+2
| | | | | | | | 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>
* Avoid exception checks after calls to some run-time functionsSimon Hausmann2013-11-011-4/+10
| | | | | | | | | | We know that some run-time functions won't thrown an exception, so this patch annotates them with a tricked NoThrowContext* instead of ExecutionContext*, which allows the masm isel to detect calls to them and avoid generating the exception handling checks after the call. Change-Id: Ida1c9497edda14f26e1d6389b0144f6abeeba654 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-311-1/+1
| | | | | | | | | | 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>
* Optimize string additionsLars Knoll2013-10-311-1/+0
| | | | | | | | | | | | | QV4::String can now either hold a pointer to a QStringData, or a pair of pointers to a left and right string. This reduces the overhead of an addition to allocating a new GC'ed object. To avoid huge chains of linked strings, we use a depth counter, and flatten the string once the depth reaches 16. Change-Id: If7192b8a9f67f0e36a9a8ea34a156c5222f127f4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement loading of resolved imported scriptsSimon Hausmann2013-10-311-0/+1
| | | | | | | | 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/+1
| | | | | | | | 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/+3
| | | | | | | | | | | | | | | | | 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>
* Fix a regression introduced in I6e141a425c2b4cc0cd64c7f0011e7028b9147f69Lars Knoll2013-10-301-1/+3
| | | | | Change-Id: I34840795cf280f6872a330e4949062f3ee692afa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Speed up id object lookupsSimon Hausmann2013-10-291-0/+2
| | | | | | | | | | | | | | | | | 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>
* Inline unary operations in mothLars Knoll2013-10-291-3/+3
| | | | | Change-Id: I6e141a425c2b4cc0cd64c7f0011e7028b9147f69 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework IR code generation for try/catch/finallyLars Knoll2013-10-291-1/+2
| | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | | | 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>
* V4 runtime: add some more counters.Erik Verbruggen2013-10-101-0/+3
| | | | | Change-Id: I872f259a9fd4580e8faeae664f4d34f59a785c4e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: remove inplace operationsErik Verbruggen2013-09-301-40/+0
| | | | | | | | | Inplace operations are expanded when building the IR, so the neither the IR, nor the instruction selection backends or runtime need to handle them. Change-Id: Id01f9544e137dd52364cf2ed2c10931c31ddfff3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove more occurrences of QV4::ValueLars Knoll2013-09-301-25/+28
| | | | | Change-Id: I66c370680d7e6bee2e73a7a940aa96ab4009ec57 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-28/+28
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change the runtime API over to using StringRef's instead of String*Lars Knoll2013-09-221-40/+40
| | | | | Change-Id: I0ea95e6cca995dc5f98871f0369204af18e48111 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: fixes after ReturnValue and ValueRef introduction.Erik Verbruggen2013-09-201-2/+2
| | | | | Change-Id: I072cd7168aca4163af560c0b65e8527ddf55e26b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Refactor our NaN boxing to be more efficientLars Knoll2013-09-181-7/+8
| | | | | | | | | | | | | * Use a unified way to store all Managed objects inside a Value, instead of distinguishing between strings and other objects. * On 64 bit we store pointers as pointers, so accessing them through Scoped<> objects is cheap. This implies that doubles are now stored in a mangled form (xor'ed with a mask). Change-Id: I582e0fb167a62c0c527c6bfa3452550e37944069 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize some runtime methodsLars Knoll2013-09-181-20/+19
| | | | | | | This prings performance up by ~25% again. Change-Id: I680466e11b722b2eac0edda0fe4199b717d23855 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert methods in qv4runtime to use Returned<X>Lars Knoll2013-09-181-3/+3
| | | | | Change-Id: I1f68ecb298b049f3fa90de26b4b39233d48fb8e0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Extend the ReturnedValue mechanism to pointers to Managed objectsLars Knoll2013-09-181-16/+1
| | | | | | | | | | | | | Add a Returned<T> that we can return instead of raw pointers to Managed objects. Start using the Returned<T> for a few methods. Also clean up all our classes to use the Q_MANAGED macro instead of manually defining their vtable. Change-Id: I0a2962e47f3de955cd2cd8474f8f3fcc9e36d084 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-2/+2
| | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert ReturnedValue into a primitive (typedef to quint64)Lars Knoll2013-09-121-44/+46
| | | | | | | | | | | ReturnedValue is used to return values from runtime methods The type has to be a primitive type (no struct or union), so that the compiler will return it in a register on all platforms. They will be returned in rax on x64, [eax,edx] on x86 and [r0,r1] on arm. Change-Id: I38433e6fad252370dda5dc335d9c5be8f22e8c76 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix __qmljs_init_closure to use ReturnedValueLars Knoll2013-09-121-1/+1
| | | | | Change-Id: I777a63db32857a6a326839e3fcdb99657dc80e7f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change binops to use ReturnedValueLars Knoll2013-09-121-109/+87
| | | | | Change-Id: I068b1af5c352fc84793079e5bccbe3482b04cafa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert unary operations and some other runtime methodsLars Knoll2013-09-121-22/+22
| | | | | Change-Id: I985876ade37efd24e1d4f8360a6472282cf44f8b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for more runtime methodsLars Knoll2013-09-121-11/+11
| | | | | Change-Id: I6e92dccf4c3c1a9e4c23128ced41b6e19da1e490 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused code to generate post increment and decrement expressionsLars Knoll2013-09-121-10/+0
| | | | | | | | We generate lower level code in codegen and don't use these runtime methods anymore. Change-Id: If1023ce5295431305f4528839bcf2a3031fa7ad2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for some more runtime methodsLars Knoll2013-09-121-8/+8
| | | | | Change-Id: I68c7d321f8d17b32110ee050aa48fae5735e63ad Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use QV4::ReturnedValue in the runtime APILars Knoll2013-09-121-6/+6
| | | | | | | | This makes function calls from the JIT/Moth into the runtime significantly nicer. Change-Id: Ie7d7123984d65c0bee0525d3d28c643a76b394c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue when converting to String or ObjectLars Knoll2013-09-121-94/+13
| | | | | | | | Also rename Value::toQString() to Value::toQStringNoThrow(), and add a throwing toQString() method for JS use. Change-Id: I821b33fc61abb7d08839df965fd337685f61a545 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: add counters for built-in function invocations.Erik Verbruggen2013-09-121-8/+26
| | | | | | | | | | | | | When enabled, counters for the number of invocations of built-in runtime functions are dumped when the application exits normally. Note: this gives a penalty on execution speed. It is not meant to be super light-weight, but as a tool to have an indication which functions get called most, thereby helping to indicate which code-paths to optimize. Change-Id: Ica701f36a578affcce5ee8414532259972e5ede5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Continue conversion to using scoped valuesLars Knoll2013-09-111-211/+192
| | | | | | | | | | | This converts all methods in qv4runtime_p.h to not use raw values in arguments anymore. The conversion of return values will be done in a separate commit. Change-Id: Ie6e8f3bed459d09cb831f7f87920b7eada161502 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* More work on converting calling conventions to fit the new GC schemeLars Knoll2013-09-111-11/+11
| | | | | Change-Id: I4283cc85ad599b62a8efbe9268680287cf74097e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Start adapting function signatures in the qv4runtimeLars Knoll2013-09-111-84/+84
| | | | | | | | Move the signatures over to something that will enforce the exact GC later on. Change-Id: I2e1a472aea296cc1862c76c1e6dab5d0d2f5177c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add ValueRef classe and use it to make things GC safeLars Knoll2013-09-111-25/+25
| | | | | | | | | | | | The ValueRef class holds a reference to a Value that is already known to the GC. ValueRef's should be used to pass Value arguments to methods. As a first step us the class to make unary operations GC safe Change-Id: Ie13e332ed95b2908df9a201a3f757db864c05ca9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Generate CallData structures directly in the instruction selectionLars Knoll2013-09-111-10/+10
| | | | | | | | | Like this we can hand the CallData through the runtime methods without any need to modify them. This simplifies the code in there, and should also speed them up to some degree. Change-Id: Ibd92ff4a8f279a5c4a054c5678646f658cfed5ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Generate code for conversion to signed int32.Erik Verbruggen2013-08-291-4/+2
| | | | | Change-Id: I862a8c9c262b658859cc9b57ea0b6e9eb60e32e5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Generate code conversion to double.Erik Verbruggen2013-08-281-0/+1
| | | | | | | | Performance improves by about 15% on fact.3.js when Qt is build in debug mode. Change-Id: I4a1c868fe211c1e0f9e7d9a5652f7726b37405d1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* The fast and the furious, register drift.Erik Verbruggen2013-08-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable the register allocator for X86_64 on Linux and MacOS. The implications are: - handle as much as possible with current code with as few changes as possible - temporarily force the register allocator to spill unop/binop arguments to the stack by doing a call in the implementation (as is the current case), so no change is needed here - only have loadThis and loadConst handle registers - have any method that might need to handle registrers actually cope with them - the inline versions of binops are not generated, as they cannot cope with registers. This will change when ISel for binops is added in the next patch. This means that we are still running with the handbrakes on, but allow for full-throttle in certain/limited cases. Note about the changed test: multiplication always returns a Number (double), so the operands are passed as doubles, so __qmljs_mul will return a double. For addition this is different: because it might return a Number or a String, the operands are passed as whatever fits best. So __qmljs_add will return an int when both operands are ints. Hence the change to the tests. Change-Id: If5bd7dffca8f7de5ba45af700b9c7bb568fc74b7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'wip/v4' of ssh://codereview.qt-project.org/qt/qtdeclarative ↵Simon Hausmann2013-08-201-8/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into dev Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtime_p.h src/qml/jsruntime/qv4script.cpp sync.profile Change-Id: I1d785e2134bffac9553a1c16eed12816cbd1ad2c
| * Use indices into the runtime functions array instead of function pointers in ↵Simon Hausmann2013-08-161-1/+1
| | | | | | | | | | | | | | the isel for closures Change-Id: Ieaf7b112f80adc3f1041cb1397db4eab55fb0184 Reviewed-by: Lars Knoll <lars.knoll@digia.com>