Commit Graph

236 Commits

Author SHA1 Message Date
Simon Hausmann 07860794da Initial support for debugging in the v4 interpreter
This adds breakpoint support to the Debugger, a helper function in the engine
for enabling debugging (which will switch from JIT to the interpreter) and a
DebuggingAgent interface, for use by v4 clients.

Change-Id: I78e17a6cbe7196b0dfe4ee157fc028532131caa3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-07-26 11:53:42 +02:00
Simon Hausmann 713a4c5b1d Fix FDE generation on Intel 32-bit
Make the generated FDE program reflect that ESI and EDI are callee
saved registers. For some reason the program we've had in qv4unwindhelper_p-dw.h
for 32-bit was already correct, but the generator was broken (and even mixed
up the registers).

Change-Id: Id8132580d20636c8ea17f8460d161547227c95fc
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-07-23 13:00:36 +02:00
Simon Hausmann 3a6f5735ee Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
	src/quick/items/context2d/qquickcontext2d.cpp
	tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro

Change-Id: I36a4fd28b3156839aecd70039a3ba566bf19a0bc
2013-07-22 13:43:43 +02:00
Simon Hausmann 8cfba7d015 Move QV4::Exception into a separate compilation unit with header file
This is in preparation for some platform specific code regarding throwing
exceptions, as well as a general cleanup :)

Change-Id: I23fb4f12fd09423a1f2cb225145780925002677b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-07-12 10:11:10 +02:00
J-P Nurmi 686f144cee qmlscene: ensure that the window & component get destructed
Task-number: QTBUG-32207
Change-Id: Ic7c45228cbdc049d3dfdb3482296d0e8c89a930c
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-07-04 14:35:03 +02:00
Simon Hausmann 972094c109 Disable the JIT on Windows/AMD64 as well as on iOS
Change-Id: I7402981caa2f73fd0712975e657488a4065f403f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-06-26 15:45:52 +02:00
Simon Hausmann 1a97598556 Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
	src/imports/qtquick2/plugins.qmltypes
	src/qml/debugger/qv8debugservice.cpp
	src/qml/qml/qml.pri
	src/qml/qml/qqmlcompiler.cpp
	src/qml/qml/qqmlcomponent.cpp
	src/qml/qml/qqmlcontext.cpp
	src/qml/qml/qqmldata_p.h
	src/qml/qml/qqmlengine_p.h
	src/qml/qml/qqmljavascriptexpression.cpp
	src/qml/qml/qqmlxmlhttprequest.cpp
	src/qml/qml/v4/qv4bindings.cpp
	src/qml/qml/v4/qv4irbuilder.cpp
	src/qml/qml/v4/qv4jsonobject_p.h
	src/qml/qml/v8/qqmlbuiltinfunctions.cpp
	src/qml/qml/v8/qv8bindings.cpp
	src/qml/qml/v8/qv8contextwrapper.cpp
	src/qml/qml/v8/qv8listwrapper.cpp
	src/qml/qml/v8/qv8qobjectwrapper.cpp
	src/qml/qml/v8/qv8qobjectwrapper_p.h
	src/qml/qml/v8/qv8sequencewrapper_p_p.h
	src/qml/qml/v8/qv8typewrapper.cpp
	src/qml/qml/v8/qv8valuetypewrapper.cpp
	src/qml/types/qqmldelegatemodel.cpp
	src/quick/items/context2d/qquickcanvasitem.cpp
	src/quick/items/context2d/qquickcontext2d.cpp
	sync.profile
	tests/auto/qml/qjsengine/tst_qjsengine.cpp
	tests/benchmarks/qml/animation/animation.pro
	tools/qmlprofiler/qmlprofiler.pro

Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
2013-06-24 11:48:46 +02:00
Lars Knoll 1e437db3e2 Remove the context argument from Managed::call
Change-Id: I0895f9a94af47c8aab1dc93579921737e9516f7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-06-22 22:28:33 +02:00
Lars Knoll 522c91f41f Remove context parameter from Manged::put.
Change-Id: Ib99e726ffbb20463d45a8444b4fbdfe32cd6dbef
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-06-22 21:54:09 +02:00
Simon Hausmann 258c120d82 Make it possible to evaluate JS with the v4 tool the QML way
Change-Id: I2a40e82612c2da1b52a37cbff2507951e4ac0349
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-06-17 21:20:41 +02:00
Alan Alpert 6586505e6b Add --noinstantiate to qmlplugindump
This flag allows you to run qmlplugindump on plugins which cannot safely
create objects, such as plugins with unusual requirements or missing
essential dependencies.

Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
(cherry picked from commit 0462193b6f)

Change-Id: I0d1ff7f94e00a8aab94c0aff012d78db5193400f
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-06-13 14:53:55 +02:00
Frederik Gladhorn 8b32e1cb76 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I045587eac266e9b6296d9cd9e3c73031fe18bbd1
2013-06-12 19:14:46 +02:00
Tasuku Suzuki 10a441e3b1 Make qtdeclarative compile with QT_NO_NETWORKPROXY
Change-Id: Ie7bf1e1d15da323f901f2c6b851a7b1e8ae0d832
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-06-11 05:27:31 +02:00
Tasuku Suzuki 3bc63f5251 Make qtdeclarative compile with -no-gui
Change-Id: I0c5a55c8f6b78450b2bce693bb55e12f8a224172
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-06-10 17:23:09 +02:00
Shawn Rutledge cf737d265f qmlscene: if top-level is a QQuickWindow, set incubation controller
The necessity for this is documented in the
QQuickWindow::incubationController() accessor.  Bug 31203 is about
writing a custom main() with a QQmlApplicationEngine, not about
qmlscene, but the same workaround is necessary for both.  Hopefully
soon we find a way to make it unnecessary, but for now it is.
This fix also doesn't take care of the QtObject { Window { } }
use case.

Task-number: QTBUG-31203
Change-Id: Ic9a5e4a23ac918593138dc9cab3de6cd36453eaf
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-06-04 10:52:15 +02:00
Alan Alpert 0462193b6f Add --noinstantiate to qmlplugindump
This flag allows you to run qmlplugindump on plugins which cannot safely
create objects, such as plugins with unusual requirements or missing
essential dependencies.

Change-Id: Ifcc542b8dec5358fc8a76d78a2a272c9cbf5d78a
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-05-29 16:23:51 +02:00
Simon Hausmann 6b5c964caa Fix file and line number reporting of QML/JS errors
* Replace QUrl with QString in V4 for the source location (we don't need URL parsing)
* Replace line number and file in QV4::Exception with the information we retrieve from
  the stack trace of the exception.

Fixes about five tst_qqmlecmascript tests that relied on correct file/line number information

Change-Id: I2a3daa72be6c5587fd965211ea8f6fb77142e7ee
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-05-27 20:35:25 +02:00
Simon Hausmann 8a822866b6 Add support for line numbers in stack traces (Linux/Mac OS X only at this point)
* Add support for debug annotations on statement boundaries to the
  IR, to get accurate line/column information
* Use binary search to retrieve the function and line number for a given
  program counter
* Save the stack trace in the exception class and print it in v4
* Fix initial line number in QV4::Script to start a 1, just like the initial column
  in QQmlJS::Lexer also starts at 1

The native stack frame tracing is currently only implemented on Linux and Mac OS X.
The implementation for Windows using StackWalk64 is still missing.

Change-Id: I771fe44816397e29c69952772a772bf0d985236f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-05-27 16:59:53 +02:00
Friedemann Kleint 745621a90b qmlscene: Set window flags correctly.
Task-number: QTBUG-31258

Change-Id: I13dfc17c75075de155505d20c57400753de0a71d
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2013-05-23 13:31:48 +02:00
Shawn Rutledge 04d4664167 qmlscene: don't call show() on the window if it's already showing
That way Component.onCompleted() can optionally do showMaximized()
without being overridden.

Task-number: QTBUG-31260
Change-Id: I6f5c3025efd3b38809be85da4172241695168a6c
Reviewed-by: Nikita Krupenko <krnekit@gmail.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-05-22 19:46:35 +02:00
Lars Knoll eb2269c1c3 Various fixes
Fix a regression in Script::run, and compilation for
v4 and an auto test.

Change-Id: I4026eebec0e02f4af03ca49ba714916ad90b34e7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-22 17:05:19 +02:00
Liang Qi 4d173d5f16 Tools: unnecessary to make qmlplugindump a bundle
Embed Info.plist in qmlplugindump executable in a special way.

Change-Id: I7eb73d0f832ab53d352c1fd2275f77e853269c2c
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-05-20 15:04:34 +02:00
Kai Koehne b11b7d53b5 qmlplugindump: Add explanation why it needs to be an app bundle
Since this is popping up quite regularly, add an explanation why
we need qmlplugindump to be an application bundle.

Change-Id: Iacf5ad0742aa9fb601c3be046f268764df062e81
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-05-08 17:20:52 +02:00
Oswald Buddenhagen ef1d624409 adjust to new "configure -nomake tools" semantics
Change-Id: I34ea6a8ea5f6f2641bf5deaf2a7136e5ed51a8ba
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
2013-05-08 15:01:47 +02:00
Erik Verbruggen 056f1ba351 Add flag to the engine to enable/disable RegExp JITting.
Change-Id: I4b632e6f8ab7cf20576f94764ed506de8be63efb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-08 13:15:38 +02:00
Fawzi Mohamed fa4cafacff qmlplugindump: add an explicit -relocatable switch
this will enable us to switch the default to nonrelocatable

Change-Id: Ic4bff6466ee2fb6d4d1dd89829034ad239422a7e
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-04-24 13:39:04 +02:00
Sze Howe Koh e72f577658 Doc: Fix module name format
Follow the conventions at
http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation

QtGui        -> Qt GUI
QtMultimedia -> Qt Multimedia
QtScript     -> Qt Script
QtSensors    -> Qt Sensors
QtSvg        -> Qt SVG
QtWebkit     -> Qt WebKit

Also fix a broken link to "Qt WebKit QML Types"

Change-Id: Ica6081024d3957a3ca2ef3d870f623506c69d877
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-04-23 18:29:25 +02:00
Lars Knoll 2adef4a961 Cleanups to QV4::Lookup
Better naming for the methods, deinline some code, add a generic
path for setters and prepare for moving parts of it into the
Managed's vtable.

Change-Id: Ide8d32181fdabdf34c910db20b28fb8f87167570
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-04-20 08:55:13 +02:00
Simon Hausmann 891f702945 Fix compilation with built-in v4vm JS engine
Change-Id: Ieda9267e296acf6392a5461f4cfb9233a7a409a0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-04-15 13:03:20 +02:00
Simon Hausmann 2cd8a90bd4 Merge branch 'master' of ssh://codereview.qt-project.org:29418/playground/v4vm into v4
This is the initial merge of the v4vm JS engine, designed specifically for QML.

The engine is tested on Linux and Mac OS X, works on x86, x86-64 and ARM.

Change-Id: I826b72cfa3d3575007b70d78604080582db568db

Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-04-15 12:47:53 +02:00
Fawzi Mohamed 3bbed9ee8f qmlplugindump: always output exportMetaObjectRevisions
Some people were confused about exportMetaObjectRevisions, and
the "all 0" as default was not expected.
Make it explicit so we might change the default in the future.

Change-Id: I1f208ba54e2b9aa1a5d46fb9971572467b69ab56
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-04-15 10:46:15 +02:00
Lars Knoll 8dfc088d2f Store the global object as an Object pointer in the engine
Change-Id: Ia8b010a9d9c9dd3aacb1b08ce34a42236fa73195
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-04-08 16:28:37 +02:00
Gunnar Sletta 1c85dc38fa Show fullscreen button in qmlscene on Mac
Change-Id: I3202e8e7461f457eeb73a82b7a8da40a11e4f76d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-04-02 08:29:49 +02:00
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
Oswald Buddenhagen d0af156930 optionally bootstrap QmlDevTools and qmlmin
QmlDevTools is really meant for host tools (the two only ones using this
being qmlmin in this repo and lupdate in qttools). qmake magic will take
care of bootstrapping them while x-building.

Change-Id: I29d921af483659d5455be0ad080dc1a88540c036
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-03-16 10:34:46 +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
Simon Hausmann 077a462c12 Tool to generate FDE and CIE tables using libdwarf
This makes it easier to generate the right magic bits and bytes
across different architectures.

Change-Id: I83cf8f348f4ea92febfe463e1ffd627808e1bb44
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-02-27 16:56:22 +01:00
Frederik Gladhorn 15dc45ce10 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ia02971527a2d1a80c5624d69330428818aab3a41
2013-02-25 11:57:50 +01:00
Samuel Rødal 3598931461 Fixed build when Qt is configured with -no-opengl.
Task-number: QTBUG-28849
Change-Id: I331ebca76892ce7ffbc6f8e03ff4afe0c8e28d5e
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-02-20 08:52:28 +01:00
Shawn Rutledge d0491c87a9 qmlplugindump: don't crash if a composite type was a registered
This doesn't actually result in putting any information about the
composite type into the output, though.

Change-Id: I160702578f0acd22eff98e8afa288b3c9fb20076
Reviewed-by: Alan Alpert <aalpert@rim.com>
2013-02-18 17:51:35 +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