aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of ↵Simon Hausmann2013-04-1542-0/+14388
|\ | | | | | | | | | | | | | | | | | | | | | | ssh://codereview.qt-project.org:29418/playground/v4vm into v4 This is the initial merge of the v4vm JS engine, designed specifically for QML. The engine is tested on Linux and Mac OS X, works on x86, x86-64 and ARM. Change-Id: I826b72cfa3d3575007b70d78604080582db568db Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Move property attributes out of the property arraysLars Knoll2013-04-121-5/+1
| | | | | | | | | | | | | | | | | | | | | | Rather large change that fully separates the property attributes from the property data. This saves quite some memory. Since the property data for members is saves in the class structure it'll also allow optimizations to the lookup code. Change-Id: I9ba1d372bb756695bef8188d1b86275562a1b219 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix memory allocation of executable codeSimon Hausmann2013-04-014-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 module operation to conform to IEEE 754 arithmic.Erik Verbruggen2013-03-201-1/+0
| | | | | | | | | | | | | | | | | | | | 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-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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/+0
| | | | | | | | | | | | | | | | | | 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-1/+0
| | | | | | | | | | | | | | "".lastIndexOf() should return -1, not 0. Change-Id: Iaf2359d7c1d315b2584a899ada61b658fc317f3c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Mark test as passing after qtdeclarative change.Erik Verbruggen2013-03-201-1/+0
| | | | | | | | | | | | | | | | Depends on https://codereview.qt-project.org/51392 . Change-Id: I2309db6f2f829e4dd05cd20983b9b986c166b607 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Mark more tests as passing after qtdeclarative change.Erik Verbruggen2013-03-191-3/+0
| | | | | | | | | | | | | | Depending on https://codereview.qt-project.org/51264 . Change-Id: Iaa1cf8e583944d7cf0f873f203b834e85712ea5f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
| * Check if "use strict" has no escaped chars.Erik Verbruggen2013-03-181-1/+0
| | | | | | | | | | Change-Id: I7dc172eba02d454467ead1e18a1a59e98890dd54 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix function declaration best-practice check.Erik Verbruggen2013-03-181-1/+0
| | | | | | | | | | | | | | | | | | 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>
| * Fixes to run the test suite on Windown.Erik Verbruggen2013-03-181-2/+4
| | | | | | | | | | Change-Id: I94292c873cb3029b19cc90bdfa6f9312215e6011 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Handle best-practice conditional function declaration.Erik Verbruggen2013-03-181-9/+0
| | | | | | | | | | Change-Id: I58b442b0af279922e8e9d9cbd17ab1d24994f08c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix name lookup for named function expressionsSimon Hausmann2013-03-081-3/+1
| | | | | | | | | | Change-Id: Ia36b2b5c5b40475450fe369c7d6cb5e3965a4488 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix slowness in unwind table registrationSimon Hausmann2013-03-061-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | __register_frame and __deregister_frame are very slow when called with many functions many times, like in some of the tests that use a lot of eval(). Change the approach to interposing a function symbol that is called in libgcc whenever a PC -> FDE lookup is required. This also changes the code to create the unwind info on-demand. Change-Id: I99dfcc921b087831ad00f79bad9e7bcfb0cc8c33 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Skip some really slow testsLars Knoll2013-03-031-1/+7
| | | | | | | | | | | | | | | | | | | | The test cases themself finish in ~10-20 secs. Unfortunately __deregister_frame seems to be extremely slow if you have many functions (as is the case in these tests). It takes many minutes to then clean up the engine and deregister all frames. Change-Id: Idaa829f64c91d324e650b1d22b94dec6becad3d4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Small cleanupLars Knoll2013-02-251-1/+0
| | | | | | | | | | Change-Id: I1733ad823ef00114b4544bb0bdf40fede4eea073 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix multiple variable assignmentsSimon Hausmann2013-02-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | When doing var foo = bar = 42; then we would assign 42 to bar and bar to foo, resulting in the wrong value for foo if bar was read-only for example. The spec says in 11.13.1.6 that the rval is to be returned, so we just do that via the temp we already have. Change-Id: I44ea895abe4796af10c371baac22c2b26f37b519 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix scoping for catch blocksSimon Hausmann2013-02-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Lars' idea, done together with Erik. For proper scoping of the exception variable in catch blocks, it is necessary to define the new scope (ExecutionContext for us) at run-time, it cannot be determined at compile time. This patch implements the necessary logic to create the new execution context when entering a try block and re-uses the existing pop_scope infrastructure for destroying it again. Within the catch scope it is necessary to do all lookups by name, so the existing _function->insideWith variable was re-used and renamed to _function->insideWithOrCatch. Additionally the new context also stores the name and value of the separately scoped exception variable that shadows any existing equally named variables in outter scopes. CodeGen::unwindException also had a bug that it would generate the finally code with the wrong _function->insideWithOrCatch level, resulting in name lookups inside finally instead of local index lookups. Change-Id: I5616af38c3558e553e971a6a894ce5239ccb8422 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix a crash in JSONLars Knoll2013-02-121-1/+0
| | | | | | | | | | | | | | | | Fully initialize the property descriptor when parsing JSON. Change-Id: Ia43ac2dae573c5d5050cb02ca8f177c363262a05 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Implement a first iteration of the fast property lookup schemeLars Knoll2013-02-122-1/+10
| | | | | | | | | | | | | | | | | | Fast lookups still require a function call, and will only work for properties defined on the object itself. Properties of the prototype will still be slow. Change-Id: I07c601998d312b1bd8e9977708d3375bf72df3e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix name function expressionsSimon Hausmann2013-02-091-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should also insert those into the environment members if they have a name and are part of an expression statement. Simple testcase example: try { function foo() { ... } } catch (e) {} Then foo should be visible as if it was declared outside of the try. Change-Id: I8d23a28e1c4537d4f57f9cb0d559e6163e0fdef0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Move the Array code into Object itselfLars Knoll2013-02-041-1/+0
| | | | | | | | | | | | | | This allows simplifications of the code moving forward. Change-Id: If65809fd3646e6dc2da6bc62190d6465b1b1ec12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V8 benchmark suiteLars Knoll2013-01-311-0/+11591
| | | | | | | | | | | | | | | | We're currently failing two tests. Performance is between 2 and 20 times worse then V8 in full compiler mode. Change-Id: Ie78b4e996511777cb665dbf161e41dcfa0210b9b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
| * Minor improvements to Context creationLars Knoll2013-01-311-2/+1
| | | | | | | | | | | | | | | | | | | | Avoid converting the this object for builtins, and remove the GC blocker that's not needed anymore. Move some parts of the code out to the caller of initCallContext(). Change-Id: I8b11dd1604fb14940e4d4e9f403c2a8bfc837c4b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Make things more compliant with a regular Qt moduleLars Knoll2013-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | Move the v4 tool into basedir/tools/v4 Small fix to sync.profile Install v4 into QT_INSTALL_BINS adjust test262.py to simply call 'v4' by default Change-Id: If78f40632c226bc26f64b0eea06fe93d7770af3e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix a bug with Unicode surrogates in decodeURILars Knoll2013-01-301-5/+1
| | | | | | | | | | Change-Id: Id8348c77ad4d5429c4b4116b8ef0dc94e130c4e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Allocate execution context and local variables in one chunkLars Knoll2013-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | This avoids a few mallocs and in addition memory leaks where the local variables or arguments array wasn't destroyed before. crypto.js seems to run without a mem leak now :) Change-Id: Icca74c5dba764fadabd7a77f233bdf5883046c86 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Properly working post increment/decrement operatorsLars Knoll2013-01-281-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This required some larger changes in our infrastructure. Unfortunately the post increment/decrement operators don't return the old value unmodified, but return toNumber(oldValue). At the same time they need to properly store the new value into the referenced expression. The only way to solve this (as we can't have two return values) is to pass a proper reference into runtime methods. Change-Id: I0e0c2cc011ab22d5d4b27924abc8c18372c104a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * new eval() should throw a type errorLars Knoll2013-01-281-1/+0
| | | | | | | | | | Change-Id: I487a11a060657ac1eeae4c51085ce907711b51c8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Set the prototype for FunctionObject in it's constructorLars Knoll2013-01-281-5/+0
| | | | | | | | | | | | | | | | This avoids a few test failures where the prototype for eval wasn't set up correctly. Change-Id: I5a5c1dafe4a6328bf1bbc95901ff22df10083a86 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix call expressions with a subscriptLars Knoll2013-01-281-4/+0
| | | | | | | | | | | | | | | | | | | | Call expressions such as foo[bar]() where wrongly converted to a temporary and then called by value. This made the call have the wrong this argument, as the reference was resolved in the assignment to the temporary. Change-Id: Id6044f833dfcf9ee8fa4f9ec0602a929abdc2c48 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * test function names for eval or arguments in strict modeLars Knoll2013-01-281-12/+0
| | | | | | | | | | | | | | | | using these as function names should trigger a syntax error in strict mode. Change-Id: I8d83fda72db856b692c8f6f1454c762255bcaef1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix a bug in the evaluation of &&Lars Knoll2013-01-271-4/+0
| | | | | | | | | | Change-Id: Ia446bd05dcca3fc146719284e5ac96d4c7d61c06 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
| * Fix empty return statement in evalSimon Hausmann2013-01-251-1/+0
| | | | | | | | | | | | | | It should throw a syntax error even inside eval it seems. Change-Id: I4de6d96f9ba61569d7d7e723ecb5f2d946c8f4ad Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix remaining issues with the delete operatorSimon Hausmann2013-01-251-4/+3
| | | | | | | | | | | | | | Delete on known temps should return true and false on known local variables. Change-Id: I71be8361306eb825b975a3aee294665eb8561366 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix more tests with the delete operatorSimon Hausmann2013-01-251-7/+0
| | | | | | | | | | | | | | | | Delete on non-reference types should return true. Delete on our temporaries should evaluate to false. Change-Id: Ic6b39a0cf5833900f2a492ac8b37386fc2963ab3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Delete on a function argument should return falseSimon Hausmann2013-01-241-1/+0
| | | | | | | | | | Change-Id: I36aafcfa43bced2b8315af39432cf7731daaf458 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Throw a syntax error if eval or arguments is used in increment/decrement ↵Simon Hausmann2013-01-241-8/+0
| | | | | | | | | | | | | | | | expressions Change-Id: Icd966b626a172302eb4b22f5cadba0085d31c320 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix inplace operatorsLars Knoll2013-01-241-17/+0
| | | | | | | | | | | | | | | | We actually need to call __put__ on the result of the operation even if the lhs didn't exist before. Change-Id: I54acaab203fd34fd88a36685211e382a8399b11b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Throw a reference error when trying to use an invalid lvalueLars Knoll2013-01-241-4/+0
| | | | | | | | | | Change-Id: I08c19710eaf58da100852fa9c2b07a4d8bb8b0c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix return statement outside of function bodySimon Hausmann2013-01-241-11/+1
| | | | | | | | | | | | | | Such a program is syntactically incorrect Change-Id: Ica23c67aae55890a36064987f6019d9d7f50585e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix properties of literal array initialisersSimon Hausmann2013-01-241-15/+1
| | | | | | | | | | | | | | | | | | | | Array entries defined in such a way need to be own properties. To avoid calling builtin_define_property with the integer index converted to a string for each property, this patch also introduces a builtin_define_array_property that takes an integer index instead. Change-Id: Ib21f99a555b3237753a7930a7edc70bfcd49ac18 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix the remaining test failures for the with() statementLars Knoll2013-01-241-9/+1
| | | | | | | | | | | | | | | | Properly pop the pushed scopes for break, continue and return statements inside with() blocks. Change-Id: I7439cd7b7c70819cd5de903395e1b67c394a38c6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Create a real execution context for with() statementsLars Knoll2013-01-241-24/+1
| | | | | | | | | | | | | | This is required for full spec compliance. Change-Id: I0c1a3ed249a458032d29ba80650a5fdc2eac5c01 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix evaluation of lhs in binary expressionsSimon Hausmann2013-01-241-43/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The entire left hand side of a binary expression must be evaluated before the right hand side. In case of for example x !== (x = 1) it is important to generate the code for looking up "x" from the lhs before dealing with the rhs, because this overall expression is supposed to throw a reference error. Change-Id: I03aee3257ff7b7a60aa789dba9f0445c387a1ad5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Skip Intl tests for now and re-generate TestExpectationsSimon Hausmann2013-01-242-162/+29
| | | | | | | | | | Change-Id: I178222506bf697451a3b83c8595bfb0e88b71eae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix all but one remaining test case for exceptionsLars Knoll2013-01-241-5/+0
| | | | | | | | | | Change-Id: I03d42eeeb28a0f75d3cad81cb7af815c9784c43e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix bug in switch statementLars Knoll2013-01-241-11/+1
| | | | | | | | | | Change-Id: I42f509f825d8c095c3762a86e5da881de1038d7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Fix wrong constant foldingLars Knoll2013-01-231-11/+0
| | | | | | | | | | Change-Id: I8c48ae0597c41c69c77d56cba4c6be738d5d282b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>