Commit Graph

71 Commits

Author SHA1 Message Date
Erik Verbruggen 7704d8b3b6 Keep the EvalISelFactory in the ExecutionEngine.
Also corrected the class name cApiTaliSatiOn.

Change-Id: I131566e904c8ee575686a469f16d098dd512d865
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-21 15:47:14 +01:00
Erik Verbruggen 3780a47c46 Make LLVM backend compile again.
Moved common code into a separate function.

Change-Id: Iaa96c27214659a23b3df70b80560fb8f42792b38
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-20 12:04:10 +01:00
Lars Knoll 590b949183 Move the exception variable into the engine
It's easier to store this in the engine then
in the execution context.

Change-Id: I01ff447602a7d785165e774bdf6e1735c073be2d
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-20 10:43:19 +01:00
Lars Knoll 79753b8fe5 return results directly instead of using the context
The result variable in the context is not really
required, as we can return results directly in the
return value register.

Change-Id: I12554c228500aa24625ef82e31fd7f72989a71bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-20 09:40:14 +01:00
Erik Verbruggen e1bbbb6cf9 Fix isel for eval and a whole bunch of other warnings.
A factory is now passed along to do the codegen for eval().

Change-Id: If15b1f28c9c0a8f8b6d18b56d6e7bc5d942927e5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-19 14:02:58 +01:00
Lars Knoll a267688480 Better handling of contexts and environments
Make the ExecutionContext standard compliant.
Move most of it's members into a new
DeclarativeEnvironment data structure that
contains locals and arguments.

Change-Id: I094f559168810dbd3717d677fe28750076015976
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-19 10:33:35 +01:00
Lars Knoll d7416a80fa Rename Context to ExecutionContext
This is so it'll map to the name used in the
ECMAScript spec once the other refactorings
are in.

Change-Id: I8dcc7ad43b457ce50e7123c57bc4c770bcda8d11
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-19 10:28:56 +01:00
Lars Knoll d6553a206b Create a proper function object for eval
Still doesn't work correctly, as we can't modify
the global context there.

Change-Id: Ifd0ab217c3cf2d0c1b86f09907b440ea31c29ac8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-18 13:21:21 +01:00
Lars Knoll 4810e095b7 Store the activation object as a pointer, not as a Value.
The activation object inside the context is always an object,
or null. This avoids some needless conversions to and from
Value's.

Change-Id: Ibbd88c83fa073a4ed3cf03742129357dd9567cec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-15 13:40:55 +01:00
Erik Verbruggen 72c07ef046 Give an error message when a JS file does not exist.
Instead of silently failing, which is a bit ambiguous in case of test262.

Change-Id: I8b8dc066df63f93273ccc6c27547edfcd1a68cb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-14 08:44:51 +01:00
Erik Verbruggen 2a8d0b894b Added different output types to LLVM backend to ease debugging.
While in that area of code, also throw in the pass-managers for
some extra optimisations during compilation.

Change-Id: I1239ab9d21fc50b2e65c2f9d77a03ae593b607bc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-14 08:40:37 +01:00
Erik Verbruggen cdfbf401e1 Changed the LLVM backend to also support the LLVM JIT.
This is useful for quick LLVM codegen testing.

Change-Id: I45778371375b903e154222c47b15411d08085ae5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-12 23:15:15 +01:00
Erik Verbruggen a55e563279 Changed commandline and return codes for test harness.
The different backends can now be selected by command-line options,
and when none is specified, masm is used. The difference is that the
environment variable USE_MOTH is not used anymore.

The return codes are 0 or -1, so the test harness can easily check for
errors.

The ECMA test262 harness uses the $ERROR function to report errors. When
the environment variable IN_TEST_HARNESS is set, this function will get
added to the global object.

Change-Id: I291c72332ea50892afb99f9a0a15004ffc81c200
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-08 14:43:36 +01:00
Erik Verbruggen 4df46b2543 Fix compilation of LLVM backend.
Change-Id: I654f30c9811a74634cef9d27e07d016f73daa141
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-07 10:49:27 +01:00
Lars Knoll ddba8f6bb0 Conformant implementation of the object internal methods
See section 8.12 of the standard. This implements
8.12.1 - 8.12.7 and 8.12.9

Also gave these methods standard conformant names.
They are marked as [[foo]] in the standard, which
translates to __foo__ in our code.

Change-Id: I1990d6c6dd24e929c23d5c51d36f1e2e0a0a3b63
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-31 16:57:24 +01:00
Erik Verbruggen c9c2b0c541 Fix LLVM backend compilation.
Change-Id: I326cf2531a600fd09b888e9955052b29624ccdbe
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-24 11:40:11 +02:00
Lars Knoll 5f06c71bc1 Proper exception handling
Implement exceptions using setjmp/longjmp. The
advantage is that this removes all exception
handling overhead from regular code, the only
code that still has a (very small) overhead
is the try{} catch() {} statement.

Change-Id: I43d6a60dfc9dfd4b7a20d2e99ab0a9315b4d8a2f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-24 08:46:49 +02:00
Erik Verbruggen acfb62cc2e Added LLVM code generation for in-place operators.
E.g. +=, <<=, etc.

Change-Id: Iffd5eac413e3c3714fedbab58415d9dc4ba42fa6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-19 15:12:11 +02:00
Erik Verbruggen 3fd7a3a8e9 Moved LLVM specific code out of main.cpp.
Change-Id: I16c79667625d5034acb91cec13c22ed58b74984f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-18 12:00:05 +02:00
Lars Knoll e5473687ec Cleanup
Remove __qmljs_init_object and replace it with
Value::fromObject

Change-Id: Ibc8bd9e7ecd56c6713dc08add72e5cd35ffea78e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-18 10:33:34 +02:00
Lars Knoll c63e799fc2 Convert Value constructors to new calling convention
Change-Id: I433f72666499e660618b061cfcf3407f5f9bb166
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:57:01 +02:00
Lars Knoll 55d128451c Get rid of compiler warning.
Change-Id: I3b92819ac1bf8e4f98c266d4136ed05235e06faf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-16 16:01:32 +02:00
Erik Verbruggen 84223345dc Fix LLVM build
Change-Id: I7ae00a5e90087182d9f7d939db0a036c120e3b9b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-10-12 14:25:06 +02:00
Simon Hausmann c13a95361a Add missing license headers
Change-Id: I59d602a0f2c1fefb03994ed32a3d697b176791ff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-12 10:51:06 +02:00
Simon Hausmann 9b9fd3acb9 Remove old assembler 2012-10-10 13:19:17 +02:00
Simon Hausmann af2ff3464f Use posix_memalign to ensure assert(!(code & 15)) 2012-10-08 20:22:31 +02:00
Simon Hausmann 062c43beed Fix generation of multiple functions
Sine we can't reset the MacroAssembler properly right now, reconstruct
the isel for every function.
2012-10-02 08:53:47 +02:00
Simon Hausmann fd29ac57f8 Initial import of MASM 2012-09-23 10:28:13 +02:00
laknoll aaea2a9a96 Proper NaN boxing for Value
All JS types are now encoded in a 8 byte data
structure. We use the 52 bits that are unused
when a double is a NaN to encode all other types
that can be stored inside a double.

This is being done by using a few bits to determine
the type, and up to 48 bits for data. This works
even on x64, as addresses (ie. pointers) are limited
to 48 bits on these platforms.

For most other types (except doubles), we store the
data in the lower 32 bits of the double.
2012-09-19 23:28:50 +02:00
Roberto Raggi a1eb099a4a Initial work on `eval'. 2012-06-26 15:36:03 +02:00
Roberto Raggi 48a0b3c96b Do not try to optimize the `global object'.
This should simplify the implementation of `eval' and `with'.
2012-06-26 15:17:31 +02:00
Roberto Raggi 93e43fb328 Add support for global, eval and function code. 2012-06-13 11:16:35 +02:00
Aaron Kennedy 6ce83a38c9 Begin to implement moth vm 2012-06-12 18:14:13 +01:00
Roberto Raggi f3933836fb Fix possible crash when executing invalid code. 2012-06-12 12:10:33 +02:00
Aaron Kennedy b759b5f984 Add skeleton moth vme 2012-06-11 17:59:36 +01:00
Aaron Kennedy ac7f4805c1 Add moth skeleton 2012-06-11 12:27:29 +01:00
Roberto Raggi 427114d740 Increase the size of the code cache.
This is just a temporary hack, we can't continue to use
a contiguous region of memory to store the code.
2012-06-11 09:32:00 +02:00
Aaron Kennedy 6b79f27580 Remove dead code 2012-06-08 11:35:16 +01:00
Roberto Raggi 60006079bb Resolve the library name 2012-06-06 18:02:34 +02:00
Roberto Raggi ff76b6afa1 Use O2-level inlining 2012-06-06 11:06:00 +02:00
Roberto Raggi 0288e49e8c Fix the targets 2012-06-06 10:36:59 +02:00
Roberto Raggi b353942bfa More work on the AOT. 2012-06-05 18:32:52 +02:00
Roberto Raggi 9551c6527a Some more work on the LLVM-based AOT compiler. 2012-06-05 12:28:58 +02:00
Roberto Raggi bf46892ccd Move the defnition of the QML/JS Context to qmljs_runtime.h 2012-06-05 10:47:04 +02:00
Roberto Raggi 4cd31221ec Initial work on the LLVM-based AOT compiler. 2012-05-31 19:02:05 +02:00
Roberto Raggi d65f9ddff1 Generalized instruction selection.
This will simplify the instruction selection pass for
different architectures.
2012-05-31 17:32:49 +02:00
Roberto Raggi 538ed5c57c Generate cx-instructions for releational expressionsa. 2012-05-30 12:42:27 +02:00
Roberto Raggi 7e7df11464 Fix the initialization of the ECMA library. 2012-05-25 17:45:15 +02:00
Roberto Raggi fc6f96166f Refactored Object 2012-05-25 13:43:30 +02:00
Roberto Raggi a5229e821d Propagate exceptions 2012-05-25 11:55:50 +02:00