aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_engine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean up memory manager ownershipSimon Hausmann2013-01-031-2/+3
| | | | | | | | 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>
* Micro optimization of StringPoolJędrzej Nowacki2012-12-141-3/+5
| | | | | | | | | | In destructor we do not need to create a copy off all pointers. By hiding StringPool::strings in class private section we reduce risk of it being accidentally copied. Change-Id: I1b9df6bf9e49bd6926e84b8eac6b3d904277e50a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove ExecutionEngine::identifiers.Jędrzej Nowacki2012-12-141-4/+1
| | | | | | | | The member was a duplicate of stringPool, there is no point in caching a cache. Change-Id: If34c80ee120dfaff1dd94326625b02d8014806dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix execution with MM_AGGRESSIVE_GC=1Simon Hausmann2012-12-141-0/+1
| | | | | | | | | Make sure that the current context pointer is initialized to the root context, so that early GC runs before the first function call find an initialized pointer in MemoryManager::collectRoots. Change-Id: I224695b253e27674913310b76d12d42bff5c1b82 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use a smart pointer for ExecutionEngine::stringPoolJędrzej Nowacki2012-12-131-3/+2
| | | | | Change-Id: I5434fbd146e9d8dcc0000327c5a5b953bc744b83 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix access rights for builtin propertiesLars Knoll2012-12-121-33/+24
| | | | | | | | | | | According to the spec all builtin properties have writable: true, enumerable: false and configurable:true by default. This is what is now being used. Some constants have all attributes set to false, and there is an extra method for setting these readonly properties. Change-Id: If5ba875bcc9f1644aa8a07a2d9b37716bf228e12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly set the prototype for regexp objectsLars Knoll2012-12-121-2/+8
| | | | | | | | Clean up the code, so that regexp's get instantiated by the ExecutionEngine Change-Id: Iacc8d9fee0427342156747d6e8814d7660bdbb1a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove IR::Function from the runtime.Erik Verbruggen2012-12-111-1/+11
| | | | | | | | | | 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>
* Properly set up the 'this' pointerLars Knoll2012-12-101-0/+1
| | | | | | | | | Make sure the this pointer is setup correctly for function calls. Also make sure we set the strict mode flag correctly in all functions. Change-Id: Idaacc92bf6469145b7addfac2bbddea588e85c2d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Return the this object if we ask for itLars Knoll2012-12-101-0/+1
| | | | | | | | This makes expressions such as typeof(this) work correctly. Change-Id: I44270f877fdee648e69ae44089ffc8fb57243401 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Implement Object.create/defineProperty/definePropertiesLars Knoll2012-12-081-0/+6
| | | | | Change-Id: I3a71597d012b5fb7d7a2f482f4a16431c71c1c22 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a MemoryManager, which does GC for the interpreter.Erik Verbruggen2012-12-081-62/+74
| | | | | | | | | 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-5/+16
| | | | | | | | Also implement __qmljs_xxx_activation_property in a more correct way. Change-Id: I60c330bccca21fad99930987ed78153114a80c7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Throw proper type and reference errorsLars Knoll2012-12-041-0/+14
| | | | | Change-Id: I898017f3e63ada72fc2e50abfa1880f9fd7ffe37 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix another memory leak.Erik Verbruggen2012-12-041-0/+7
| | | | | | | | | Now we should only leak objects that are VM::Values, and directly related objects like the PropertyTable. The directly related ones will disappear through destructor calls when the VM::Values are GC-ed. Change-Id: Id221ac62a22671d86bbc6ac9beea49d2bd5b330d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the DeclarativeEnvironment class againLars Knoll2012-12-021-2/+2
| | | | | | | | | 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>
* Get rid of variableEnvironmentLars Knoll2012-11-301-1/+1
| | | | | | | | | | | | Found out that the variableEnv is only required for two use cases: To expose the exception in the catch statement, and to create temporary environments for the with() statment. Both can be better handled differently and don't require the overhead of two environments. Change-Id: I149e1fd7bdfc3267544b141b6f94e46e42cf641b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Add some debugging infrastructure to the interpreter.Erik Verbruggen2012-11-291-0/+1
| | | | | | | | | 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/+2
| | | | | Change-Id: I1c2b9d61b6d97e3c2a8cb976fb6be8b68d51ae28 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement Object.keys and obj.proto.propertyIsEnumerableLars Knoll2012-11-291-2/+2
| | | | | Change-Id: I30df135ad95f24246e43553b2711ad1008319d56 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Introduce a simple string pool to speed up lookups.Erik Verbruggen2012-11-281-1/+18
| | | | | | | | This change uniques string pointers, so the String::isEqualTo will more often succeed in the pointer-equality case. Change-Id: I1d4f1a70147c48bc75359642a56a0446b5fbf199 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Throw a SyntaxError instead of printing an error message.Erik Verbruggen2012-11-281-0/+7
| | | | | Change-Id: I94ef8a4f2bea80bc3689b104e381a9dc134439fa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Keep the EvalISelFactory in the ExecutionEngine.Erik Verbruggen2012-11-211-3/+4
| | | | | | | Also corrected the class name cApiTaliSatiOn. Change-Id: I131566e904c8ee575686a469f16d098dd512d865 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use an isel factory instead of MASM in FunctionCTor.Erik Verbruggen2012-11-201-6/+1
| | | | | Change-Id: I070f056411f16d837ff5eac191fac11cd0bd3c47 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* return results directly instead of using the contextLars Knoll2012-11-201-1/+1
| | | | | | | | | 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-2/+2
| | | | | | | A factory is now passed along to do the codegen for eval(). Change-Id: If15b1f28c9c0a8f8b6d18b56d6e7bc5d942927e5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added isNaN and isFinite to the global context.Erik Verbruggen2012-11-191-1/+4
| | | | | Change-Id: Ia85d27a6ac82fd5dbf6b0f706747afa6418626b1 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>
* Move the engine and context classes into their own filesLars Knoll2012-11-191-0/+339
Change-Id: Ie20138990908a921ca3d7475618275ed82d9cb5c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>