Move call context creation into the ExecutionContext class

Change-Id: Ie66a5892b0e5ab74bead1fcb59ffad5a867e0509
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Add a SimpleScriptFunction class

Choose whether we use a stack based context for a function, when
the actual closure is generated, not at call time. This speeds up
function calling for leaf functions.

Change-Id: Ibcbf3acb5610a7f59b6474e982122df03c1c5298
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
move methods to create a new context into the ExecutionContext class

This avoids one indirection when calling the methods and cleans up
the engine a bit.

Change-Id: I426f41e23f6a7262af95b9807b00920530fef642
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
change calling convention for JS function calls

This allows faster pass through of the data if we have
nested calls.

Also make sure we always reserve at least
QV4::Global::ReservedArgumentCount Values on the
stack to avoid stack corruption.

Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Fix incorrect implementation of Array.toString()

The spec says we need to call join with empty arguments if it's
callable, otherwise fall back to Object.toString()

Change-Id: I36aed164b60fad89b7d23b8a6993964c344a9ed3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Add Value::isNullOrUndefined()

Allows for some smaller optimization in the call stack.

Change-Id: Id5beeb04e9f9dbf9e61280cee7bf6758a4c02310
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Fix some bugs in the code generator

arguments can't be used as lvalue in strict mode. We however also threw
an error in some cases where it was used as an rvalue, e.g. in
(arguments < 10)
the delete operator should throw a syntax error in strict mode on all
unqualified variables
Optimize the identifier() code a little: arguments and local variables
inside eval do not need to be looked up by name.

Change-Id: If3e9305187acf72820c5164aa9754927a2c4d5d5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Remove unused constructor

Change-Id: Ibba688aea338c9f3deb33ae7488b7239ec9a485c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Remove unused variable

Change-Id: I163baea9105c6241a7d162a7e7468a70a29b3eaf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Remove unused arvument from Object constructor

Change-Id: I2c26bd8af9b352baed9b84a6b6401633ded4da85
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Add the object's prototype to the InternalClass structure

Change-Id: Ifa97d3354a7a7afadf70f9ba540716bd5b1eef44
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Move prototype pointer into QV4::InternalClass

The prototype is actually the same for most objects. By
moving it into the internal class, we can save 8 bytes
per object, as well as allowing for some future
optimizations.

Also fix a bug in the implementation of the Error
prototype objects.

Change-Id: I4d4b641055f644a9b088f27be34bfdb0446279b7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Cleanup calls to Object::setPrototype()

Rather use the correct internalClass directly when constructing
the objects.

Change-Id: I8e916f1ce8f83d291c08ca6332fe85b1f57b90b5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Remove more usages of Object::setPrototype()

Change-Id: I8c49f61bc85e3d98dea90bf05db1a3f22d08f7b1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Remove more usages of Object::setPrototype()

Change-Id: I33383baf14e764ce79252a100a6d769bde75331a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Fix a small bug in ExecutionContext::getPropertyAndBase

Don't return the activation object as base, as it's only a helper
for mutable properties in regular call contexts

Change-Id: I2c36a4aff9cf82d87f80e541b4ec21ef17e18e8d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Optimise property lookups on primitive types

This gives a large speedup on code such as "foo".charAt(2), or
(5.).toString().

Change-Id: I8b6c46f2f69a4b00f82048a9368d8e9baf4d89ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Optimize Function.apply()

Change-Id: I693413e7be5520e13139594f7654a36ce54a59ce
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Use Q_ASSERT instead of assert to get rid of the checks in release builds

Change-Id: Ia4b5bda273d44ec4c25ba955018a0f6fe220551e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Inline identifier lookup where it makes sense

Change-Id: I42ac6f4232fec2ce1535a007007542d8cc116433
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>