aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * Speed up Context creation and handlingLars Knoll2013-04-037-132/+101
| | | | | | | | | | | | | | | | | | | | | | Creating context and locals in two mallocs wasn't very good for performance. This allocates them in one go again, while still managing them through the garbage collector. This brings performance up by around 20%. Change-Id: I9b31d669e1a502c90a117bacf5fee5d23e9821b4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Some further fixes to the v8 APILars Knoll2013-04-024-8/+21
| | | | | | | | | | | | | | | | Better implementation of user comparisons, and fix a bug in GetPropertyNames. Change-Id: I2afa87239e4e269707d1809712b0beefed162d0e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Implement v8::StackFrame and v8::StackTraceLars Knoll2013-04-022-18/+47
| | | | | | | | | | Change-Id: Ib0f210f1d30a0681c3d741544206bbe0d9d26f95 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Speed up regexp creation through cachingSimon Hausmann2013-04-015-4/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | RegExp objects (the backend to the JS visible RegExpObject) are garbage collected. Now we also keep (weak) references to all live instances in a QHash<Key, RegExp*> (where key is essentially the pattern), which allows for quick re-use. Once a regexp gets garbage collected, it also disappears from the "cache". Speeds up v8-bench's RegExp test by ~1%. Change-Id: Ibeb2fa1b234a95b884594817bf5c0468fd54e839 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Changed RegExp to be garbage collected instead of reference countedSimon Hausmann2013-04-017-14/+103
| | | | | | | | | | | | | | This makes a cache implementation much easier in the future. Change-Id: I35ec5c416dc7455ea51dc58f889e2a4ee74d0ee8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix license headersSimon Hausmann2013-04-019-9/+117
| | | | | | | | | | | | | | | | | | These files are not part of Qt Creator. Use the regular Qt module template. Change-Id: Ifde77e7d365c313b3284bf0a65383fa4bd10b4be Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix memory allocation of executable codeSimon Hausmann2013-04-019-27/+371
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we allocated at least one page for each compiled function, even if it required less bytes (common). That causes excessive memory usages for large scripts or long running scripts with frequent eval usage. This patch introduces a simple allocator that allocates also on page granularity from the system but allocates the remaining space in the pages in sub-sequent calls. It is optimized to scale with the number of requests and also return pages to the system as soon as possible. Change-Id: I0751a8094afe97e94b5f44c6a691a679ecdb1df0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix ch12/12.2/12.2.1/12.2.1-21-sSimon Hausmann2013-03-231-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | (indirect eval call writing to arguments should not throw type error) Correctly propagate needsActivation, usesArgumentsObject and strictMode from the parsed eval code to the ScriptFunction before creating the call context. Also don't let the qml activation object overwrite an existing one unless provided. Change-Id: Ia92e9c40f947cbe09984fca6ecb0d1e03205ff51 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Implement fast argument lookups also for outter scopesSimon Hausmann2013-03-235-15/+13
| | | | | | | | | | Change-Id: If5b652a8ccfd81bdaa4d6f9ce83c0bf88daf18ae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix regression from commit 96ef0e4010b1be01a7b89c136ae9c518eb8492dbSimon Hausmann2013-03-231-3/+5
| | | | | | | | | | | | | | | | | | Formals only shadow variable declarations, not function definitions. Also fixes failing ch10/10.2/10.2.1/S10.2.1_A4_T1 Change-Id: I23906fe18bba4393d7c709a9dae5ff35c72d1129 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix identifier lookups when mixing variables and argumentsSimon Hausmann2013-03-214-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose the following test-case: function outter() { var foo = "bar"; function inner(foo) { function innerMost() { print(foo); } return innerMost(); } inner("FOO"); } When looking up "foo" in innerMost we used to find the variable foo in outter, because our fast lookup optimization doesn't take function parameters in outter scopes into account. However we are supposed to find the parameter "foo" from inner's activation object. This fixes the last issue with running the Boyer benchmark. Change-Id: I645ed1c601aff835bc9b7ee1fcfbdfa9c295a70c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Improve readability of disassemblySimon Hausmann2013-03-211-2/+16
| | | | | | | | | | | | | | Replace the addresses of identifier strings with their actual values. Change-Id: Icbe905ced7949913655575cac39fcf9250672f7f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix shadowing of arguments through local variablesSimon Hausmann2013-03-212-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The declaration binding instantiation paragraph in the spec (10.5) says that the formal parameters are entered into the environment before anything else. Later when processing the variable declarations, CreateMutableBinding and SetMutableBinding is only called if the HasBinding return false. That means in the following example the "var foo" declaration does not have any effect, not even setting foo to undefined: function fun(foo) { var foo; return foo; } fun("a") === "a" This patch implements this behaviour at compile-time by ensuring that no formal parameter can be entered as member into the environment and thus writes to these variables will overwrite the parameter values only. This also advances execution on the EarleyBoyer benchmarks a little further, which tries to re-declare a lot of parameters again as local variables. Change-Id: Ic12d71fd39caa44169fc4b62526f03078c2513c4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix random crashes in leaf functionsSimon Hausmann2013-03-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A "leaf" function that doesn't call any other JS functions but calls built-in functions may easily have function->maxNumberOfArguments "calculated" to zero due to the lack of call expressions. That means we may not have allocated enough stack space for the variable arguments needed for builtin runtime calls and then end up overwriting some of the callee saved registers. This can also happen in non-leaf functions, but is less likely of course. So in addition to the explicit call expressions this patch also takes the built-in expression parameter list of the IR CALL into account. It may end up calculating a maxNumberOfArguments value that is slightly too high, but we pay a relatively small price for that compared to doing a second pass over the IR or trying to patch offsets after code generation. Change-Id: Ic7cddd38952fdccbb1d636bc4d5578c2276fc1c9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Move V4 IR into its own V4IR namespace to avoid clash with QtDeclarativeTor Arne Vestbø2013-03-2117-1049/+1049
| | | | | | | | | | Change-Id: Iddaedeb72b41cab35c3cd51fc07440dffcea81c2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Pop stack instead of pushing in platformLeaveStandardStackFrame on ARMTor Arne Vestbø2013-03-211-4/+4
| | | | | | | | | | Change-Id: Ice122f89c4bb6d7f29be67732f666dfc0d9d1b89 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * v8 api: Correctly set up the prototype property for constructorsLars Knoll2013-03-211-4/+5
| | | | | | | | | | | | | | | | Also remove some debug output for methods that are actually working as intended. Change-Id: Id5df0c87eda40f8ae9769cc43fa05a9ecf67c31c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix crash with v8-bench.jsSimon Hausmann2013-03-213-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the arguments array of the context is provided by the caller and not copied. In that case the address may not be valid anymore after the call, so we need to reset arguments/argumentCount after the call in popContext, otherwise we end up calling mark() on dangling pointers. Also make sure to mark the entire arguments array, not too much and not too little, i.e. use argumentCount. Change-Id: I8b96521b0fb15142ed8c723a9354d275be48cc58 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix module operation to conform to IEEE 754 arithmic.Erik Verbruggen2013-03-201-2/+5
| | | | | | | | | | | | | | | | | | | | When the two operands are integers, and the result is 0 AND the left-hand side is negative, then discard it and do the calculation based on doubles. The reason is that the integer mod can only return +0, while (-1 % -1) and (-1 % 1) should return -0. Change-Id: I676e5bbdf3a7dcb29006d9101a9e5e7c33467c49 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Distinguish better between a FunctionDecl and a FunctionExpr.Erik Verbruggen2013-03-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | An ExpressionStatement can not start with the function keyword because that might make it ambiguous with a FunctionDeclaration. However, we insert the same node for either, so if we have a FunctionExpression that is actually a FunctionDeclaration, that is okay. If we have any other ExpressionStatement that starts with a "function" token (e.g. a call expression where the base is a FunctionExpression), error on it. Change-Id: I76acf9aca97b05f25642f82006631cb375dd8c11 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix Number.prototype.toFixed.Erik Verbruggen2013-03-201-1/+3
| | | | | | | | | | | | | | | | | | ECMA5.1 paragraph 15.7.4.5, item 7: If x >= 10^21, then a. Let m = ToString(x). Change-Id: I36516177aefddd10fec8d3f55b7644d8f7f65f64 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix a edge case in String.lastIndexOf.Erik Verbruggen2013-03-201-0/+2
| | | | | | | | | | | | | | "".lastIndexOf() should return -1, not 0. Change-Id: Iaf2359d7c1d315b2584a899ada61b658fc317f3c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Check if "use strict" has no escaped chars.Erik Verbruggen2013-03-184-11/+33
| | | | | | | | | | Change-Id: I7dc172eba02d454467ead1e18a1a59e98890dd54 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix function declaration best-practice check.Erik Verbruggen2013-03-181-27/+41
| | | | | | | | | | | | | | | | | | Most checks only apply in strict mode (added that), except for a function declaratin in a then/else part or a while body, which is in a function body. Change-Id: Ib7afecb1fb3a856ea57c7dd8b205854034739692 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Build fixes for Windows.Erik Verbruggen2013-03-182-1/+13
| | | | | | | | | | Change-Id: I8f758e8c7dced17b556c6cc2531f86b7dd974cb6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Moved TemporaryAssignment into its own header.Erik Verbruggen2013-03-183-24/+80
| | | | | | | | | | | | | | So we can re-use it without including all of qv4engine.h. Change-Id: I3de1e6a26b20afef4969001dd2dd774688f25620 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Handle best-practice conditional function declaration.Erik Verbruggen2013-03-181-1/+88
| | | | | | | | | | Change-Id: I58b442b0af279922e8e9d9cbd17ab1d24994f08c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix initialization of call contextsLars Knoll2013-03-151-20/+26
| | | | | | | | | | Change-Id: Icf32af65ac89e4bf2bf28c72ca7161f4ad65b07b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * rename qmljs_math to qv4mathLars Knoll2013-03-143-2/+2
| | | | | | | | | | Change-Id: Ie0a6eb35476da0a672856afdc082a935fb9be92e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Rename qmljs_runtime to qv4runtimeLars Knoll2013-03-1417-17/+17
| | | | | | | | | | Change-Id: I46ba9b2621be72116d94bee249ad5b798e951c88 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Rename qmljs_value.* to qv4value.*Lars Knoll2013-03-1411-10/+10
| | | | | | | | | | Change-Id: I1d85f5efd43854ea5d96c72d7a32823dc610453e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Make ExecutionContext garbage collectedLars Knoll2013-03-143-30/+86
| | | | | | | | | | | | | | | | | | This comes with ~10 percent performance regression, due to the extra allocation of the locals, but fixes a long standing mem leak. Change-Id: Ic683cc13a8c3bc66fe3f41dee61d5e388b9f3e32 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Some more optimisations to the memory managerLars Knoll2013-03-142-31/+33
| | | | | | | | | | | | | | | | | | Adjust chunk size to the size of objects stored inside. Move stack base calculation to the constructor, no need to do it at every gc run. Change-Id: Id878cb067fb7ab38576e0811dcd3670617f33534 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Remove the parent pointer from ExecutionContextLars Knoll2013-03-147-46/+95
| | | | | | | | | | | | | | | | | | | | | | It's cleaner to have an explicit stack of contexts in the Engine, esp. as the global context can get pushed onto the stack several times. This avoids an ugly hack in eval() where we created a 'copy' of the global context. Change-Id: I3936443fba6c1829a60a8e0e9a106ec75293274f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Move all context management methods into the ExecutionEngineLars Knoll2013-03-147-65/+56
| | | | | | | | | | | | | | | | Centralizes this functionality, so it can be more easily handled and modified in the future. Change-Id: I733fb791b816a117343615ddd7d7a754f42d3dbb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Rename qmljs_engine.* to qv4engine.*Lars Knoll2013-03-1415-15/+15
| | | | | | | | | | Change-Id: I452fc11972c802acc14e0a3358d8c408b6dbded8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Rename qmljs_environment.* to qv4context.*Lars Knoll2013-03-1411-11/+11
| | | | | | | | | | Change-Id: I6fe62b501803422f78b47a87c55e4278820725aa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Optimise put and defineOwnProperty a bitLars Knoll2013-03-141-4/+20
| | | | | | | | | | Change-Id: Ie944ce76a744c2bbadce20da28ceb9104f9c95c2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Remove unused methodLars Knoll2013-03-142-19/+0
| | | | | | | | | | Change-Id: Ie96da445a7c94e43db1d293f254315eed6af6713 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Remove unused variableLars Knoll2013-03-141-2/+1
| | | | | | | | | | Change-Id: I83cab99dbb6905b4f480cf1584cdb96246fd987d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Implement another method in the v8 APILars Knoll2013-03-131-2/+13
| | | | | | | | | | Change-Id: I54918914a8c9b395211ccbff891a90ab069be4a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Message is refcountedLars Knoll2013-03-131-0/+1
| | | | | | | | | | Change-Id: Ic5097ea1eae6503f906157b3d4bf51a028c94280 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Catch some more exceptions in the v8 APILars Knoll2013-03-131-10/+27
| | | | | | | | | | Change-Id: I23428f7dce0771576ae1243812eeed7a534dc833 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Remove some debug outputLars Knoll2013-03-131-4/+0
| | | | | | | | | | Change-Id: I9178da579194479eac8996290cda1ae056720b15 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Cleanup and unify context creationLars Knoll2013-03-135-65/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | * Always create contexts on the heap. When embedding native methods we can't create contexts on the stack anymore without running the risk of them being used in some scope chain. * Unify context creation for call contexts, share the code * Add a hack for indirect calls to eval and create a new 'fake' global context there, so we don't mess up the context stack (it broke badly when unwinding exceptions before). Change-Id: I5804224dc26582f24ec79518639ceb13a8a3e967 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Pass the current context to evalCallLars Knoll2013-03-131-1/+1
| | | | | | | | | | | | | | | | Passing the root context will seriously mess up our JS call stack. Change-Id: I513a9eb61bdc24b7a4542bc5f8556bf927af6c75 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix a few warningsTor Arne Vestbø2013-03-131-2/+6
| | | | | | | | | | Change-Id: I82efe66a28a76eb64b1254a7a9c6c60a0fce6228 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Be conservative and assume that functions need activationLars Knoll2013-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | A function that doesn't need it's context allocated on the heap should state so explicitly. If not it's better to assume that we need a heap allocated context. This fixes a crash on the QML clocks demo. Change-Id: I0a67e6ed38c99e7dd75dd03d6cc2dda10d8b5ad7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Remove unused methodLars Knoll2013-03-133-8/+0
| | | | | | | | | | | | | | | | The method was only used to destroy the global context and it's usage was wrong and needless there. Change-Id: If97a0c94862b5f7f7ac4dff5ccb58dc2ef8cec4b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Add valgrind support to our garbage collectorLars Knoll2013-03-133-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Tell valgrind about the memory we allocate and free in the garbage collector. Also mark stack variables as initialized before walking the stack. This avoids all valgrind warnings related to GC and gives proper warnings if we should attempt to access garbage collected memory. Change-Id: I7e923a163c25e7a5b4409b1b9c2191f314675f2d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>