Commit Graph

23 Commits

Author SHA1 Message Date
Lars Knoll 463ed070be Properly set the prototype for regexp objects
Clean up the code, so that regexp's get instantiated by
the ExecutionEngine

Change-Id: Iacc8d9fee0427342156747d6e8814d7660bdbb1a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-12-12 09:09:32 +01:00
Erik Verbruggen 5e39d56c09 Remove IR::Function from the runtime.
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>
2012-12-11 23:16:32 +01:00
Lars Knoll 9c104bb970 Properly set up the 'this' pointer
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>
2012-12-10 20:08:26 +01:00
Lars Knoll df458859f4 Return the this object if we ask for it
This makes expressions such as typeof(this) work
correctly.

Change-Id: I44270f877fdee648e69ae44089ffc8fb57243401
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-12-10 20:08:21 +01:00
Lars Knoll 13ea451c4f Implement Object.create/defineProperty/defineProperties
Change-Id: I3a71597d012b5fb7d7a2f482f4a16431c71c1c22
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-12-08 17:25:02 +01:00
Erik Verbruggen 5f22fbd7fc Add a MemoryManager, which does GC for the interpreter.
Todo:
- stack walking for MASM
- fix all TODOs/FIXMEs and hidden treasures (bugs).

Change-Id: I36f8cdc3a545df7287ce1df17b3570a9c017865e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-12-08 04:47:53 +01:00
Lars Knoll 46953ed4d0 Get rid of the ActivationObject
Also implement __qmljs_xxx_activation_property
in a more correct way.

Change-Id: I60c330bccca21fad99930987ed78153114a80c7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-12-05 01:04:21 +01:00
Lars Knoll 944af86fca Throw proper type and reference errors
Change-Id: I898017f3e63ada72fc2e50abfa1880f9fd7ffe37
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-12-04 20:08:43 +01:00
Erik Verbruggen 070e0d07d8 Fix another memory leak.
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>
2012-12-04 16:58:26 +01:00
Lars Knoll 2104e7fdcb Remove the DeclarativeEnvironment class again
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>
2012-12-02 15:50:37 +01:00
Lars Knoll f26d5c36cf Get rid of variableEnvironment
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>
2012-11-30 12:28:38 +01:00
Erik Verbruggen a14e7549c4 Add some debugging infrastructure to the interpreter.
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>
2012-11-29 22:05:49 +01:00
Erik Verbruggen 36356a4b27 Set the name of a function in more (most?) cases.
Change-Id: I1c2b9d61b6d97e3c2a8cb976fb6be8b68d51ae28
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-29 16:18:21 +01:00
Lars Knoll feafa10498 Implement Object.keys and obj.proto.propertyIsEnumerable
Change-Id: I30df135ad95f24246e43553b2711ad1008319d56
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-29 08:03:20 +01:00
Erik Verbruggen 721f2156a6 Introduce a simple string pool to speed up lookups.
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>
2012-11-28 14:06:06 +01:00
Erik Verbruggen 4bd20c2ac3 Throw a SyntaxError instead of printing an error message.
Change-Id: I94ef8a4f2bea80bc3689b104e381a9dc134439fa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-28 12:31:20 +01:00
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 1dab0e5904 Use an isel factory instead of MASM in FunctionCTor.
Change-Id: I070f056411f16d837ff5eac191fac11cd0bd3c47
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-20 13:31:05 +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
Erik Verbruggen b072fd9317 Added isNaN and isFinite to the global context.
Change-Id: Ia85d27a6ac82fd5dbf6b0f706747afa6418626b1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-19 13:57:51 +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 65724ce3e7 Move the engine and context classes into their own files
Change-Id: Ie20138990908a921ca3d7475618275ed82d9cb5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2012-11-19 10:29:07 +01:00