Commit Graph

13982 Commits

Author SHA1 Message Date
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
Erik Verbruggen 79ceef9f46 Fix bug when a ternary expression was used in a if condition
This also changes the Result, so its members cannot be overwritten by
accident.

Change-Id: Id3679cb668da74468cbe17853cb13340683f11c0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-07-04 13:42:51 +00:00
Erik Verbruggen 1898d254bc Fix the fix to get test262 running
Change-Id: I96d4200c452fcb05bf25e7a0f24ebd90eddc509e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-07-04 13:39:59 +00:00
Erik Verbruggen d128b0c38a Fix the runner for test262
Change-Id: Ie292bae849abf1f2d5bd2da3f7cc913dd66a7bef
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-07-04 13:33:11 +00:00
Erik Verbruggen 372298e8f3 Bring back captureRequired on scope/contest property loading
This is needed to properly register permanent/temporary dependencies

This patch also removes related interpreter instructions that should
have changed, but were not used.

Change-Id: Ie53c4611766680734c02e328b7f2c752cae150e0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-07-04 12:20:09 +00:00
Lars Knoll f3561037c9 Limit the amount of escaping variables
Calculate more exactly which variables can
be referenced from an inner context, and convert
all the non escaping ones to temporaries on the
stack.

Change-Id: I0e33e85b0f6f426ef2812b8ecccee1870492b7b5
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-07-04 10:25:28 +00:00
Lars Knoll d5ab38b606 Properly save/restore the QML temps between functions
This only worked by chance before, as they always for the
same temp indices.

Change-Id: Ib2c8b912fa1dee8b1f12c8f9d895bc023bc265d3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-07-04 10:22:34 +00:00
Lars Knoll 968033e33b Properly calculate escaping variables
Change-Id: Ia9f0b6d3f31bd3a7bd4316ee3f3e9ff977f973b7
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-07-04 10:22:30 +00:00
Lars Knoll 1283f7c3b3 Move the Runtime codegen into it's own file
Change-Id: I3d09fc4b8aebe19acae0ba5a688491428a4af715
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 13:38:08 +00:00
Lars Knoll 540cad8cef Move Codegen::ScanFunctions into it's own file
Change-Id: I2c6c2fa09bc58a26a350011f5d525ec9f4b89d7f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 13:38:02 +00:00
Lars Knoll bac9b54dfb Split up qv4codegen into several files
And changed the namespace of those classes to
QV4::Compiler.

ScanFunctions should over time also move into its
own file.

Change-Id: If084acea4a9a20b9c79ad47dac19e02dc720e098
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 06:09:13 +00:00
Lars Knoll f4804726c3 Mark whether arguments or local variables can escape
This helps determine whether those variables can live
on the JS stack or need to go into the ExecutionContext

Change-Id: I791632b7fe9fd8788af7564844b5d368c3e0b91c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 06:09:07 +00:00
Lars Knoll 62ea4f9e01 Smaller cleanup of the code base
Change-Id: I8cd7cf7d208c60d7ef1648be927a19b65611127f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 06:09:03 +00:00
Lars Knoll 591792724f Smaller cleanups
Remove an unused function, and rename some variables.

Change-Id: I47491d40b0a3cee430e284bd4cc9df9b07d7d0b3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 12:22:23 +00:00
Erik Verbruggen e4a959aacc Add "we mean it" disclaimer to private header
Change-Id: I281954d1f421c9aaaa9100a1505db0ba225cf488
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-30 11:59:27 +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
Lars Knoll 3a9f4d3ae7 Get rid of IR::Module and IR::Function
Fold the stuff from IR::Function into QQmlJS::Context, and
add a QQmlJS::Module class to replace the last pieces of the old
IR.

Change-Id: Ic02a6738a4f1db67a0ddf97b6c93ca32be81789d
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 11:35:29 +00:00
Lars Knoll 12ff47eb52 Dump String and Closure table with QV4_SHOW_BYTECODE
Change-Id: I085da80bf335d3fbe707f6b460381f0e828328e0
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 11:33:46 +00:00
Erik Verbruggen b00fe45318 Remove interpreter instructions we can't generate anymore
This includes the backing runtime methods.

Change-Id: Ib8fb6091974794b11f732fadeb047a7347a50d66
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-06-30 10:05:35 +00:00
Erik Verbruggen b31ac3e487 Re-add missing captureRequired flag
Change-Id: I79b49655a55f98906723351ef7dd79099697bea1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-30 08:57:14 +00:00
Lars Knoll 6f1b4931d7 Don't use IR::Function for temp allocation anymore
Change-Id: Id9ab6f3e9f5ae1c1bedb0b34bf1fac6abfe0bbfc
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 07:50:57 +00:00
Lars Knoll 30a50e5387 Smaller cleanup
Get rid of the filename argument for JSCodeGen.

Change-Id: I4510a36374f8e98ac1d77edb2391d2413def3a46
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 07:49:47 +00:00
Lars Knoll d80a04b5f0 Introduce a QQmlJS::Module
This is scheduled to replace IR::Module.

Change-Id: I146362d07c46c4c1ad8ee46850ad38c18043ecc7
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 07:49:22 +00:00
Lars Knoll 6fdf039031 Rename Codegen::Environment to Context and pull it out of Codegen
Part of refactoring and streamlining this code base.

Change-Id: I324d35d1f0a74c5908b40243ffa2b247ce924304
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-30 07:48:51 +00:00
Lars Knoll 65c8e3bed7 Remove some dead code
Change-Id: I6a1475740999975bc88f511bc3a4c6b091f3f027
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-29 12:58:29 +00:00
Lars Knoll 45bba2e13d Get rid of inheritedLocals in the codegen
This was only causing us to create mutable bindings for
variables that already existed, thus leading to an
expensive noop.

Change-Id: I6ed8ee891f8ec16c59e5fc43ed9eb155cb4b64ac
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-29 12:19:59 +00:00
Lars Knoll eb43d44928 Pass a correctly initialized calldata also when we have no arguments
At least this and argc need to be present and have correct values.

Change-Id: I35a841cf008947e62f9309c407b5cd47fdcf4b41
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-29 12:06:03 +00:00
Erik Verbruggen a7fbe8c950 Disable test that relied on the old IR
Change-Id: If218317ba84b7fc22da296f3557654bc8d2f5230
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 12:05:57 +00:00
Erik Verbruggen e50b13b4b8 Only register QML dependencies for reads from scope/context props
Change-Id: I76ba10f16fc5b481cf1d149ebc45193fdab390fb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 11:56:11 +00:00
Erik Verbruggen 05557e7fbd Mark QML id objects as read-only
Change-Id: I39510d59ee6f05a6e45718fd33a1815fb7c46d81
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 10:50:40 +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
Erik Verbruggen 2ffdcb3fd3 Beautify SetExceptionHandler offset printing
Change-Id: Ie17b02053894e2f0f72b04304ed091084472fcdd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 09:27:36 +00:00
Erik Verbruggen f70ba7f046 Quick fix for line numbers to make tests pass
It'd be way better to store line numbers in a IP->line table, instead
of putting Line instructions into the bytecode.

Change-Id: Ie20abf356612a0692507a7e079ba87d711707eb9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 09:27:20 +00:00
Lars Knoll 2c57397e2a Evaluate the argument to with() before setting up the exception handler
Fixes a crash in the qjsengine autotest.

Change-Id: I3cecd627a1322d486b654c819fb22c166a0ab2e4
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-29 09:16:23 +00:00
Erik Verbruggen 7f4de73cc9 Fix compilation failures
Change-Id: I17e53bdc92ea56823b7868b443cccd276c812ff4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 08:48:19 +00:00
Lars Knoll dfe826d7f8 Switch over to new JS call setup
Differences:
- push parameters on the stack, including space for CallData members
- call instructions calculate the argument start
- use temp space above the calldata to evaluate arguments
- fewer temporaries are needed when a call is done while generating the
  arguments of another call
- when calling the function, the js stack space above the callData is
  not used, allowing for optimizations in the future
- Array and ObjectLiteral use the same mechanism

Change-Id: Id100fa06f12cc9d941b0f90b0b81b8270a8e4f5d
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 08:33:17 +00:00
Erik Verbruggen 987734ff58 Rename push instruction to InitStackFrame
Change-Id: I67f8397686a439cede37b52863d32dc194bee23f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 08:32:37 +00:00
Erik Verbruggen 5bc982db0b Add constant table dumping
Change-Id: I1e3728481dab97b264f19f84edd602f9eae66983
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 08:32:30 +00:00
Erik Verbruggen 9b85dcb5f6 Make debuggers print the instruction name instead of an int
Change-Id: I969f3349d021d2dbc13d72318357d630dec1811a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 08:32:24 +00:00
Erik Verbruggen 193e2782bd Remove MoveConst and put constants in Param
Change-Id: I7a289dff5cacc23c238e79e44eb96c690691da3b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-29 08:32:15 +00:00
Lars Knoll e049377f36 Fix bugs in qqmlirbuilder
Correctly add the scope and context object dependencies,
and pass the correct index into LoadIdObject.

Change-Id: Idc0d5b229fca40dad6a0ecd4988b4f150db4c0a2
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-29 08:31:42 +00:00
Erik Verbruggen 971c06eb5b Make dumped bytecode more readable
- change temp/local/formal printing to match the old IR style
- add some commas to CallBuiltinDefineObjectLiteral

Change-Id: I24b945512969ac1a829e69e3153c433b09215305
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-22 09:53:38 +00:00
Erik Verbruggen 8386e4d927 Fix binops when rhs has an effect on the lhs
Like in "var x = 0; x * (x = 1)"

Change-Id: I1e9087506f8b04ebbdbb7ad4fe7fbe935a949e42
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-22 09:53:34 +00:00
Erik Verbruggen abe3f61434 Fix sameValue again
Now to actually check if both values are 0

Change-Id: I138e34f6b884d45a4b01c7963b3518f2b36a4857
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-22 09:53:29 +00:00
Erik Verbruggen 9cc9101f04 Encode numeric literals as int when possible
Change-Id: I5ecc406f06a193b470eb9ac376da6b9f752d01cb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-22 09:53:25 +00:00
Lars Knoll 4ac85039a2 Various compile fixes
Make sure all libs and tests compile again after
the latest changes.

Change-Id: I749d3d2d0109cc97df2ecec93809ea8a1b3014a9
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-22 09:18:15 +00:00
Lars Knoll 5863a093cc Add missing files
Amend 1ad60b1f53

Change-Id: I769009848a1c7de570492488224f8d6755315611
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-22 08:13:55 +00:00
Lars Knoll 14a20fb683 Remove the old compiler pipeline
Don't compile the JIT and related code into libQtQml
anymore.

Change-Id: Ieb0ec33c964d09b121ede4097fe4218b147c673d
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-22 08:08:05 +00:00
Lars Knoll 1ad60b1f53 Move the Moth CompilationUnit into it's own file
Change-Id: I8d2dc724d705360c413f9ac75535970e295d1b39
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-22 08:07:43 +00:00