Commit Graph

349 Commits

Author SHA1 Message Date
Lars Knoll 50e7badd5f Remove Scope::result and convert calling convention for builtins
Allow for faster calling of builtins, and completely avoid
scope creation in many cases.

Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-08 18:58:14 +00:00
Lars Knoll 7835060518 Fix frame handling
Fix some regressions introduced by change
1ae1eaf59e0475a2dc9c5e22e53e9be19d0f2feb.

Change-Id: I24c1db78634e3beb1ab090325b60e70f788f92a7
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-08-04 08:59:54 +00:00
Lars Knoll be70a025c1 Don't store the current line number in the ExecutionContext
Instead modify our StackFrame struct to hold the
QV4::Function and have a linked list of those for
the frames.

Change-Id: I8676e16bc51a5ba6cf25a5b3423576d44e8a926a
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-08-04 07:08:02 +00:00
Lars Knoll d3a1a9e4fe Unify SimpleCallContext and CallContext
Plan is to completely remove the need for the simple call context.

Change-Id: Ie5e4673a6746dc110adbf526e45188f218fd7bfc
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-07-05 09:07:50 +00:00
Lars Knoll 493edae038 Get rid of the GlobalContext and WithContext classes
They are just ExecutionContext's.

Change-Id: Id543934740b0e54172e469935513847224b19e79
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-07-05 09:06:46 +00:00
Lars Knoll cfb17c44cf Simplify and unite handling of activation objects in Contexts
All ExecutionContexts (except for CatchContext) have or can have
some sort of activation object. Unify them in one pointer in
the ExecutionContext class, and unify it's handling where it's
actually the same.

Change-Id: I6750999ddbd5d1d74235ef4b34dcd7546c432541
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-07-05 09:05:55 +00:00
Lars Knoll 29e41a9ee6 Remove now unused files
Remove all files from the old compiler pipeline that are now
unused. This includes the whole IR, JIT code generation,
and the old Moth Isel.

Change-Id: I50d06abfbcf0e9755a54ed94638f8bb74f9512b1
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 11:58:44 +00:00
Erik Verbruggen 2ac3eaee7f Lower the maximum call depth for debug builds
Also merge VME::exec and VME::run together, so there is one less frame
on the stack.

Change-Id: I7268e0b1f16fc75766c0c9b7b5e14b9885e6fe7c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 10:20:50 +00:00
Lars Knoll 40e8109cef Don't use the ISel's anymore
Move the code that generates the CompilationUnit over to Codegen,
and don't use the ISel's at all anymore when compiling JS/QML.

Change-Id: Iba89082c386c3d3fd58ac25a4651c5d39178cc5c
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-22 08:07:21 +00:00
Liang Qi c254cec22a Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	.qmake.conf
	src/qml/jsruntime/qv4argumentsobject.cpp
	src/qml/jsruntime/qv4arraydata.cpp
	src/qml/jsruntime/qv4context.cpp
	src/qml/jsruntime/qv4context_p.h
	src/qml/jsruntime/qv4errorobject.cpp
	src/qml/jsruntime/qv4functionobject.cpp
	src/qml/jsruntime/qv4internalclass.cpp
	src/qml/jsruntime/qv4lookup.cpp
	src/qml/jsruntime/qv4managed.cpp
	src/qml/jsruntime/qv4managed_p.h
	src/qml/jsruntime/qv4object.cpp
	src/qml/jsruntime/qv4object_p.h
	src/qml/jsruntime/qv4qmlcontext.cpp
	src/qml/jsruntime/qv4runtime.cpp
	src/qml/jsruntime/qv4vme_moth.cpp
	src/qml/memory/qv4heap_p.h
	src/qml/memory/qv4mm.cpp
	src/qml/memory/qv4mm_p.h
	src/qml/memory/qv4mmdefs_p.h
	src/quick/scenegraph/util/qsgdistancefieldutil.cpp
	src/quick/scenegraph/util/qsgdistancefieldutil_p.h
	tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp

Change-Id: I7ed925d4f5d308f872a58ddf51fdce0c8494ec9c
2017-06-06 15:59:38 +02:00
Lars Knoll 8bc243f569 Move the engine() accessor from Object to Managed
We can easily do this now that Managed has a pointer to an
internal class (which always has a back pointer to the
ExecutionEngine).

Remove the extra engine pointer from ExecutionContext, and clean
up tow methods in String.

Change-Id: I98d750b1afbdeadf42e66ae0c92c48db1a7adc31
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-05-19 18:54:54 +00:00
Lars Knoll 5bc38a5030 Get rid of the old way of defining builtin functions
The old calling convention used for builtin functions is very
inefficient. It was still being used in a few places. Clean
those up and convert them to the new and much more effiecient
calling convention.

Change-Id: I6b769c6185df7e9be1e80709330fc1ca868576c1
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-05-19 18:54:50 +00:00
Lars Knoll afbb57ae84 Move the prototype into the internal class
This saves another pointer on all Objects.

Currently introduces a slight performance regression
on some of the v8 benchmarks, that needs addressing.

Change-Id: I87de8e1d198d2683f4e903c467ce2a60ba542243
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-19 06:23:29 +00:00
Lars Knoll cae7975a03 Move the internalClass field from Heap::Object to Heap::Base
And do not store the vtable in Heap::Base anymore. This change
makes the internal class the main distinguishing feature
of all garbage collected objects.

It also saves one pointer on all Objects. No measurable
impact on runtime performance.

Change-Id: I040a28b7581b993f1886b5219e279173dfa567e8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-19 06:23:26 +00:00
Lars Knoll 70a49fe042 Add ICs for String, MemberData and ArrayData
Change-Id: I43ddcb4842e501cbea8a950ab6ffa2d906014efd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-19 06:23:16 +00:00
Lars Knoll 931239579d Move the list of default internal classes into EngineBase
And store them in an enumerated array. This will simplify
upcoming changes.

Change-Id: I82eac03b9f6264843ae625e36e150464fe08be9d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-19 06:23:13 +00:00
Lars Knoll fa4f49169a Move a few more members from ExecutionEngine to EngineBase
Change-Id: I5d1e0d2251e04cc871f9c298849aafac17f23fbf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-19 06:23:07 +00:00
Robin Burchell d27047bd90 QmlContextWrapper -> QQmlContextWrapper
That poor Q looked so lonely.

Change-Id: I29a0aa0574fefa5be8ffaa9857e03500c914c830
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-04 09:31:42 +00:00
Robin Burchell 161d0854ba QmlTypeWrapper: -> QQmlTypeWrapper
That poor Q looked so lonely.

Change-Id: Ie4cef3fa8f2ecb8ba106654e8a9d6611a9407aa2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-05-04 09:31:37 +00:00
Lars Knoll 7d1b3b2389 Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I95266fdaf5c6dc65969bd2e28403da7969367d32
2017-04-22 12:28:37 +02:00
Tasuku Suzuki 85eaae8b4c Fix build without features.qml-interpreter
Change-Id: I5f9c00541c27377e8310d32bf045c2860eeffcb4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-21 09:24:17 +00:00
Simon Hausmann 017350a8a9 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/qml/jit/qv4assembler.cpp
	src/qml/jit/qv4assembler_p.h
	src/qml/jit/qv4isel_masm.cpp
	src/qml/jsruntime/qv4vme_moth.cpp

Change-Id: I865d794e550a263387a39ca8d051ebf48b70cbc0
2017-04-07 12:53:23 +00:00
Lars Knoll 589f8a90fa Separate the stack used for GC from the regular JS stack
This is required to be able to implement concurrent or
incremental garbage collection.

Change-Id: Ib3c5eee3779ca2ee08a57cd3961dbcb0537bbb54
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-07 06:06:17 +00:00
Lars Knoll 1e63f7c483 Cleanups
* Only call ExecutionEngine::markObjects() on a full GC, it doesn't do
anything in the incrementall case anyway.
* Move the marking of child objects into it's own method for clarity
* Move collection of gray items down to happen directly before we drain
the mark stack

Change-Id: I41067e17d483067bd1c4d60da22c5628482dae78
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-07 06:06:14 +00:00
Lars Knoll a410cb6901 Remove assertObjectBelongsToEngine method
It's only used during mark() calls, where we can be reasonably
safe that the assertion holds. But mark() needs to change and
become independent of the execution engine for concurrent collection,
so remove the assert as a preparation.

Change-Id: I52266af719afd76048d73efdcfcf96c0abc8843f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-07 06:06:10 +00:00
Simon Hausmann a295dae1bc Fix value type encoding constant usage when cross-compiling
Our two value encodings use different masks for the upper 4 bytes.
Depending on the target architecture we must use different values when
generating code that uses these masks.

This patch replaces the #ifdef'ed ValueTypeInternal_* enum values with
two C++11 scoped enums that allows for the co-existence of both
throughout the code base as well as selective use in the code
generators.

Change-Id: I380c8c28b84df2874cca521b78bfe7f9388ed228
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-30 08:40:39 +00:00
Simon Hausmann 24d0266ee4 Merge remote-tracking branch 'origin/5.9' into HEAD
Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp
	src/qml/jit/qv4assembler.cpp
	src/qml/jit/qv4assembler_p.h
	src/qml/jit/qv4isel_masm.cpp
	src/qml/jsruntime/qv4context.cpp
	src/qml/jsruntime/qv4context_p.h
	src/qml/jsruntime/qv4engine.cpp
	src/qml/jsruntime/qv4vme_moth.cpp
	src/qml/memory/qv4mmdefs_p.h

Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
2017-03-23 14:43:46 +01:00
Simon Hausmann 4db21fe60e Complete transition to standard layout classes for JIT access
Move the Runtime function pointer array into EngineBase so that
we can eliminate the last use of qOffsetOf.

For improved cache locality the memory manager point is now also
located in the EngineBase.

Change-Id: I0b3cf44c726aa4fb8db1206cc414a56c2f522a84
Task-number: QTBUG-58666
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-21 10:38:02 +00:00
Simon Hausmann 7efa1e60d2 Fix running of 32-bit JIT code generated on 64-bit hosts
The offsets of members encoded in JIT generated code differ between
32-bit and 64-bit architectures. This patch moves some of the
ExecutionEngine members into a separate standard-layout EngineBase class
(in line with the same class in commit
2a554434a5 and subject to merging). By
ensuring that the members are stored at pointer intervals, we can
translate from host pointer size to target when generating the code.

Task-number: QTBUG-58666
Change-Id: I1c38a7da059826848b80fd9972ed073214501386
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-17 08:34:57 +00:00
Lars Knoll e772081db1 Incremental garbage collection
Add an incremental mode to the garbage collector, that will
get used for many collections. This should significantly
reduce average stop times for GC.

Make sure that manual calls to gc() still do a full collection,
to ensure consistency and keep tests that rely on gc() working.

Change-Id: I87b13529377b7639ce993dbd99e85ff0a555acd8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-09 08:59:23 +00:00
Lars Knoll 2a554434a5 Implement a real write barrier
Implement a Steel write barrier for our objects. The barrier is
interesting as it can also be used for incremental GC runs by
simply turning the barrier on and leaving old objects marked as
black.

Change-Id: I0b273974d94a990dee3cd9298089b8b202c75bf2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-09 08:59:20 +00:00
Lars Knoll d7aa952e14 Make writes to ArrayData write-barrier safe
Change-Id: I2e46100fe72fd83b36b3195130eefce5289d1627
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-09 08:58:49 +00:00
Lars Knoll 91714e004e Make all write operations to Pointer<> types go through a set() method
The new set() method also taked an ExecutionEngine pointer. This makes
it trivial to now add a write barrier for those operations.

Change-Id: I321eccfe6fb279cc240b5c84910e6854f71759f6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-09 08:58:34 +00:00
Lars Knoll 3a0bb11d73 Separate SimpleCallData and CallData
SimpleCallData doesn't need any loca variables, so
move it into a separate CallData Heap object. This
also allows getting rid of the manual markObjects()
implementation for CallContext.

Change-Id: I9014eb2f815d3e2fe63a951a9d126c38e8aaa0a3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-09 08:58:17 +00:00
Lars Knoll 10c1e40533 Unify mark handling for MemberData and ArrayData
Introduce a ValueArray class, that defines an array of
Values at the end of a Heap Object.

Change-Id: I00efbf6f5839a6687dd5bc5fc037ec8f06e0936e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-09 08:58:15 +00:00
Liang Qi afec9016d0 Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I92b13a9c1727644d63e125c1e6f1fdac72720ad7
2017-02-28 13:04:17 +01:00
Ionut Alexandrescu bf1bd3abc9 Add a javascript push method binding to QQmlListProperty
Create a PropertyList prototype, and add the push method to
QQmlListProperty that call the append function if it has been defined.

Added a unit test and updated the documentation.

Change-Id: I2647766e98b60bf0546f6d6ed1422a616e0d3a07
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-02-21 12:30:30 +00:00
Robin Burchell dd31156c6c NumberObject: Copy parseInt and parseFloat from the global object
Per the spec, these use the same FunctionObject as the global object.

Implements:
    20.1.2.12
    20.1.2.13

For es6 test/built-ins/Number, we go from:
    === Summary ===
     - Ran 490 tests
     - Passed 412 tests (84.1%)
     - Failed 78 tests (15.9%)

to:
    === Summary ===
     - Ran 490 tests
     - Passed 416 tests (84.9%)
     - Failed 74 tests (15.1%)

Change-Id: I7e6f84ef81a429a4bce4895663ad6dc10f389f86
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-02-03 15:10:29 +00:00
Simon Hausmann 8b7d48d99c Make the JIT ISelFactory a template
That way qmldevtools can - in the future - instantiate that also for the
cross-compilation targets.

Change-Id: If15b195f24e54226dc4f2fd9f0ad6874f44cb5af
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-31 18:30:10 +00:00
Kimmo Ollila a92950743f Add fixes for INTEGRITY
Full definitions of types are needed in static_casts.

Change-Id: I028ffc40a76cdb16cb297a181b3d9dfe9d09c945
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-31 13:39:59 +00:00
Liang Qi 60300fda46 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	.qmake.conf

Change-Id: I9d87ed86e95b5901a86cc3aa65d7ac39b0b708c2
2017-01-14 22:17:32 +01:00
Lars Knoll d2eaf438ac Get rid of the GCBlocker
It's a hack we needed when we still had a conservative GC, but
it is not required anymore. The only thing we still need is the
protection against running the GC recursively.

Change-Id: I55cd51d4929c828db5b61b38e781467c5bf77314
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-28 14:49:59 +00:00
Liang Qi 0e80d28aa5 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
	src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
	src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
	src/qml/qml/qqmlimport.cpp
	src/quick/items/context2d/qquickcontext2dtexture_p.h
	tools/qmleasing/splineeditor.h

Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
2016-12-14 19:01:23 +01:00
Lars Knoll 4dd13bb4c3 Get rid of SimpleScriptFunction
Now that the code paths are very similar, we can simply to the
check whether to do a fast or slow function call in
ScriptFunction::call/contruct. To make this fast, cache the
result of the required check in QV4::Function

Change-Id: I03085ca2beb83b1721b60b0d7b2ab4c9266d1e48
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-11 17:00:29 +00:00
Lars Knoll deec039008 Refactor the calling code for (Simple)ScriptFunction
Factor the common code out into separate methods that can
later on be reused by the QQmlJavaScriptExpression.

Also ensure a CallContext is safe to use with a 0
FunctionObject.

Change-Id: I1181a8e320b8c931d9df5b2c91bc143d8587fb60
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-09 08:31:01 +00:00
Lars Knoll b4ccdf004a Change ExecutionContext::getFunctionObject() to getFunction()
And return a QV4::Function from now on. This simplifies code in
other places and provides all the info required for stack traces
and debugging.

Change-Id: I512a8ac3932268d8cfc60675e75c4661d1f16fd8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-06 13:01:44 +00:00
Lars Knoll 8a6383775a Start cleaning up the QmlContextWrapper
The class should get merged with the QV4::QmlContext class.
Simplify the cleanup by moving both classes into a common
file.

Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-04 08:31:49 +00:00
Lars Knoll 46941afcc1 Cleanup Value::isObject/objectValue usages
Try to avoid calling both as objectValue() already
checks isObject().

Change-Id: I1d770d4d9dabed4ea4cc3e322b8fdc5a64f5bd2b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-11-29 20:00:29 +00:00
Lars Knoll 5d35573a62 Clean up Value::isString()/stringValue() combinations
It's enough to just call stringValue(), as that already
does the isString() check.

Change-Id: I7be0e643a7975c0704b4c9c43b337deb8db9fce0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-11-29 20:00:18 +00:00
Liang Qi f04c2c40fd Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/qml/jsruntime/qv4variantobject.cpp
	src/qml/types/qquickworkerscript.cpp
	src/quick/scenegraph/util/qsgdefaultpainternode_p.h
	tools/qmljs/qmljs.cpp

Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
2016-10-18 08:33:26 +02:00