Lars Knoll [Thu, 24 Jan 2013 10:58:46 +0000 (11:58 +0100)]
Create a real execution context for with() statements
This is required for full spec compliance.
Change-Id: I0c1a3ed249a458032d29ba80650a5fdc2eac5c01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 11:26:44 +0000 (12:26 +0100)]
Fix build on Mac OS X
Use std::isnan instead of isnan, like everywhere else in the file.
Change-Id: Ie58288b0a8d2043dc88054babe3beee78007cd15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 10:58:58 +0000 (11:58 +0100)]
Fix evaluation of lhs in binary expressions
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>
Erik Verbruggen [Thu, 24 Jan 2013 10:56:26 +0000 (11:56 +0100)]
Fix compilation of (incomplete) llvm backend.
Change-Id: Ib87c3427cfd937516a58849540e0e668a28cb8dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 09:20:12 +0000 (10:20 +0100)]
Skip Intl tests for now and re-generate TestExpectations
Change-Id: I178222506bf697451a3b83c8595bfb0e88b71eae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 23 Jan 2013 21:49:31 +0000 (22:49 +0100)]
Fix all but one remaining test case for exceptions
Change-Id: I03d42eeeb28a0f75d3cad81cb7af815c9784c43e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 22:11:54 +0000 (23:11 +0100)]
Fix bug in switch statement
Change-Id: I42f509f825d8c095c3762a86e5da881de1038d7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 20:53:54 +0000 (21:53 +0100)]
Fix wrong constant folding
Change-Id: I8c48ae0597c41c69c77d56cba4c6be738d5d282b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 20:47:44 +0000 (21:47 +0100)]
Labelled statements can also appear outside of loops
Change-Id: I121b9341dd102964f52dec2a0278c2a3d74b9a8a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 20:00:38 +0000 (21:00 +0100)]
Loops are local to functions
Loops need to be reset when parsing an inner function,
as labels can't cross these boundaries.
Also throw a syntax error when a continue statement
outside a loop is encountered.
Change-Id: I69484a2f7a550590194e82667bc4c66aba89ae43
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 19:44:47 +0000 (20:44 +0100)]
Don't crash on for(x in null)
Change-Id: I3bd5610fa9bffcc195bb1c96a5a595061931a20e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 19:24:12 +0000 (20:24 +0100)]
Fix a crash when a non direct call to eval caused a syntax error
Change-Id: I89d1eabd248fd844f7cd2caa29667e0c7850958d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 14:20:44 +0000 (15:20 +0100)]
Fix some errors related to strict mode
eval and arguments aren't allowed in variable
declarations or as lvalues.
More correct propogation of the strict mode flag from
eval into Codegen.
Change-Id: Ic519900463aa2f57311a64787e33bc6924838f16
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 13:31:05 +0000 (14:31 +0100)]
Implement JSON.stringify
Change-Id: If1d170767c61c2435fe82f7e26e1ebf8de6327bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 12:21:09 +0000 (13:21 +0100)]
Fix callBuiltinInvalid for the interpreter.
Change-Id: Ifde12261a7c66a7b268129d5fae4ae626e16a00f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 23 Jan 2013 10:50:01 +0000 (11:50 +0100)]
Fix crash when using the built-in regexp syntax
When /someregexp/ appears in the source, we generate a new regexp
object in the MASM back-end at run-time. That object is memory
managed but it's never marked, because we only store its address
in the generated code.
This patch adds a way for the code generator to collect values that
are generated like this and encoded only in the code directly, and
therefore require extra book-keeping when collecting the roots.
Change-Id: Ia4cc3f4578e2e7e4378ea7ab1a32c66f0e6ab4bf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 23 Jan 2013 09:39:58 +0000 (10:39 +0100)]
Refactor JSON.parse
Use a modified copy of the parser in QtCore to get
all test cases to pass and to be a lot faster.
In addition, this will later on to add support for
the second argument to JSON.parse
Change-Id: Iaa4cbda29db9c53c3dd5ab2b2ded71efdaa6f8ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 10:04:48 +0000 (11:04 +0100)]
Fix compiler warnings.
The second call method in EvalFunction was hiding an overloaded virtual
function, hence the name change.
Change-Id: Ic333d1e7359df97ff25dace87c80b40a939a4cea
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 09:22:52 +0000 (10:22 +0100)]
Method signature changes to remove duplicate logic.
Change-Id: Ib4a17dd90629a71f1ee2daa442e49d2237b1073d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 09:12:51 +0000 (10:12 +0100)]
Fix eval when a context gets inherited.
When a context gets inherited, the locals have to be passed into the
CodeGen class, so the indexes in the caller and callee match up.
Change-Id: I21f496e8355a5dd7f13c06e011ede60fc04ccba0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 09:11:05 +0000 (10:11 +0100)]
Split off 2 builtins into their own instruction.
The foreach-iterator-object and foreach-next-property-name now have
their own interpreter instructions. Also cleaned up the parameter
passing helper methods.
Change-Id: I3f375ba29e1ae914e707039b157fa011878b88b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 23 Jan 2013 09:07:18 +0000 (10:07 +0100)]
Fix direct vs indirect calls to eval (15.1.2.11)
Change-Id: I6f5dc4a1cc538f255c614838821dd2b379ba2832
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 23 Jan 2013 08:42:46 +0000 (09:42 +0100)]
Fix crash when using continue in switch inside loop
Statements like switch() call enterLoop() with a null continue block.
However it is permitted to use continue inside a case in switch, and
that should then continue in the next outter loop that supports it.
Change-Id: I723d2dad3123a2a658964d541522c7961f578dbf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 23 Jan 2013 08:37:13 +0000 (09:37 +0100)]
Fix test results to match exceptations on i386
Use SSE math instead of i387 to get the expected results for
ch08/8.5/S8.5_A2.1 and ch08/8.5/S8.5_A2.2
Change-Id: Ide1a29340c5ea7a786a679ceb4712c033c6e7fd8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 22 Jan 2013 21:43:07 +0000 (22:43 +0100)]
Fixed remaining failures for Array.prototype.reverse
Change-Id: I688a35f8873012efa3202b18d050542a6ddde196
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 21:23:59 +0000 (22:23 +0100)]
Fix remaining test failures related to Arguments object
Change-Id: I294da46457858c14c6d438cfc022d3144d4385d0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 18:25:02 +0000 (19:25 +0100)]
Fix remaining issues in the URI methods
Change-Id: I0a402fb38f72d067b9bccae1b0c85cfca2cc2812
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 16:24:25 +0000 (17:24 +0100)]
Fix memory corruption in the MM
We never free objects ourselves anymore, and the code here
would only lead us appending the last object in the free
list a second time.
Change-Id: I2aa7bd10fbb0990c990d6948124443d222cf82f5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 15:39:16 +0000 (16:39 +0100)]
Don't convert the this object twice
Pass the converted this object to call, instead of
having call maybe convert it once again.
Change-Id: I64496548fe62cf42ee582f4eaa0a666945fd57f9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 15:12:12 +0000 (16:12 +0100)]
Fix length property of global utility functions
Functions such as parseInt must have a correct length property
that is read-only.
Change-Id: I91d9a8709c9a2ee23c72388a8737b8761357a285
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 14:20:35 +0000 (15:20 +0100)]
Fix thisObject for all builtin function calls
Even when doing
var v = Object.prototype.valueOf;
v();
the thisObject must not be converted to the global object automatically, i.e.
remain null. We previously implemented this lack of conversion for apply() and
call(), but it does in fact apply to all built-in functions.
Consequently we can get rid of callDirect and the virtual maybeAdjustThisObject
function and instead just do the "tweak" with the help of a little boolean.
Change-Id: I93bc37f4c6e896d6dcf169aa74953b0e460312ce
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 22 Jan 2013 14:26:32 +0000 (15:26 +0100)]
Add escape and unescape to the global object
Change-Id: I46353c10a44856c0358e811f5356238721d4a1ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 14:13:15 +0000 (15:13 +0100)]
Add URI handling methods
Change-Id: Ieee66aa1f95e6676316c4504b4874d307f5b3564
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 12:52:13 +0000 (13:52 +0100)]
Fix String.prototype.slice with boundary values
The bounding must be done on doubles to be spec compliant.
Change-Id: Ic4a0311893680ca3855fe83e5075f65b05a26abf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 11:28:43 +0000 (12:28 +0100)]
Fix String.prototype.substring when called with undefined end value
Change-Id: Id5c9563d492c5a15881cb4190dc9e8cd20284d31
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 13:53:46 +0000 (14:53 +0100)]
Fix bug in property table
When inserting a new entry in the property table and we're reusing
an entry from the free-list, make sure to assign the name correctly
to ensure we calculate the correct bucket according to the _new_
name and not the name from the old re-used property.
Also removed unused isEmpty() method that doesn't return the
correct thing anyway (_propertyCount is never decreased).
Change-Id: Ifc4f2f6b1c5fe975e30bdc81386061d6215ad3e3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 13:06:22 +0000 (14:06 +0100)]
Fix name of Array.prototype.toLocaleString method
Change-Id: I7347f25e07ee99a332b8e5f4b6cc50aac1c2bb70
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 11:20:31 +0000 (12:20 +0100)]
Run the tests in a simulated pacific time zone
Some date related tests rely on this.
Change-Id: I764392d8bfdc1f738bb218d43bc234b901384c78
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 11:15:51 +0000 (12:15 +0100)]
Fix name property of Error prototype
Change-Id: I21445a63a807d6a54bf8d8523fb901ae83f674a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 22 Jan 2013 10:59:38 +0000 (11:59 +0100)]
Fix Math.toString()
Change-Id: I6fc901c7b9c1ca625a13ae8417f931c2fc948fe9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 21 Jan 2013 16:21:36 +0000 (17:21 +0100)]
Implement String.prototype.split
Change-Id: I676bf6b9338ac6ce3aebadc6007858983d45f02e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 22 Jan 2013 10:53:08 +0000 (11:53 +0100)]
Fix a bug in Array.proto.indexOf for sparse arrays
Change-Id: I113c242b057ee4c6f2d06edf17e8bf8b453ba58c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 09:57:38 +0000 (10:57 +0100)]
Fix remaining test failures in Array.prototype.push/pop
Change-Id: If645e8d4628f252ffc3e96037cdc3749d6cf2ddd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 09:24:58 +0000 (10:24 +0100)]
Fix remaining issues in Array.prototype.(un)shift
Change-Id: I872abc79656511806955337a15d0fc04b8b286f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 08:31:56 +0000 (09:31 +0100)]
Don't clutter the source dir with .o files
Change-Id: If265752cb7ce3e55321e0dc0db7fbaa4369d9af4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 22:07:22 +0000 (23:07 +0100)]
Fix remaining issues in lastIndexOf
Change-Id: Ice23d8af32e26909757cadf5d4a0257d7926ca31
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 21:34:02 +0000 (22:34 +0100)]
Fix a few bugs in Number.prototype
Change-Id: I1ab95c019b628c3e298f88ea8d5b7f8b4d560aee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 21:17:55 +0000 (22:17 +0100)]
rename qv4ecmaobjects.* to qv4objectproto.*
Change-Id: I4bf60a424542cb7e53d54011ac5d0c503453913f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 21:14:55 +0000 (22:14 +0100)]
Move Boolean object into it's own file
Change-Id: Ia62b223111fa41877bc24b6320f0078a3546c55b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 21:12:05 +0000 (22:12 +0100)]
Move Number object into it's own file
Change-Id: Ie431e653956efa35dc92523e236af1097d57bab9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 21:03:14 +0000 (22:03 +0100)]
Move ArrayCtor and ArrayProto into their own file
Change-Id: I304f50704dbad396abc7c6c8ae73d454ebd73e01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 20:56:04 +0000 (21:56 +0100)]
Move masm into 3rdparty
Change-Id: Ie3645603149a4e054ebe658ef216fb6cd207b740
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 20:54:53 +0000 (21:54 +0100)]
Move qmljs_object.* to qv4object.*
Change-Id: I846958875eaa2feae51e3a70290a197dd40bcb12
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 20:48:51 +0000 (21:48 +0100)]
Move math object into it's own file
Change-Id: I01f00659f01ff11a401dedf1ce27b16d31d0f4f9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 20:43:15 +0000 (21:43 +0100)]
Split Regexp object into it's own file
Change-Id: Ib24f4a42d2312291b3a10d2a02fad33a1eb4b5b5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 20:36:12 +0000 (21:36 +0100)]
Move Error Objects into their own file
Change-Id: Id45f3c38b3effb0087a4782049b5d3184d7f9891
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 20:26:25 +0000 (21:26 +0100)]
Further split up qv4ecmaobjects and qmljs_objects.
Change-Id: I3dbcf7f9209a2c8ff601b64ef722640181dbb6f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 17:43:03 +0000 (18:43 +0100)]
Implement RegExp.prototype.compile
This method is a non standard extension, but supported by
all engines, and even used in the test suite.
Change-Id: Ie75c840d4da13bd1a62aa7567e8ea2737d31d33e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 15:01:28 +0000 (16:01 +0100)]
Fix implicit this object for value based calls inside with() blocks
Change-Id: Id1d18623ff84e41f2a3c08df8a13648ae49fc4ae
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 15:01:07 +0000 (16:01 +0100)]
Minor optimisation
Change-Id: I8a13ab2e7bc74f3e467106880232a795c6c4404c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 13:20:19 +0000 (14:20 +0100)]
Move the String object into it's own file
Change-Id: I3efc9aeaaa7c851715a996e5cbc149fa87cf5503
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 21 Jan 2013 13:07:48 +0000 (14:07 +0100)]
Fix certain new member expressions
Non-temp/name/member expressions need an intermediate move/temporary, in
visit(NewExpression *ast) as well as in visit(NewMemberExpression *ast)
Change-Id: I2f367c6285bb98d8445b93f924979431f1e5ff11
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 21 Jan 2013 12:46:44 +0000 (13:46 +0100)]
Implement String.prototype.search
Change-Id: Id151161bda4ab5012af33a49fac11a9b7e82ec0e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Mon, 21 Jan 2013 12:46:39 +0000 (13:46 +0100)]
Implement String.prototype.trim
Change-Id: I6bbe52f77221a0e5bd8d9f275983a0513c7c50e0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 12:27:42 +0000 (13:27 +0100)]
Fix the remaining test failures for the Date object
Fix the length property of the Date constructor
add Date.now() and Date.prototype.toJSON()
Change-Id: I968babfe17f6e45c8fd08f32b36eb5facc8601ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 21 Jan 2013 08:20:03 +0000 (09:20 +0100)]
Implement String.prototype.replace
Change-Id: I60806b6563337c1c18a6b737e860deca4093c8ff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Mon, 21 Jan 2013 11:33:59 +0000 (12:33 +0100)]
If a function is defined twice the 2nd one should be used
Change-Id: Id84663c319dd045e0f1e60b3300523a59f898b0e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 10:57:17 +0000 (11:57 +0100)]
Move the Date Object into it's own file
Change-Id: I3f94fa1dcfc8e23414ee2b3f96cffffa1f753bc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 21 Jan 2013 10:39:08 +0000 (11:39 +0100)]
Fix Date constructor and add Date.prototype.toISOString
Change-Id: Ib905639ed903cccdeb2649374f744a1fc64f3c1c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Mon, 21 Jan 2013 09:57:09 +0000 (10:57 +0100)]
Member expressions on non-objects should throw a type error
This is covered by the 11.2.3 tests
Change-Id: I74ccda815a0d6c4ba1f7eb25ce327cbb3bb30d48
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sun, 20 Jan 2013 20:54:29 +0000 (21:54 +0100)]
Fix writable attribute of RegExp properties
Most of the properties are in fact not writable.
Change-Id: I21a8c97fb98ef3c583b284093ec9be52b72b1544
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sun, 20 Jan 2013 19:38:35 +0000 (20:38 +0100)]
Fix exception handling in masm backend
The return value of setjmp is an int, which we interpret as a boolean later. We
cannot put it directly into a VM::Value, because it isn't one. Instead we have
to store it properly with value and tag.
This worked by "accident" on x86-64 where the return value is in eax and not
clobbered until we do the type test. But on ia32 we do rely on a proper value
representation.
Change-Id: Id54072c31baf6ad4607626dad939c715d2092d3d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Thu, 17 Jan 2013 21:10:35 +0000 (22:10 +0100)]
Fix compiler warning.
The usual class v.s. struct forward decls. Only fatal on Windows, not on
any other platform.
Change-Id: I902dd82b196663fc66e3bd914002a2961668455f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Jędrzej Nowacki [Mon, 14 Jan 2013 15:10:56 +0000 (16:10 +0100)]
Remove broken result of an automatic merge resolution.
Change-Id: Idc86a0cc2175c11e5b40f9c28e294bd0a7d033eb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Jędrzej Nowacki [Mon, 14 Jan 2013 15:15:01 +0000 (16:15 +0100)]
There is no point in checking twice for a space if gc was not run.
Change-Id: I60234eaba3db7ee6c52b4487a12e403116dbf254
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Fri, 18 Jan 2013 21:19:33 +0000 (22:19 +0100)]
Implement JSON.parse
Change-Id: Ibb5f9226aaaea8653842c5a452e006dc05210a2c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 18 Jan 2013 19:22:07 +0000 (20:22 +0100)]
Fix valgrind warnings about uninitialised variable
Apparently gcc was miscompiling the code with boolean
bitfields. Changing them to uint's makes all errors
go away.
Change-Id: I95e856e4b5ebca0d10fa250a8a4640697998ff38
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 18 Jan 2013 12:48:03 +0000 (13:48 +0100)]
Optimise array access
Optimise accessing indexed properties in Objects and
Arrays
Change-Id: I3330a4151a13e8f34fee1c4641e64d00a52625e2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 18 Jan 2013 15:41:42 +0000 (16:41 +0100)]
Fix wrong index access in one variant of Array::at()
Change-Id: I94dc9b08a446ec8d6e26b672a3272365ba9ed320
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 18 Jan 2013 13:38:29 +0000 (14:38 +0100)]
Get rid of virtual __get__ in RegExpObject
Instead implement the properties as run-time initialized properties. Fixes
also a bunch of tests that verifies that they are own properties.
Change-Id: I3c4ba52edcec2b59020a2966436b33b2ca5d7f46
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 18 Jan 2013 12:28:00 +0000 (13:28 +0100)]
Get rid of __get__ implementation in ErrorObject
As a step towards making __get__ non-virtual we can implement the message
property instead using run-time initialization.
The Error.prototype object must also provide a message property with
the empty string as initial value (15.11.4.3).
Change-Id: If8a7fd828e6c6fa6e20607505b392d0bda71f90a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Fri, 18 Jan 2013 11:47:43 +0000 (12:47 +0100)]
Remove the need for virtual __get/set__ methods in ArgumentsObject
In addition to not needing virtuals anymore, it also fixes a few
corner cases in the test suite.
Change-Id: I9f93d820aa7700c038c60a55daa57e1567d42b17
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 22:03:07 +0000 (23:03 +0100)]
Implement String.prototype.match
The implementation is not very performant, as it simply
is a straight implementation of the standard using
RegExpObject. In the long term this should probably
use a RegExp directly instead.
Change-Id: I532909b3fa8555bf1c16378e2650ca4debedd4b2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 21:22:39 +0000 (22:22 +0100)]
Implement Array.prototype.reduce/reduceRight
This fixes another 380 test cases
Change-Id: I9a09bf1cd992a3a370d8e3156a612c91dc95d3b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 20:58:24 +0000 (21:58 +0100)]
Implement Array.prototype.map/filter correctly
Fixes another 260 test cases.
Change-Id: I4f6299119c1859dced1fd2f50c3e5d7f0ed133ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 20:19:53 +0000 (21:19 +0100)]
Implement Array.prototype.every/some/forEach
The old implementations of these methods were pretty broken.
These fix 99% of the test failures related to these methods.
Change-Id: I09d45411c85252a9ac7db8dccc644d51b3a31503
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Thu, 17 Jan 2013 15:49:19 +0000 (16:49 +0100)]
Changed reachable Q_UNREACHABLE into Q_UNIMPLEMENTED.
They are probably unreachable, but this way we get notified if they are
reachable after all. Easier to fix than silent ignoration.
Change-Id: I2eafb6ad9fe4bdd7cba9490e9e4f991bb96c5715
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 17 Jan 2013 14:24:58 +0000 (15:24 +0100)]
Fix values of RegExp.lastIndex property
The property should be writable and also set to 0 if no match is found.
Change-Id: I4288ad239980260c7610c5de0061cc42ac38bb7a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 17 Jan 2013 15:21:44 +0000 (16:21 +0100)]
Update test expectations
Change-Id: I202e5e6ce8648266a48f12c2663a07816f0f9e10
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 14:33:21 +0000 (15:33 +0100)]
Implement Array.prototype.lastIndexOf
Change-Id: I474dc9fe1f303cb5f77ba5efaa219f1c0f411cb6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 13:26:01 +0000 (14:26 +0100)]
further fixes to indexOf
Change-Id: Iae083e42a38f4b3d16163bce51ff0ad9a97e48dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 13:01:16 +0000 (14:01 +0100)]
Update test results
Change-Id: Ib7ce4d5907b9c02caad933e8159e2cca7bab6230
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 12:42:42 +0000 (13:42 +0100)]
Fix our NaN boxing.
-NaN was not recognised as a double, but as a pointer,
leading to wrong behavior and crashes.
We actually have one more bit available, so let's use it.
Change-Id: I505ed5748228e4337d99da3b4eda43960967e117
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 17 Jan 2013 12:42:13 +0000 (13:42 +0100)]
Fixes to Array.prototype.indexOf
Change-Id: Ia9a2a8e25223c4b4d72a59c0c2ea449dc544f796
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 16 Jan 2013 23:45:11 +0000 (00:45 +0100)]
optimise property access
Inline the canPut method and simplify our code path for
[[put]].
Change-Id: I4198b0bdef16a4fdf6113a8e015915492c9c301d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 16 Jan 2013 16:56:29 +0000 (17:56 +0100)]
Implement Array.prototype.splice
Change-Id: I678e2836b677066b42a05f5b7b5b30eca7e8120c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 16 Jan 2013 15:55:42 +0000 (16:55 +0100)]
Changed signature of constructActivationProperty.
Change-Id: Ic4aa2b85dec0a732382dd5ae5a7e37d54476db3a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 16 Jan 2013 15:48:48 +0000 (16:48 +0100)]
Fix prepareCallArg and prepareCallArgs.
Change-Id: Id8b1e16de2a572e2c6e4dfe4d55adcbd63a92fa1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 16 Jan 2013 15:29:28 +0000 (16:29 +0100)]
Fix interpreter regression in callBuiltinInvalid.
Also changed the method signature to be more precise and less
error-prone.
Change-Id: I131a0cf90167743341faa5de3e70815c90ccd989
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 17 Jan 2013 13:44:47 +0000 (14:44 +0100)]
Fix length property of RegExp constructor
Change-Id: Ia53711914957ed2f6b02dc678dc98161177c4f90
Reviewed-by: Lars Knoll <lars.knoll@digia.com>