Commit Graph

18 Commits

Author SHA1 Message Date
Erik Verbruggen e0a5c8cbde Check if "use strict" has no escaped chars.
Change-Id: I7dc172eba02d454467ead1e18a1a59e98890dd54
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-03-18 20:58:15 +01:00
Lars Knoll 2ec09791eb Rename qmljs_runtime to qv4runtime
Change-Id: I46ba9b2621be72116d94bee249ad5b798e951c88
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-03-14 22:15:02 +01:00
Lars Knoll 1a9689d315 Rename qmljs_environment.* to qv4context.*
Change-Id: I6fe62b501803422f78b47a87c55e4278820725aa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-03-14 21:12:59 +01:00
Erik Verbruggen 99e0b7a74f "Fix" llvm build.
In a way that it the compiler doesn't complain anymore.

Change-Id: I877b1a051b2ffcbd63a04cf219733b2b21cb9128
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-03-07 22:38:53 +01:00
Lars Knoll 0eb9899df5 Cleanup put and properly implement it for strings
Change-Id: I10dda09c8a087bc7ef34c0315c698e08c35ec28d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-03-07 14:15:54 +01:00
Lars Knoll 1196824e7a First part of moving get/put etc. into the Managed vtbl.
Change-Id: I6fe14b02205901dbffa25c6c1b4883fb99586417
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-03-07 12:30:38 +01:00
Simon Hausmann 85e92adeb6 Get rid of 'Value ExecutionEngine::exception' member
Instead the JS exception value is now part of the C++ Exception object.

This also allows getting rid of some run-time functions.

Change-Id: I43ff773cacd5e925ba96601f3633ccf3b62273be
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-03-06 22:19:32 +01:00
Simon Hausmann f09042c2ee Move function execution into a little ExecutionEngine::run helper function
This will allow for re-use from the v8 wrapper API.

Change-Id: I2330432dad43d7fd7af6147e96a0cbbb340cd917
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-03-05 16:34:10 +01:00
Simon Hausmann 2cf8be29bc Cleanup: Get rid of manual unwind stack
Instead of doing the ExecutionContext unwinding at the time of throw, do it
at the time of catch, conveniently through an accept() method of the Exception
object. That allows us to get rid of the separate handler registration stack.

The only tricky part are that some execution contexts are allocated on the stack.
When exceptions are thrown through that, we have to catch, unwinding up until that
point (or rather the parent of the stack allocated context that's going to be
deleted) and then simply rethrow.

This patch also gets rid of the __builtin_delete_exception_handler. The next patch
will rename the remainder to what it really does now.

Change-Id: I00bb113b3a2fe24f7054c03fdfb8fed5cc1258b1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-03-04 13:15:10 +01:00
Simon Hausmann ee967a10f2 Implement JavaScript exceptions using C++ exceptions
Instead of registering catch handlers with setjmp and throwing JS exceptions
with longjmp, they are now thrown and caught as C++ exceptions. This allows for
tight interoperability between C++ and JS in the future and allows for clear
semantics with regards to cleaning up memory in the engine when throwing
exceptions. (destructors are guaranteed to be called, unlike with
setjmp/longjmp).

The recent unwind table additions allow for the exceptions to be thrown through
JIT generated code.

Catching the exception is done by re-using the existing IR semantics where the
beginning of a try block is marked by registering an exception handler.
Execution after the registration continues conditionally, based on the return
value of builtin_create_exception_handler. A return value of is 0 the try
block(s) are executed. If an exception is thrown during that time, execution
resumes at the point where builtin_create_exception_handler returns, but with a
return value of 1. If an exception is thrown within the catch handler, the
execution resumes again at the same point, but the inCatch IR variable will
guide execution straight to the finally block(s), which calls
delete_exception_handler.

In the JIT as well as the interpreter this is implemented by entering a C++
code section that contains a C++ try {} catch {} block, in which the calling
function is called again and continues right at the next instruction (or the
interpreter loop is recursively entered). An exception will throw us out of
that scope and back into the try {} catch {} wrapper, which can call again
into the calling function.

The IR guarantees that delete_exception_handler is always called, regardless of
how the try or catch blocks are terminated. That is where in the JIT and
interpreter we return from the nested function call and return back into the
original stack frame, effectively unregistering the catch handler.

Further cleanups with regards to the naming and the exception handler stack
will come in subsequent patches, this is merely the minimal patch set to
change to the new mechanism.

This patch set breaks ARM until ARM exception handler tables are implemented.

The interpreter changes are based on a patchset from Erik
from https://codereview.qt-project.org/#change,45750

Change-Id: I543f2bd37b2186f7e48ffcab177d57b5ce932a0c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-03-03 20:35:56 +01:00
Lars Knoll 76db0051d9 Silence compiler
Change-Id: Id248400c50609811baebb1ea710210915e5274c9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-02-14 14:57:40 +01:00
Lars Knoll 1056456cb5 Move call/construct over into the new vtable.
Change-Id: I4f58a1fac25440695bdc62a49adb51a887616a5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-02-14 14:57:00 +01:00
Simon Hausmann 63cd0f745b Fix print and gc in builtin v4 method
Also removed unused TestHarness stuff.

Change-Id: I6332d9a34f471df07cfa0e9709a203e99a48b524
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-02-14 12:33:47 +01:00
Lars Knoll 4be3e75734 Implement a first iteration of the fast property lookup scheme
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>
2013-02-12 22:48:19 +01:00
Simon Hausmann 11bbb8689b Remove unnecessary sys/mman.h inclusion
Change-Id: Ic4bbc6a595849042a9c970ba2d0ad5785fe1b89a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-02-09 10:40:59 +01:00
Simon Hausmann 361c5ea65c Fix exports in v4 binary
Don't use the export macro on internal debug classes.

Change-Id: Id2f8069cc8b6703a3fafd3058524d46252eb57f8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-02-09 10:38:10 +01:00
Erik Verbruggen ce5af0c803 Fixed the llvm bits of the build process.
Change-Id: I618e0ee413e9548817f84473917ccb8051f689f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-02-06 08:48:12 +01:00
Lars Knoll b1d9d6efa2 Make things more compliant with a regular Qt module
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>
2013-01-31 07:01:54 +01:00