aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Extend the QML bootstrap library by the IR buildersSimon Hausmann2014-04-231-2/+14
| | | | | | | | | | | | | This is among other things needed to fix the qml import scanner to detect dependencies from .js files correctly. The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT where appropriate and corrects the wrong include path for the double conversion code to actually be relative to the file it is included from. This worked by accident because of other include paths present in the build. Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move inline function Bool Runtime::compareEqual() above usage.Friedemann Kleint2014-04-011-19/+19
| | | | | | | | | | Fix MinGW-warnings: src/qml/jsruntime/qv4runtime_p.h:496:13: warning: 'static QV4::Bool QV4::Runtime::compareEqual(QV4::ValueRef, QV4::ValueRef)' redeclared without dllimport attribute after being referenced with dll linkage Change-Id: Ieb212ed6aba2a0deeeddd033126ae7e9737bb38e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup our runtime methodsLars Knoll2014-03-111-211/+205
| | | | | | | | | 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>
* Determine whether or not an object literal requires a sparse array at ↵Simon Hausmann2014-02-241-1/+1
| | | | | | | compile time Change-Id: Ieb7f6ee97a4f251f1e2369850ebb9e2931f84ac1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up object literal handling with integral indicesSimon Hausmann2014-02-241-3/+1
| | | | | | | | | | | | | | | | | | | | | * 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>
* Simplify some runtime codeLars Knoll2014-02-221-27/+17
| | | | | | | Simpler code and delivers the same performance. Change-Id: Ifd0398f0c123f4c21998f518574cf74cd7cf7e09 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>
* Disentangle some includesLars Knoll2014-01-311-0/+1
| | | | | | | | | 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>
* CleanupsLars Knoll2014-01-311-1/+1
| | | | | | | | | | 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>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | 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>
* 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>