| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Fixes expected failure of ch12/12.8/S12.8_A1_T2 and others
Change-Id: I261d649f6a29bbd6debfca35e7ccaf1a0a7006b9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: Iae09ec815e3307615299bf97741716b3671c9560
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
Implement support for defining accessor properties
through { ... }. Implementation for moth is pending.
Change-Id: I558b6811bc5656dc0fae78c49e23155043ce9cb1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Also fixed up other error messages.
Change-Id: I26bfab761ab6a8ced3755a8e3dfbc42d428194e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: I5c6903446a252139fde4ce180f6c01a5eff85406
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
throw in strict mode, and ignore delete operations on
arguments otherwise.
Change-Id: Icd55f1c99dc5e5c35b3fea1ce5fdf46d5295dbaf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
| |
We now pass most of the test cases for it.
Change-Id: Idc43a9baa75c3c1e8fe760d78cf5e6092f051c6e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When clearing cross-references to unused basic blocks blocks, don't
delete the block right afterwards because another block might also
still reference it. Instead keep track of the ones to be deleted
and delete them afterwards in one shot.
Also replaces the existance check for the blocks from a linear
vector search to a hash set lookup which we already have around.
Change-Id: I3bd72359259065ba26bf2116bf849575e4601f32
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
| |
Make sure we have the correct set of nested functions in
both IR::Function and VM::Function. This is required so
that closures can work correctly.
Change-Id: I42493d5ee503090653b71650c8d19e06c4bcfdda
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
Take care of some corner cases and make them pass the
test suite.
Change-Id: Ic83508859800c62681ee873968b475ef81fffb82
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
These operators have semantics that are different from
(foo + 1), as they always convert the LHS to a number first.
Change-Id: I3fb4a1a328e3dfcb334875435c3cec90d01b67dd
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
|
|
|
|
|
| |
Change-Id: I2c79d7c8c5f8624a5cfd5cb1c5af1488ccd5aada
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: I8ccb47cae3214ab2ac8ed51657856f51fc6c4e95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
The cleanup list is local to a function definition. Otherwise inner functions
would create cleanup code for try statements in outer functions leading
to crashes.
Change-Id: I5d35893b0ea6b0692cda44d5b34b0bb3dfc93fdd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When linearizing, we can sometimes remove some basic blocks
that are never being jumped to. In this case we also need to
clean up the back references to these blocks from other
blocks.
This fixes a valgrind error with SHOW_CODE=1
Change-Id: I07d74cef24d6cf2c8bcc1e748e314a3a5b5ed60a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
Make sure the this pointer is setup correctly for
function calls. Also make sure we set the strict mode
flag correctly in all functions.
Change-Id: Idaacc92bf6469145b7addfac2bbddea588e85c2d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
|
|
|
|
|
|
|
|
| |
Don't crash on e.g.
var x = new (function() { return this; })
Change-Id: I120410b40ecda7fdc41e1dcc2c17251397143bc1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
delete and typeof need to get correct references as arguments.
But we still need to evaluate other expressions correctly. The
best way to do that is to store them in a temp.
Change-Id: I7bcd152742bf752df47fd63a837952c57ea70bf5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: I90cd2b34a25476dfee1ec01315275b6c179d11dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
Todo:
- stack walking for MASM
- fix all TODOs/FIXMEs and hidden treasures (bugs).
Change-Id: I36f8cdc3a545df7287ce1df17b3570a9c017865e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
Strings are the only non-Object Values living on the heap. So by
tracking creation, we can help the future GC a lot.
Change-Id: I5d5044f9ff10da42aeb75dd4a556d6ab3d839b1a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
Use the contexts strict mode flag to correctly parse
eval code inside strict mode sections.
Add code to allow the code generator to throw syntax
errors.
Change-Id: I4e4258b0d0b88952f4d609ec51bbe8db9a1c66a9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old code was not correctly handling statements as
try { return; } finally {...}
and others. In addition it was hard to read an maintain.
We now keep a stack of try statements inside the code
generator. Loops know about their surrounding try statement.
Whenever a break, continue or return statement is encountered
we now generate code for the finally statements and exception
handlers we need to cleanup.
Change-Id: I53bcc0587f1e923be00fea9b562453ef1e96b2de
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
This currently mainly intended to be useful in a C++ debugger. The
infrastructure makes it a lot easier to access (parent) contexts, find
function names, etc.
Change-Id: I0493d3a3bd4bf5c3a03379c1a2b545ed76862cd5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
| |
Change-Id: I88e48a982eb6d4041aed085de0420d98cf96d406
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
This fixes cases where eval() would create variables
in the wrong scope.
Change-Id: Ie93ec2d1fb125e588c1b6ffa2ca8ca4b6e3112c9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
|
|
|
|
|
|
|
|
| |
Happens in valid cases like an empty JS file (or one only containing
comments).
Change-Id: I553f57503b46da29276b06532a14e2a74395d84c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the with object (list) to the environment, and check properties
there if it's available.
Generate IR statements implementing with() support.
Add two new builtin methods to enter and leave a with scope.
Implement support for the builtin's in masm.
Make sure exception handling works across with scopes.
Change-Id: I8257a16cfccc91a1acedfd740ade711b016b33fd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Variables need to be bound to the execution context
before entering the method. For the global scope this
implies that declared variables are available, but may
be undefined. The lines:
print(x)
var x = 1;
has to print 'undefined' and not throw a type error.
Change-Id: I9d7062823da83cd4c4e74588693bb0ce8dc85c6b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: If0f07c995a51df45603c5581c721da15c1050158
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
Uses a variation on linear scan register allocation as the algorithm. As
it depends on liveness analysis, keep that data around after codegen is
finished (in IR::Stmt::Data). Added clean-up code for it in the
IR::Function destructor.
Change-Id: If3636648efbafcc1df469a24aaa885e21e6a2f16
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
This block was used for the old exception handling mechanism
that is not in use anymore.
Change-Id: If5adf89e43a22ab167378827c0e97f9907d8a366
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
|
|
|
|
|
| |
Change-Id: I8c4e2c34b2a3803d1346a1f716a0e40bde6bfdff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
If the break/continue trampoline blocks get reached, there cannot be a
pending exception, so don't bother with saving it.
Change-Id: Id079d48d961f21dd236dbc33fad1712edbd2df97
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Save the (unhandled) exception, because there might be another try block
with a catch in the finally block. Restore it at the end of the finally
block.
The codegen for the finally, which is also needed for the break/continue
trampoline blocks, has moved into a helper method.
Change-Id: Iff28506b92a3749c6a5585fb6d94f3120696e89a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
| |
Change-Id: Ic12a54ab1c5789cc5684d38961c58f6b34f9597a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
|
|
|
|
|
|
|
|
| |
The tricky part is that a break/continue in a try or catch block must
still execute the finally block.
Change-Id: I5215c1b5688d87f3c9d1dd168eed7f3555bae22a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to use expressions such as
%x = %y + const
in the IR.
This still requires an implementation for moth.
Change-Id: I134e96ddad08bcbe4f3ea5fa27c5338a96acac80
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
|
|
|
|
|
| |
Change-Id: If89306aa91995e84106437a802e1d6d1940f17e7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
| |
Change-Id: I3ff229740820883a99dee6e32370fc528bf9169c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
| |
And don't dump the assemply unless SHOW_CODE is set.
Change-Id: I17ad36f002404b57c65f910048e5c82d42307976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: I90823a97331fd15a8289bab93d7e9c1f34aaa10d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|