platform/upstream/qtdeclarative.git
11 years agoSimplify test262.py work-flow
Simon Hausmann [Thu, 10 Jan 2013 08:03:56 +0000 (09:03 +0100)]
Simplify test262.py work-flow

Make test262.py work by default again like the original tool with
regards to TestExpectations, i.e. not use them at all. Instead make
it an option that is now passed via "make check".

So after a change in code we run "make check" to check for any regressions or
fixes. If there are any regressions, then we call tests/test262.py <name of
test> to debug it and by not reading TestExpectations by default the test will
fail.

Change-Id: I00b43c5d09c17c296dfa958293f769663ef49de1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix length property of arguments object
Simon Hausmann [Thu, 10 Jan 2013 07:55:31 +0000 (08:55 +0100)]
Fix length property of arguments object

The length should reflect the number of parameters _actually_ passed to the
function.

Change-Id: Ib38541f2175be6cee5b4ccaf7a9bc32b21531972
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix properties in arguments objects for parameters
Simon Hausmann [Wed, 9 Jan 2013 15:45:31 +0000 (16:45 +0100)]
Fix properties in arguments objects for parameters

According to the spec the parameters that are declared formally
need to have a getter/setter in non-strict mode. But parameters beyond
what's formally declared are just stored by value and dont' have a
setter / getter.

This fixes the "regressions" uncovered by the previous commit and
a bunch of other tests that were marked as failing.

Change-Id: Ib87b84a8a389914f01a95a00ecec452455b17376
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix length of arguments object
Simon Hausmann [Wed, 9 Jan 2013 13:44:09 +0000 (14:44 +0100)]
Fix length of arguments object

Initialize the argumentCount correctly for functions that are called with more
parameters than formally declared. This fixes a whole bunch of tests and also
shows that we are failing on some other tests that use defineProperty on the
arguments object. These tests were "silently" passing before because the
arguments object had the wrong length / content.

The next commit is going to fix those, but it is an unrelated change.

Change-Id: Ia5197e2ea3ea9629e46a5eda1d2d3d63f0cca645
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix enumerable checking.
Erik Verbruggen [Wed, 9 Jan 2013 16:52:23 +0000 (17:52 +0100)]
Fix enumerable checking.

Change-Id: Iff7e19e1eb9595586b3c540bf179773110f0fd3a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdated test expectations
Simon Hausmann [Wed, 9 Jan 2013 16:29:04 +0000 (17:29 +0100)]
Updated test expectations

Change-Id: I4458cabdc2ce2b6756146e196926071ddcabc449
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdded parseInt (15.1.2.2) and parseFloat (15.1.2.3).
Erik Verbruggen [Wed, 9 Jan 2013 13:37:55 +0000 (14:37 +0100)]
Added parseInt (15.1.2.2) and parseFloat (15.1.2.3).

Change-Id: I0ff54a59d68596b55fb1add25c29f894b05252b9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdate expectations
Simon Hausmann [Wed, 9 Jan 2013 10:38:11 +0000 (11:38 +0100)]
Update expectations

Mark test as known to fail that is a known regression for now

Change-Id: Ic7b80e7623c379a742341fe23215eca1fad08c9d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove more tests from the list of tests that we expect to fail
Simon Hausmann [Wed, 9 Jan 2013 10:07:11 +0000 (11:07 +0100)]
Remove more tests from the list of tests that we expect to fail

They do pass now after the latest qtdeclarative updates

Change-Id: Ice66d5b95853ea9211ab8da915fc04b57d937a0d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoMake auto-update of TestExpectations smarter
Simon Hausmann [Wed, 9 Jan 2013 10:05:31 +0000 (11:05 +0100)]
Make auto-update of TestExpectations smarter

...by making it also recognize when a test that

    (1) is expected to fail,

_and_

    (2) we expected to fail

and therefore

    (3) expected to _pass_

now suddenly "fails" the way it should fail in the first place.

Change-Id: I78cbf637e3ac9c2e964752d509f9a5fcf1431abf
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoUpdated the test expectations.
Erik Verbruggen [Wed, 9 Jan 2013 09:36:19 +0000 (10:36 +0100)]
Updated the test expectations.

Change-Id: Ia54ed953d1c313b8c24bf195b5de0e52d3058976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix some compiler warnings.
Erik Verbruggen [Tue, 8 Jan 2013 11:57:45 +0000 (12:57 +0100)]
Fix some compiler warnings.

Change-Id: I5e2c87581d4c309490f12accfff32418700fbb71
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMark array regressions as expected failures
Simon Hausmann [Tue, 8 Jan 2013 15:47:46 +0000 (16:47 +0100)]
Mark array regressions as expected failures

Change-Id: I9ad9462318ed4759a30f74270cd069cc43d86fcd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix delete someArray[index]
Simon Hausmann [Tue, 8 Jan 2013 15:34:05 +0000 (16:34 +0100)]
Fix delete someArray[index]

The current implementation resized the array, where as we should be
poking a whole into the array. With this patch that's done using
an explicit undefined value. In the future I guess the array will
support sparse segments.

Fixes currently failing tests:
 ch11/11.4/11.4.1/11.4.1-4.a-14 in non-strict mode
 ch15/15.4/15.4.4/15.4.4.18/15.4.4.18-7-2 in non-strict mode
 ch15/15.4/15.4.4/15.4.4.21/15.4.4.21-9-3 in non-strict mode

Change-Id: Idb0a230e38af3ce1f8f80f71257d472434154f95
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agomoth: add builtin_define_getter_setter and builtin_define_property.
Erik Verbruggen [Tue, 8 Jan 2013 15:09:48 +0000 (16:09 +0100)]
moth: add builtin_define_getter_setter and builtin_define_property.

Change-Id: Iffd8c79dbc99f9563235b440fa18e446cedabf0c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMove the Array data up into Object
Lars Knoll [Tue, 8 Jan 2013 13:25:36 +0000 (14:25 +0100)]
Move the Array data up into Object

Objects can just as well have indexed access as Arrays.
They actually behave identical except for the fact that
Array has an automatically updated length property.

Like this we can unify the handling of named and indexed
properties and make sure the methods of the array prototype
work correctly and fast also for objects (as documented).

Change-Id: I3ffb9c39faafb8857a6a676ab9f3fcceda091a99
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix potential crashes
Lars Knoll [Tue, 8 Jan 2013 13:16:28 +0000 (14:16 +0100)]
Fix potential crashes

The ProeprtyTable iterator can point to a 0 table entry.
These need to be skipped when iterating over the table.

Change-Id: Idea4d5d42488428d2930be0235538ae349f27142
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoUpdated failing test case list
Lars Knoll [Tue, 8 Jan 2013 13:16:13 +0000 (14:16 +0100)]
Updated failing test case list

Change-Id: Ic0d1ca2922c1aa0a3e791d2127ad38dab4edad95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the PropertyTable into it's own file
Lars Knoll [Tue, 8 Jan 2013 11:42:40 +0000 (12:42 +0100)]
Move the PropertyTable into it's own file

Change-Id: I310f53122ae17275f345c9c57ad70b8d5f48c307
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the PropertyDescriptor into it's own file
Lars Knoll [Tue, 8 Jan 2013 11:39:09 +0000 (12:39 +0100)]
Move the PropertyDescriptor into it's own file

Change-Id: I27f47826a0a3fda85c6d87dbf49c9f86b7d5a0b0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove our String class into a separate file.
Lars Knoll [Tue, 8 Jan 2013 11:35:39 +0000 (12:35 +0100)]
Move our String class into a separate file.

Change-Id: Ibcaa9e9e2675d3c628383c99282b281f9b6880b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSome cleanups for Array
Lars Knoll [Tue, 8 Jan 2013 11:02:13 +0000 (12:02 +0100)]
Some cleanups for Array

Remove some unused code, move length into the
Array (to prepare for a fast path), and fix
a leak in the assignment operator.

Change-Id: I823bb2dc4957ddb74d8fed9c819ea2b1c09c5a24
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSome optimisation to the Array constructor
Lars Knoll [Tue, 8 Jan 2013 11:01:22 +0000 (12:01 +0100)]
Some optimisation to the Array constructor

This will need further changes, as copying an Array
can be expensive.

Change-Id: I32b5083dee6ffaa89687af30e4b3589ee72616da
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd mode to test262.py to edit the test expectations file after unexpected passes
Simon Hausmann [Tue, 8 Jan 2013 10:59:01 +0000 (11:59 +0100)]
Add mode to test262.py to edit the test expectations file after unexpected passes

Make it the default when running "make check", for convenience.

Change-Id: Ia469d67dbcb81f27f243722182da8ab3b8bf88ef
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoImplemented Array::indexOf
Simon Hausmann [Tue, 8 Jan 2013 11:03:01 +0000 (12:03 +0100)]
Implemented Array::indexOf

and unskipped a bunch of tests that were failing

Change-Id: Ic17cb6cb2f89ad18cb6b5313af735f8afda2385e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUpdate test expectations after array changes
Simon Hausmann [Tue, 8 Jan 2013 10:19:42 +0000 (11:19 +0100)]
Update test expectations after array changes

Some tests are now passing, others we can run now (no OOM anymore)
but they are failing. A few tests remain that need to be skipped
because they still allocate too much memory.

Change-Id: Ie944ffd7b9adee9df605e6411e1b52fc032e0019
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSmall array cleanups
Simon Hausmann [Tue, 8 Jan 2013 10:06:08 +0000 (11:06 +0100)]
Small array cleanups

Remove duplicated code from Array copy constructor and protect
assignment operator against self-assignment.

Change-Id: I0de2cbc54cbfed570a2166c63237f264792dc144
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agonew implementation for array data
Lars Knoll [Mon, 7 Jan 2013 12:09:44 +0000 (13:09 +0100)]
new implementation for array data

The old implementation was using a std::deque, which
doesn't quite scale as it needs to scale.

The new implementation uses a modified red-black tree
to store the array data. The modifications are similar
to the ones in qfragmentmap, allowing for ver efficient
removal from the front of the array.

Change-Id: Iae343981f958bb5fafd0618597b67180d7834dbb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoReplace the WTF RefPtrs with simpler versions
Simon Hausmann [Mon, 7 Jan 2013 12:28:57 +0000 (13:28 +0100)]
Replace the WTF RefPtrs with simpler versions

We do need less functionality, so we get away with less, based on code that's
tested with the full version. This reduces the size of the binary and allows
for the removal of many more forked files.

Change-Id: I3292ad5bb6abed1d531a51c81d59b0ba18da4e72
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace WTF's UNUSED_PARAM with Q_UNUSED
Simon Hausmann [Mon, 7 Jan 2013 12:35:26 +0000 (13:35 +0100)]
Replace WTF's UNUSED_PARAM with Q_UNUSED

Change-Id: I23d75b418cd9d405c288af30475e44ff1724a4ed
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMap WTF_MAKE_NONCOPYABLE straight to Q_DISABLE_COPY
Simon Hausmann [Mon, 7 Jan 2013 12:39:41 +0000 (13:39 +0100)]
Map WTF_MAKE_NONCOPYABLE straight to Q_DISABLE_COPY

Change-Id: Idf914acb41917de8667bb4dcbd1305276a29b8d6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoReplace OwnPtr with a simple QScopedPointer define and a PassOwnPtr wrapper
Simon Hausmann [Mon, 7 Jan 2013 14:51:57 +0000 (15:51 +0100)]
Replace OwnPtr with a simple QScopedPointer define and a PassOwnPtr wrapper

Change-Id: I479cd9cf03700b912748baeb58021b8ec73af987
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoEliminate one more forked file, TypeTraits.h
Simon Hausmann [Mon, 7 Jan 2013 14:56:24 +0000 (15:56 +0100)]
Eliminate one more forked file, TypeTraits.h

Change-Id: Ia0f846a3e5ba0a9d8d1bdf743bc41859d1f4eb8e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoIgnore Qt Creator .pro.user files.
Erik Verbruggen [Mon, 7 Jan 2013 14:49:32 +0000 (15:49 +0100)]
Ignore Qt Creator .pro.user files.

Change-Id: Ie6a68f2c1c9adb7d49681c05cc9e6c0db3ecc136
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUpdate test expectations
Simon Hausmann [Mon, 7 Jan 2013 11:10:46 +0000 (12:10 +0100)]
Update test expectations

Add a bunch of tests are that _passing_ but are really supposed to fail,
for example tests that contain invalid syntax that's supposed to throw
syntax errors instead. Those tests are tagged with @negative in the test
case itself.

Change-Id: I4756cc07f4a9f026af8047716fd79d2bcf25d1f1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix parsing of skipped tests
Simon Hausmann [Mon, 7 Jan 2013 11:14:12 +0000 (12:14 +0100)]
Fix parsing of skipped tests

While adding support for running tests that are supposed to fail,
I broke support for skipping tests altogether. After the split()
on the line the result is of course a list, which in the case of
a single "skip" entry needs to be dereferenced instead of appending
a list to a list as a list item.

Change-Id: Ifd27ee4f762ab092a7333b286ca187309cd631ab
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSpeed up "make check"
Simon Hausmann [Mon, 7 Jan 2013 11:15:19 +0000 (12:15 +0100)]
Speed up "make check"

With make check run the tests in parallel.

Change-Id: I6c9827a5d2ae8264c6d30ec39b0dbea2227ee3b3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSupport progress reporting during parallel test runs
Simon Hausmann [Mon, 7 Jan 2013 07:51:52 +0000 (08:51 +0100)]
Support progress reporting during parallel test runs

Cut the test results into smaller chunks and allow python to process
them in any order, so that we can process incoming results as they
come in.

Change-Id: I96f8d0173a63da2d460a6fcdcecae56137b4acb7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd initial support for parallel test execution
Simon Hausmann [Sun, 6 Jan 2013 21:47:47 +0000 (22:47 +0100)]
Add initial support for parallel test execution

Todo: Incremental test reporting while the tests are running

Change-Id: I69048211b19b5b6b15cc32f65c8ae4a93f27861c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd support for marking failing tests as expected failures
Simon Hausmann [Fri, 4 Jan 2013 16:44:01 +0000 (17:44 +0100)]
Add support for marking failing tests as expected failures

If they suddenly pass, then that's going to show up as "failure"
Might need to tweak the output a little.

Change-Id: I4cec410953bc83d7b85e8c1d1a1ac30d53767e68
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd top-level "make check" target
Simon Hausmann [Fri, 4 Jan 2013 14:53:37 +0000 (15:53 +0100)]
Add top-level "make check" target

... that just runs all the tests.

Change-Id: Ie14f73ab3c742b64aa52a0748b21ae9c9df3dd84
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoAdd support to basic test exceptation handling to test262.py
Simon Hausmann [Fri, 4 Jan 2013 14:51:16 +0000 (15:51 +0100)]
Add support to basic test exceptation handling to test262.py

Initially this will be used to merely skip tests that we cannot run
yet, but it will be extended in the future to also list tests that
are currently failing but _should_ be passing, so that we can detect
it when we fix these.

Change-Id: Ic59f60c7023b261950b6b0ff3a45e00afe7c63e9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify test262.py execution
Simon Hausmann [Fri, 4 Jan 2013 12:52:06 +0000 (13:52 +0100)]
Simplify test262.py execution

Make it possible to call test262.py from anywhere and default to
v4 as command to execute.

Change-Id: If805c7b3733a49f86465e8f7ebaffd581536dfec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoInitial import of Test262 test suite
Simon Hausmann [Fri, 4 Jan 2013 12:46:21 +0000 (13:46 +0100)]
Initial import of Test262 test suite

This also includes a copy of the test262.py script to run
all the tests, which we are going to modify to suit our needs.

Change-Id: I15fd7d0278e39c7076d4e45650fbcf786f7a483f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix break without identifier in labelled loop
Simon Hausmann [Fri, 4 Jan 2013 09:25:01 +0000 (10:25 +0100)]
Fix break without identifier in labelled loop

Make sure to do leaveLoop() after enterLoop() when processing labelled
statements.

Fixes hang in ch12/12.8/S12.8_A3

Change-Id: Iee96ea515524e9ea879f7528dc43e552b1343020
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoProduce a syntax error when a break appears outside of an iteration
Simon Hausmann [Fri, 4 Jan 2013 08:59:04 +0000 (09:59 +0100)]
Produce a syntax error when a break appears outside of an iteration

Fixes expected failure of ch12/12.8/S12.8_A1_T2 and others

Change-Id: I261d649f6a29bbd6debfca35e7ccaf1a0a7006b9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix hang in do-while loops with continue statement in the body
Simon Hausmann [Fri, 4 Jan 2013 08:09:39 +0000 (09:09 +0100)]
Fix hang in do-while loops with continue statement in the body

The construct

do {
   ...
   continue;
} while (condition)

Would result in the body basic block ending with a jump to the loop body,
causing an infinite loop.

Instead we have to place the condition into an extra block and set that one as
the target for continue.

This is also covered by ch12/12.14/S12.14_A9_T2, which uses such a loop.

Change-Id: If06de112b338b74b9a49e3d6b51078463645196d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSet data properties using __defineOwnProperties__
Lars Knoll [Thu, 3 Jan 2013 21:56:52 +0000 (22:56 +0100)]
Set data properties using __defineOwnProperties__

Properties in object literals are defined using
defineOwnProperty, so that they get set even if
the object prototype contains a non writable
property with the same name.

This fixes all remaining test cases for 11.1.5

Change-Id: I3928a144d09c51c5bf20a25bcb1c6c3c243975ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoThrow syntax errors with duplicated values in Object literals
Lars Knoll [Thu, 3 Jan 2013 21:40:02 +0000 (22:40 +0100)]
Throw syntax errors with duplicated values in Object literals

Object literals can only contain duplicated values for data
properties in non strict mode. In all other cases throw a
syntax error.

Change-Id: Icb06ba1c343daffdb6a0532a08f7b9ae027e4e45
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdd fast conversion of a string to an array index
Lars Knoll [Thu, 3 Jan 2013 21:17:46 +0000 (22:17 +0100)]
Add fast conversion of a string to an array index

This will be required later on when Array gets fixed
properly.

Change-Id: I37eccf94b202c9a003aab30b078ee24c422359a1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCorrectly size arrays with trailing elisions
Lars Knoll [Thu, 3 Jan 2013 19:45:36 +0000 (20:45 +0100)]
Correctly size arrays with trailing elisions

Change-Id: Iae09ec815e3307615299bf97741716b3671c9560
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoImplement { get/set ... }
Lars Knoll [Thu, 3 Jan 2013 16:11:22 +0000 (17:11 +0100)]
Implement { get/set ... }

Implement support for defining accessor properties
through { ... }. Implementation for moth is pending.

Change-Id: I558b6811bc5656dc0fae78c49e23155043ce9cb1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoReplace WTF::Vector with a tiny std::vector wrapper
Simon Hausmann [Thu, 3 Jan 2013 13:26:51 +0000 (14:26 +0100)]
Replace WTF::Vector with a tiny std::vector wrapper

Change-Id: Ieb371c42790b19ee1f12b3622041ac139e1e03c2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of unused FastMalloc definitions
Simon Hausmann [Thu, 3 Jan 2013 13:45:00 +0000 (14:45 +0100)]
Get rid of unused FastMalloc definitions

We don't ship the implementation and we only need a really simple stub
to compile the code we _really_ want to keep.

Change-Id: I36bd0f836b963ed38feb10b970326a4dcd5cbc12
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix remaining number-to-string failures in chapter 9
Simon Hausmann [Thu, 3 Jan 2013 15:16:03 +0000 (16:16 +0100)]
Fix remaining number-to-string failures in chapter 9

...by using the double-conversion code from
http://code.google.com/p/double-conversion/

Change-Id: I4cfc17b65c811b7c20a856d1d38961bec78d85a2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix compilation with clang on Mac OS X
Simon Hausmann [Thu, 3 Jan 2013 13:00:59 +0000 (14:00 +0100)]
Fix compilation with clang on Mac OS X

Add missing friend declarations for required access to private
fields and moved operator< into namespace so that the compiler can
find it when calling qSort().

Change-Id: I6c94b6fc79c5039903e62ce08b0a6b273133e104
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoClean up memory manager ownership
Simon Hausmann [Thu, 3 Jan 2013 11:26:19 +0000 (12:26 +0100)]
Clean up memory manager ownership

Since we have now only one memory manager, we might as well let the
ExecutionEngine create and own it.

Change-Id: I908adadf64da59e0b8f4c09d4d9502785399cb99
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoGet rid of wtf/StackBounds
Simon Hausmann [Thu, 3 Jan 2013 12:50:10 +0000 (13:50 +0100)]
Get rid of wtf/StackBounds

All we need is the starting address of the stack, not the entire class.

Change-Id: I447482f6900afa0a66efce2dcc32239828b64f8e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSave some memory
Lars Knoll [Wed, 2 Jan 2013 21:35:18 +0000 (22:35 +0100)]
Save some memory

Move some boolean flags from Object and FunctionObject
into the Managed class and reduce the size of these
Objects.

Change-Id: Iee9ab09407ec44b447f9597a9b1d55e9092e7ad5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the mark and inUse bits into the Managed class
Lars Knoll [Wed, 2 Jan 2013 21:09:31 +0000 (22:09 +0100)]
Move the mark and inUse bits into the Managed class

This simplifies the memory manager further, and removes
some book-keeping overhead.

Change-Id: I969c092cee822f7f0ab89e09d76b5c68c6bd50d2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSimplify and fix memory management
Lars Knoll [Wed, 2 Jan 2013 15:43:47 +0000 (16:43 +0100)]
Simplify and fix memory management

The old code could lead to crashes because we didn't correctly
check the alignment of objects in the managed heaps. A bogus
pointer on the stack (which can easily happen), can then
point into the middle of an object in the heap and cause
memory corruption.

Change-Id: I741401d278a7926a549810707ca46435bdaf7cc9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove unused memory manager classes
Lars Knoll [Wed, 2 Jan 2013 14:25:25 +0000 (15:25 +0100)]
Remove unused memory manager classes

Unify the base class with the GC memory manager and
remove the memory manager that didn't manage ;-)

Change-Id: I8579bc80b66688e98203448afc645a231c97fede
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMove the Managed class into it's own file
Lars Knoll [Wed, 2 Jan 2013 11:28:10 +0000 (12:28 +0100)]
Move the Managed class into it's own file

Preparations for some further cleanups.

Change-Id: Id9fa3a8541748ee70085bc84985ac508f989e1d3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAnother fix to the temp compression.
Erik Verbruggen [Wed, 19 Dec 2012 14:48:42 +0000 (15:48 +0100)]
Another fix to the temp compression.

Pin all temps that escape BBs, not only the return value.

Change-Id: Idf21d117bfd12224cbff4cef35766c454189a5fa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoChange the interpreter's stack frame to be allocated with alloca.
Erik Verbruggen [Wed, 19 Dec 2012 10:21:06 +0000 (11:21 +0100)]
Change the interpreter's stack frame to be allocated with alloca.

Change-Id: Ia02ad1af3bb0f429a6078029bf7aaee5a17f3413
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoChanged GC heap chunks to be allocated from separate page allocations
Simon Hausmann [Tue, 18 Dec 2012 14:03:26 +0000 (15:03 +0100)]
Changed GC heap chunks to be allocated from separate page allocations

Use page allocations instead of the regular libc heap for the chunks
of the memory manager. This will allow for easier return of the memory
to the operation system in the future.

Change-Id: Ie370e54042251b17335e94b497933f06ab62ecc3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoUpdated wtf and masm from upstream (r137997)
Simon Hausmann [Tue, 18 Dec 2012 09:21:16 +0000 (10:21 +0100)]
Updated wtf and masm from upstream (r137997)

This also brings in the page allocation code from WTF

Change-Id: If6f9fdb4fb2d10530f06e3e9524c95ff5876d084
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoDebugging fixes.
Erik Verbruggen [Tue, 18 Dec 2012 12:53:32 +0000 (13:53 +0100)]
Debugging fixes.

Change-Id: I53b7301c28314210f96acc358744ff7e2a65546d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSet the argumentCount in the Context to the length of arguments.
Erik Verbruggen [Tue, 18 Dec 2012 12:53:18 +0000 (13:53 +0100)]
Set the argumentCount in the Context to the length of arguments.

Change-Id: I2bc0c6130248dfca6764222bcc95a4d2e6f82233
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix temp compression, and actually add var decl instructions.
Erik Verbruggen [Tue, 18 Dec 2012 11:09:06 +0000 (12:09 +0100)]
Fix temp compression, and actually add var decl instructions.

Change-Id: Ic73a8e4284fd7644e37251498a659e107e49f0d8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix liveness analyses for hidden exception handling TEMPs.
Erik Verbruggen [Tue, 18 Dec 2012 10:01:32 +0000 (11:01 +0100)]
Fix liveness analyses for hidden exception handling TEMPs.

By passing the inCatch/hasException temps to
builtin_delete_exception_handler, the TEMPs are marked as alive all
through the exception handling block.

Change-Id: Ib0f17059e04c03ca98d264759bb2a7e4786ed9be
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix instruction tracing.
Erik Verbruggen [Tue, 18 Dec 2012 09:59:54 +0000 (10:59 +0100)]
Fix instruction tracing.

Change-Id: Ie2ff005e2914bc372e4c6d08dd28d34efdde8da3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix moth isel for typeof.
Erik Verbruggen [Tue, 18 Dec 2012 09:59:26 +0000 (10:59 +0100)]
Fix moth isel for typeof.

Change-Id: If5b5a91a69d6b6bf0fd3eaf4c21a42c575839be2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoRemove unused variable
Simon Hausmann [Tue, 18 Dec 2012 07:08:31 +0000 (08:08 +0100)]
Remove unused variable

While the name may suggest that the blah variable is a very performance
critical piece of the stack traversal algorithm, it turns out to be of little
relevance :)

Change-Id: Ia12eaf5f169a6eae64f005364da7452e1ef86daf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoMore compilation fixes.
Erik Verbruggen [Tue, 18 Dec 2012 08:06:03 +0000 (09:06 +0100)]
More compilation fixes.

Change-Id: I5940e0b1e72c06420ae95ff3adfd78572888c886
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAdded check for formal parameter names in strict mode.
Erik Verbruggen [Wed, 12 Dec 2012 12:54:31 +0000 (13:54 +0100)]
Added check for formal parameter names in strict mode.

Also fixed up other error messages.

Change-Id: I26bfab761ab6a8ced3755a8e3dfbc42d428194e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix compilation after changes in the QML parser.
Erik Verbruggen [Wed, 12 Dec 2012 12:50:13 +0000 (13:50 +0100)]
Fix compilation after changes in the QML parser.

Change-Id: I5c6903446a252139fde4ce180f6c01a5eff85406
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAllow to run tests in parallel.
Jędrzej Nowacki [Wed, 12 Dec 2012 15:29:14 +0000 (16:29 +0100)]
Allow to run tests in parallel.

The test_interpreter script waste a lot of time in the kernel
process, that should be fixed. For know magic '-j' option allows
to speedup test execution a bit.

Change-Id: Ib1f0cbecc2053e434eb8df4e2e1edb22bc3e7846
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoensure correct initialization order for local variables
Lars Knoll [Mon, 17 Dec 2012 20:56:19 +0000 (21:56 +0100)]
ensure correct initialization order for local variables

section 10.5 requires that function definitions get initialized
at the beginning of the method. variable declarations do not
override the function definitions. assignments to variables
happen when they appear in the source code.

Also remove a duplicated intializations of variables to
undefined. This is already being done by initCallContext
or builtin_declare_vars, so no need to do it in the generated
code again.

Change-Id: I63805b97017f8676d57e0662073689e852b6ac23
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFor the JIT enable the memory manager that traverses the native stack for references...
Simon Hausmann [Mon, 17 Dec 2012 21:48:24 +0000 (22:48 +0100)]
For the JIT enable the memory manager that traverses the native stack for references to managed objects

Change-Id: Ie4a26ddc75abd1382af29b966915437ad485a041
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix native stack traversal
Simon Hausmann [Mon, 17 Dec 2012 21:43:22 +0000 (22:43 +0100)]
Fix native stack traversal

* For the traversal range, don't take the top of the stack but one
value pointer below, as the top is actually the end of the stack
and we can't read beyond it. For the bottom go one pointer beyond
a locally declared (and thus aligned) value. This ensure sane and
aligned boundaries for the traversal.

* For quick elimination of pointer values on the stack that do
not actually point into one of our managed objects, implement Lars'
idea: Take the heap chunk beginning and end pointers and do a lower
bound search. An even index indicates that the pointer is before the
start of a chunk, thus out of range. An odd index indicates that it
is before a chunk end and therefore in range.

* For obscure reasons we also seem to sometimes hit "dangling" pointers
into otherwise already dealloc'ed objects (as debug output in dealloc()
indicates), so protect ourselves against that.

Change-Id: Ic3337932777871bec370a3441581801273d53bd4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix a bug in catch{}finally{} and simplify code
Lars Knoll [Mon, 17 Dec 2012 14:18:38 +0000 (15:18 +0100)]
Fix a bug in catch{}finally{} and simplify code

There was a bug in the implementation of unwindException(),
that caused failures when called twice from one catch statement.

Also refactor and simplify the TryStatement code further by
introducing a rethrow builtin.

Change-Id: I77bf37f1707042f402488ef2dfaf4e59bf8dc82a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoResolve argument names from right to left
Lars Knoll [Mon, 17 Dec 2012 12:34:39 +0000 (13:34 +0100)]
Resolve argument names from right to left

Duplicated names for arguments are allowed in JS, later ones
shadow previous ones. So we need to iterate from back to front
to resolve the names correctly.

Change-Id: If427ce9d11ac561457c24e41f79c11263fa0a8dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAvoid lookup of locals and formals when possible
Lars Knoll [Mon, 17 Dec 2012 09:29:48 +0000 (10:29 +0100)]
Avoid lookup of locals and formals when possible

If we do not have a Function or the function doesn't
need activation, we directly generate code to get and
set formals and locals, so there's no need to look
these up from the execution context.

Change-Id: I888fc65fd2527f9102fab7cae2822600f87f9edc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoAllow the compiler to inline
Lars Knoll [Mon, 17 Dec 2012 09:03:37 +0000 (10:03 +0100)]
Allow the compiler to inline

use String::isEqualTo instead of qmljs_string_equal to
allow for inlining.

Change-Id: I55d41ab34f1e04cb0f752d8018e3ce9b11a90d1d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmaller cleanups and code simplifications
Lars Knoll [Mon, 17 Dec 2012 08:52:04 +0000 (09:52 +0100)]
Smaller cleanups and code simplifications

Change-Id: I1634ce8b105ee0d22b67fafa45962fe7c22b9f3a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup constructor handling
Lars Knoll [Sun, 16 Dec 2012 22:08:07 +0000 (23:08 +0100)]
Cleanup constructor handling

Simplify the code and unify the generic part of object construction
in FunctionObject::construct.

Change-Id: Ie430458bedaa211efba37c8283e26a9b84e6764a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoFix return value corruption in masm codegeneration
Lars Knoll [Sun, 16 Dec 2012 22:00:01 +0000 (23:00 +0100)]
Fix return value corruption in masm codegeneration

In some cases, the first argument for runtime calls and the
return value where being placed in the same location on the
stack leading to corrupted return values. This mainly
happens when no local variable are defined, but other
functions are being called.

Change-Id: I93f1e518ce2998f62fb9f38c538dd718f41e522d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
11 years agoFix delete operator on local variable and arguments
Lars Knoll [Fri, 14 Dec 2012 15:40:48 +0000 (16:40 +0100)]
Fix delete operator on local variable and arguments

throw in strict mode, and ignore delete operations on
arguments otherwise.

Change-Id: Icd55f1c99dc5e5c35b3fea1ce5fdf46d5295dbaf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a bug in the construct method of Function objects
Lars Knoll [Fri, 14 Dec 2012 13:23:55 +0000 (14:23 +0100)]
Fix a bug in the construct method of Function objects

Function objects when called as a contructor should return
the return value of the called function if the return value
is an object (see 13.2.2)

Change-Id: I9d9e52859935d62b7f949fff46cb00d257bad90f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix a bug in the Object contructor
Lars Knoll [Fri, 14 Dec 2012 13:23:21 +0000 (14:23 +0100)]
Fix a bug in the Object contructor

new Object(x) should convert x to an object and return
it if x is not null or undefined

Change-Id: Icb5547a23df83018757901bfecb5f024610e7c68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoMicro optimization of StringPool
Jędrzej Nowacki [Thu, 13 Dec 2012 14:11:21 +0000 (15:11 +0100)]
Micro optimization of StringPool

In destructor we do not need to create a copy off all pointers.

By hiding StringPool::strings in class private
section we reduce risk of it being accidentally copied.

Change-Id: I1b9df6bf9e49bd6926e84b8eac6b3d904277e50a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoRemove ExecutionEngine::identifiers.
Jędrzej Nowacki [Thu, 13 Dec 2012 15:12:53 +0000 (16:12 +0100)]
Remove ExecutionEngine::identifiers.

The member was a duplicate of stringPool, there is no point in caching
a cache.

Change-Id: If34c80ee120dfaff1dd94326625b02d8014806dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoSmall cleanups for ArgumentsObject
Lars Knoll [Fri, 14 Dec 2012 12:53:22 +0000 (13:53 +0100)]
Small cleanups for ArgumentsObject

Change-Id: Ib9a2f3ab23dd76f52bb4c41edf539f4fa0cd8929
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixes for arguments object in non strict mode
Lars Knoll [Fri, 14 Dec 2012 12:27:26 +0000 (13:27 +0100)]
Fixes for arguments object in non strict mode

In non strict mode, the arguments object actually
reflects the argument as it changes over the lifetime
of a function, unless you explicitly delete some of it's
properties.

The code to implement this is pretty ugly, but still better
then the specification :)

Change-Id: Ie42ed25c797513615fbc4bdee14145d953f323f3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFixes for the arguments object
Lars Knoll [Fri, 14 Dec 2012 10:32:52 +0000 (11:32 +0100)]
Fixes for the arguments object

We now pass most of the test cases for it.

Change-Id: Idc43a9baa75c3c1e8fe760d78cf5e6092f051c6e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoCleanup getPropertyDescriptor and arguments object
Lars Knoll [Fri, 14 Dec 2012 09:25:27 +0000 (10:25 +0100)]
Cleanup getPropertyDescriptor and arguments object

The only place where getProepertyDescriptor was still being
used outside of Object itself was the arguments object. Fixed
that by reimplementing get, hasProperty, put and canPut in
the arguments object.

Change-Id: Ie44c7acf857321c65bc0f58915de0353231459c0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
11 years agoFix failing assertions in GC on ia32
Simon Hausmann [Fri, 14 Dec 2012 08:46:25 +0000 (09:46 +0100)]
Fix failing assertions in GC on ia32

We currently round up allocation sizes to 16-bytes on 32 and 64-bit.
When recursively calling alloc() after the allocation of a new heap chunk,
make sure to adjust the requested size parameter again to its original value,
to ensure 16 byte alignment.

Change-Id: Ie8cd29d60639bf43023a310b7be6f772305fa826
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoFix execution with MM_AGGRESSIVE_GC=1
Simon Hausmann [Fri, 14 Dec 2012 08:55:10 +0000 (09:55 +0100)]
Fix execution with MM_AGGRESSIVE_GC=1

Make sure that the current context pointer is initialized to the
root context, so that early GC runs before the first function call
find an initialized pointer in MemoryManager::collectRoots.

Change-Id: I224695b253e27674913310b76d12d42bff5c1b82
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
11 years agoSimplify/speed up retrieving of properties
Lars Knoll [Fri, 14 Dec 2012 08:57:02 +0000 (09:57 +0100)]
Simplify/speed up retrieving of properties

The hasProperty()/get() sequence used so far is as in the
spec, but requires us to lookup the name twice. Instead add
a bool hasProperty() to Object::__get__() and use that.

Speeds up fact.2.js by ~20%

Change-Id: Ic8c84718f1a702c3da9487010c0d6dd0fee44609
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>