aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean up memory manager ownershipSimon Hausmann2013-01-031-3/+2
| | | | | | | | Since we have now only one memory manager, we might as well let the ExecutionEngine create and own it. Change-Id: I908adadf64da59e0b8f4c09d4d9502785399cb99 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove unused memory manager classesLars Knoll2013-01-031-1/+1
| | | | | | | | Unify the base class with the GC memory manager and remove the memory manager that didn't manage ;-) Change-Id: I8579bc80b66688e98203448afc645a231c97fede Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change the interpreter's stack frame to be allocated with alloca.Erik Verbruggen2012-12-191-4/+2
| | | | | Change-Id: Ia02ad1af3bb0f429a6078029bf7aaee5a17f3413 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* For the JIT enable the memory manager that traverses the native stack for ↵Simon Hausmann2012-12-171-1/+1
| | | | | | | references to managed objects Change-Id: Ie4a26ddc75abd1382af29b966915437ad485a041 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove IR::Function from the runtime.Erik Verbruggen2012-12-111-1/+1
| | | | | | | | | | This fixes potential leaks of IR::Functions, lowers the memory usage of the functions that the VM needs (because the IR fields are not present in the VM::Function), and makes both managed by the module respectively the ExecutionEngine. Change-Id: I6748ad98b062f994eae9dd14f1919aec5aa7c0b0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add gc() function to triggering manual call to gcSimon Hausmann2012-12-101-0/+16
| | | | | | | Similar to jsc Change-Id: I7c547ef10cb1620523465fe659cd3075dd27a456 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a MemoryManager, which does GC for the interpreter.Erik Verbruggen2012-12-081-8/+15
| | | | | | | | | Todo: - stack walking for MASM - fix all TODOs/FIXMEs and hidden treasures (bugs). Change-Id: I36f8cdc3a545df7287ce1df17b3570a9c017865e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of the ActivationObjectLars Knoll2012-12-051-0/+1
| | | | | | | | Also implement __qmljs_xxx_activation_property in a more correct way. Change-Id: I60c330bccca21fad99930987ed78153114a80c7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow only the ExecutionEngine's StringPool to create Strings.Erik Verbruggen2012-12-041-1/+1
| | | | | | | | Strings are the only non-Object Values living on the heap. So by tracking creation, we can help the future GC a lot. Change-Id: I5d5044f9ff10da42aeb75dd4a556d6ab3d839b1a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove the DeclarativeEnvironment class againLars Knoll2012-12-021-3/+3
| | | | | | | | | The class is a specification detail that we can implement in a more performant way. ExecutionContext now contains everything needed again. Change-Id: Ideb5f04eeeecaf2b8543676c626e3943e4d6d7a1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add some debugging infrastructure to the interpreter.Erik Verbruggen2012-11-291-3/+23
| | | | | | | | | This currently mainly intended to be useful in a C++ debugger. The infrastructure makes it a lot easier to access (parent) contexts, find function names, etc. Change-Id: I0493d3a3bd4bf5c3a03379c1a2b545ed76862cd5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Set the name of a function in more (most?) cases.Erik Verbruggen2012-11-291-2/+6
| | | | | Change-Id: I1c2b9d61b6d97e3c2a8cb976fb6be8b68d51ae28 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Tune the message property (value) of SytaxError a bit.Erik Verbruggen2012-11-281-8/+1
| | | | | Change-Id: I231eb1eeb8f01461ea61b3989743bbd01256e251 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Throw a SyntaxError instead of printing an error message.Erik Verbruggen2012-11-281-3/+25
| | | | | Change-Id: I94ef8a4f2bea80bc3689b104e381a9dc134439fa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement the first parts of strict mode.Lars Knoll2012-11-281-1/+5
| | | | | | | | Tested with eval() which now obeys strict mode semantics. Change-Id: Ib3c7f31047e43c1ef0fa74261f23ec4f2ea4244f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix: do not rune codegen when there is no program.Erik Verbruggen2012-11-261-0/+1
| | | | | | | | Happens in valid cases like an empty JS file (or one only containing comments). Change-Id: I553f57503b46da29276b06532a14e2a74395d84c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Keep the EvalISelFactory in the ExecutionEngine.Erik Verbruggen2012-11-211-3/+3
| | | | | | | Also corrected the class name cApiTaliSatiOn. Change-Id: I131566e904c8ee575686a469f16d098dd512d865 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make LLVM backend compile again.Erik Verbruggen2012-11-201-8/+10
| | | | | | | Moved common code into a separate function. Change-Id: Iaa96c27214659a23b3df70b80560fb8f42792b38 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move the exception variable into the engineLars Knoll2012-11-201-2/+2
| | | | | | | | 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>
* return results directly instead of using the contextLars Knoll2012-11-201-5/+19
| | | | | | | | | 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>
* Fix isel for eval and a whole bunch of other warnings.Erik Verbruggen2012-11-191-6/+12
| | | | | | | A factory is now passed along to do the codegen for eval(). Change-Id: If15b1f28c9c0a8f8b6d18b56d6e7bc5d942927e5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Better handling of contexts and environmentsLars Knoll2012-11-191-2/+2
| | | | | | | | | | 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>
* Rename Context to ExecutionContextLars Knoll2012-11-191-5/+5
| | | | | | | | | 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>
* Create a proper function object for evalLars Knoll2012-11-181-117/+1
| | | | | | | | 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>
* Store the activation object as a pointer, not as a Value.Lars Knoll2012-11-151-3/+3
| | | | | | | | | 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>
* Give an error message when a JS file does not exist.Erik Verbruggen2012-11-141-0/+6
| | | | | | | Instead of silently failing, which is a bit ambiguous in case of test262. Change-Id: I8b8dc066df63f93273ccc6c27547edfcd1a68cb7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Added different output types to LLVM backend to ease debugging.Erik Verbruggen2012-11-141-7/+23
| | | | | | | | 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>
* Changed the LLVM backend to also support the LLVM JIT.Erik Verbruggen2012-11-121-29/+51
| | | | | | | This is useful for quick LLVM codegen testing. Change-Id: I45778371375b903e154222c47b15411d08085ae5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Changed commandline and return codes for test harness.Erik Verbruggen2012-11-081-42/+113
| | | | | | | | | | | | | | | | 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>
* Fix compilation of LLVM backend.Erik Verbruggen2012-11-071-2/+2
| | | | | Change-Id: I654f30c9811a74634cef9d27e07d016f73daa141 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Conformant implementation of the object internal methodsLars Knoll2012-10-311-3/+3
| | | | | | | | | | | | 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>
* Fix LLVM backend compilation.Erik Verbruggen2012-10-241-3/+6
| | | | | Change-Id: I326cf2531a600fd09b888e9955052b29624ccdbe Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Proper exception handlingLars Knoll2012-10-241-7/+11
| | | | | | | | | | | 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>
* Added LLVM code generation for in-place operators.Erik Verbruggen2012-10-191-1/+4
| | | | | | | E.g. +=, <<=, etc. Change-Id: Iffd5eac413e3c3714fedbab58415d9dc4ba42fa6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Moved LLVM specific code out of main.cpp.Erik Verbruggen2012-10-181-57/+8
| | | | | Change-Id: I16c79667625d5034acb91cec13c22ed58b74984f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* CleanupLars Knoll2012-10-181-1/+1
| | | | | | | | Remove __qmljs_init_object and replace it with Value::fromObject Change-Id: Ibc8bd9e7ecd56c6713dc08add72e5cd35ffea78e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert Value constructors to new calling conventionLars Knoll2012-10-161-1/+1
| | | | | Change-Id: I433f72666499e660618b061cfcf3407f5f9bb166 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of compiler warning.Lars Knoll2012-10-161-1/+2
| | | | | Change-Id: I3b92819ac1bf8e4f98c266d4136ed05235e06faf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix LLVM buildErik Verbruggen2012-10-121-17/+19
| | | | | Change-Id: I7ae00a5e90087182d9f7d939db0a036c120e3b9b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add missing license headersSimon Hausmann2012-10-121-0/+40
| | | | | Change-Id: I59d602a0f2c1fefb03994ed32a3d697b176791ff Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove old assemblerSimon Hausmann2012-10-101-1/+0
|
* Use posix_memalign to ensure assert(!(code & 15))Simon Hausmann2012-10-081-1/+3
|
* Fix generation of multiple functionsSimon Hausmann2012-10-021-2/+3
| | | | | Sine we can't reset the MacroAssembler properly right now, reconstruct the isel for every function.
* Initial import of MASMSimon Hausmann2012-09-231-1/+2
|
* Proper NaN boxing for Valuelaknoll2012-09-191-3/+3
| | | | | | | | | | | | | | | 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.
* Initial work on `eval'.Roberto Raggi2012-06-261-4/+28
|
* Do not try to optimize the `global object'.Roberto Raggi2012-06-261-18/+8
| | | | This should simplify the implementation of `eval' and `with'.
* Add support for global, eval and function code.Roberto Raggi2012-06-131-0/+3
|
* Begin to implement moth vmAaron Kennedy2012-06-121-6/+4
|
* Fix possible crash when executing invalid code.Roberto Raggi2012-06-121-0/+3
|