Commit Graph

70 Commits

Author SHA1 Message Date
Erik Verbruggen 4bd20c2ac3 Throw a SyntaxError instead of printing an error message.
Change-Id: I94ef8a4f2bea80bc3689b104e381a9dc134439fa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-28 12:31:20 +01:00
Lars Knoll 61460c7859 Fix a bug in Object::__put__()
The method was always throwing in strict mode, due to
a missing return statement.

Change-Id: I85e44f8067d1f2aea76d03e42abf31a0d5a2d180
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-28 10:00:02 +01:00
Lars Knoll 94a344c01a Obey strict mode for property getters and setters
Change-Id: I6f51cd72c2607989c55373dfee53130381f5ef75
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-28 09:59:26 +01:00
Lars Knoll b320af12eb Implement the first parts of strict mode.
Tested with eval() which now obeys strict mode
semantics.

Change-Id: Ib3c7f31047e43c1ef0fa74261f23ec4f2ea4244f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-28 09:56:17 +01:00
Lars Knoll 15326415d1 Fix some issues with the delete operator
Properly implement delete operator for identifiers
and local variables.

Change-Id: I8ac55edc80c31a94d11444c9f5c78caf4b131c95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-25 10:21:12 +01:00
Erik Verbruggen 7704d8b3b6 Keep the EvalISelFactory in the ExecutionEngine.
Also corrected the class name cApiTaliSatiOn.

Change-Id: I131566e904c8ee575686a469f16d098dd512d865
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-21 15:47:14 +01:00
Lars Knoll 79753b8fe5 return results directly instead of using the context
The result variable in the context is not really
required, as we can return results directly in the
return value register.

Change-Id: I12554c228500aa24625ef82e31fd7f72989a71bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-20 09:40:14 +01:00
Erik Verbruggen e1bbbb6cf9 Fix isel for eval and a whole bunch of other warnings.
A factory is now passed along to do the codegen for eval().

Change-Id: If15b1f28c9c0a8f8b6d18b56d6e7bc5d942927e5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-19 14:02:58 +01:00
Erik Verbruggen b072fd9317 Added isNaN and isFinite to the global context.
Change-Id: Ia85d27a6ac82fd5dbf6b0f706747afa6418626b1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-19 13:57:51 +01:00
Lars Knoll a267688480 Better handling of contexts and environments
Make the ExecutionContext standard compliant.
Move most of it's members into a new
DeclarativeEnvironment data structure that
contains locals and arguments.

Change-Id: I094f559168810dbd3717d677fe28750076015976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-19 10:33:35 +01:00
Lars Knoll 65724ce3e7 Move the engine and context classes into their own files
Change-Id: Ie20138990908a921ca3d7475618275ed82d9cb5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-19 10:29:07 +01:00
Lars Knoll d7416a80fa Rename Context to ExecutionContext
This is so it'll map to the name used in the
ECMAScript spec once the other refactorings
are in.

Change-Id: I8dcc7ad43b457ce50e7123c57bc4c770bcda8d11
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-19 10:28:56 +01:00
Lars Knoll d6553a206b Create a proper function object for eval
Still doesn't work correctly, as we can't modify
the global context there.

Change-Id: Ifd0ab217c3cf2d0c1b86f09907b440ea31c29ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-18 13:21:21 +01:00
Erik Verbruggen ef25fdacc8 Do not save/restore interpreter stack for exceptions.
Only the instruction pointer and targetTempIndex are needed.

Change-Id: I21279d68e74dac42d875e3ced9004e9d3c42c29d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-15 22:05:33 +01:00
Erik Verbruggen 72b478b8a2 Added all missing error objects.
Change-Id: I806184c5593af44d79b21afb1e3235ec9afa1e2a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-15 13:45:42 +01:00
Lars Knoll bd63199bba Cleanup Context initialization
Make the initialization for call() compliant
with the standard, and add a strict mode boolean.

Change-Id: I8617af8dbfde47d8b2a8a0a7ce0ab491031ba4ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-15 13:43:53 +01:00
Erik Verbruggen 68b099b8f8 Add missing message property to the ErrorObject.
Change-Id: Ice16360f98d1d66162440d972c6bfbc416884474
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-14 14:19:05 +01:00
Erik Verbruggen 8f69d75c78 Fix interpreter exception handling.
The stack frame of the interpreting function is restored, but all the
datastructures live on the heap. So, save them out on handler creation,
and restore them afterwards.

Change-Id: I84b84007cc9944b56926bf0387c2798f7841cd2a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-14 11:45:03 +01:00
Erik Verbruggen 6cf913c485 Fix property deletion.
Also tweak the bucket size calculation to be prime for just a bit
longer than.

Change-Id: I9fc6779956693301eb01a6558d4c20d8e39d8bad
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-12 23:16:50 +01:00
Lars Knoll bc42b47a11 Better argument ordering.
Change-Id: I1d47ce7bd2cf27bc43a0e9afbfb2914296c9d704
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-12 09:18:12 +01:00
Lars Knoll c5b258c21d Clean up inplace binary operations for subscripts.
Remove a lot of duplicated code, and make it a lot
easier to implement JS compliant semantics.

Change-Id: Ic5ecb58d34a5df8fe05e86c5f906d70c50c51b54
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-12 09:17:23 +01:00
Lars Knoll 0c1424362f Improve handling of binops on LHS expressions
Add a generic method to handle binops such as +=
to Object and use it. We can probably remove
most of the __qmljs_inplace_xxx methods later
on and call one generic method instead.

Change-Id: If7cbd2e3012ad381e29b9eec2059e17f02a0a38a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-11 21:24:43 +01:00
Lars Knoll d5fe0946bd Cleanup call and construct semantics
Implement proper call() and construct()
methods in FunctionObject, and remove
some duplicated initialization code.

Change-Id: I5c86f9f2cf6e4b65d23d000149db2b79c35538c4
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-11 21:24:38 +01:00
Lars Knoll 6f931118d6 Initial implementation of the Error prototype and constructor
Change-Id: Iffd1a01b75bc923c0cd8c0b786558be20a52ab2c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-01 15:58:07 +01:00
Lars Knoll 477ea45b0b Set property attributes more correctly
Also now check for enumerable in for/in statements.

Change-Id: I03a9968fc3d7f8f5e4eaf26591040acd9cc8ced1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-31 16:58:36 +01:00
Lars Knoll ddba8f6bb0 Conformant implementation of the object internal methods
See section 8.12 of the standard. This implements
8.12.1 - 8.12.7 and 8.12.9

Also gave these methods standard conformant names.
They are marked as [[foo]] in the standard, which
translates to __foo__ in our code.

Change-Id: I1990d6c6dd24e929c23d5c51d36f1e2e0a0a3b63
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-31 16:57:24 +01:00
Lars Knoll aa96410f3f Rework properties
This brings the basic structure or accessing properties
more in line with the EcmaScript 5.1 specification.

There's however still quite some work to be done to
make things fully compliant.

Change-Id: If55afd7ae6e4f7aa5ce06afe49b1453b537ac98b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-31 12:46:49 +01:00
Lars Knoll 577cbfa2ee Added basic support for 'for (var x in y)' statement
Change-Id: I8f3c8add78bebf92e0073348d1ecbdf3f328af6d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-31 12:45:49 +01:00
Lars Knoll 5f06c71bc1 Proper exception handling
Implement exceptions using setjmp/longjmp. The
advantage is that this removes all exception
handling overhead from regular code, the only
code that still has a (very small) overhead
is the try{} catch() {} statement.

Change-Id: I43d6a60dfc9dfd4b7a20d2e99ab0a9315b4d8a2f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-24 08:46:49 +02:00
Lars Knoll 04b12a90b8 Implement regexp support
Change-Id: I86c9bbe69c9ba4ae9d300b62e7d16b372f3478ea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-20 12:33:20 +02:00
Simon Hausmann c13a95361a Add missing license headers
Change-Id: I59d602a0f2c1fefb03994ed32a3d697b176791ff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-12 10:51:06 +02:00
Roberto Raggi 810011f45a Improve support for the assignment operators.
Also, use indirect calls in the amd64 code generator.
2012-06-11 09:38:52 +02:00
Roberto Raggi 5c869a3c81 Delete properties 2012-06-07 14:28:42 +02:00
Roberto Raggi bf46892ccd Move the defnition of the QML/JS Context to qmljs_runtime.h 2012-06-05 10:47:04 +02:00
Roberto Raggi 66a9d37813 Naive implementation of the Arguments object. 2012-06-04 16:36:00 +02:00
Roberto Raggi 08bd3ea09a Initial work on the RegExp object 2012-06-04 15:34:50 +02:00
Roberto Raggi 40eb19873f Fix default size for the bucket tables 2012-06-04 09:50:21 +02:00
Roberto Raggi 538ed5c57c Generate cx-instructions for releational expressionsa. 2012-05-30 12:42:27 +02:00
Roberto Raggi b25e575ba0 Fix [[construct] and Object.prototype.toString 2012-05-28 22:16:21 +02:00
Roberto Raggi 5b0f452f4d Implement instanceof 2012-05-28 20:17:13 +02:00
Roberto Raggi 7e7df11464 Fix the initialization of the ECMA library. 2012-05-25 17:45:15 +02:00
Roberto Raggi fc6f96166f Refactored Object 2012-05-25 13:43:30 +02:00
Roberto Raggi a5229e821d Propagate exceptions 2012-05-25 11:55:50 +02:00
Roberto Raggi 3bc997b2e3 Throw exceptions in the ecma library 2012-05-24 10:01:24 +02:00
Roberto Raggi 86183598a3 Throw exceptions 2012-05-23 18:50:24 +02:00
Roberto Raggi 0388eb704a Initial work on the Function prototype. 2012-05-21 14:58:23 +02:00
Roberto Raggi 945c988b45 Initial support for Array objects. 2012-05-21 09:52:55 +02:00
Roberto Raggi 860bd23e4d Improve [[DefaultValue]] 2012-05-18 15:28:59 +02:00
Roberto Raggi ccebbc0641 Implemented the ecma Date object. 2012-05-18 14:10:02 +02:00
Roberto Raggi 086e775da6 Some refactoring and some initial work on the Date object. 2012-05-18 10:10:36 +02:00