Add internal API for accessing V8 handles of QJS types
Make it possible to use the V8 API directly. This might be necessary
in cases where the QJS API is missing some functionality (e.g.,
controlling the V8 profiler), or for performance reasons (e.g.,
avoiding overhead of QJSValue indirection).
The V8 API is clearly more extensive than the QJS API, and QJS will
likely never reach feature parity with it (since that's outside the
scope of QJS). By providing access to the underlying V8 types, users
can still choose to use V8 directly in the (hopefully rare) cases
where the public QJS API isn't sufficient.
Two new functions are introduced:
- qt_QJSEngineV8Context(QJSEngine *) returns a local handle to the
engine's internal V8 context.
- qt_QJSValueV8Value(const QJSValue &) returns a local handle to the
QJSValue's internal V8 value.
The caller is responsible for
- ensuring that a V8 handle scope is in place;
- entering/exiting the QJSEngine's V8 context.
The documentation and tests show how that can be done.
Also added a benchmark for QJSValue that can be used to measure the
effect of using raw V8 API for some common operations.
Change-Id: I680aeb2f67ffe5eeadd432a05c8084e43921a118
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>