Commit Graph

68 Commits

Author SHA1 Message Date
Lars Knoll a2d115fbaf Convert most remaining return values from Value to ReturnedValue
Change-Id: If8b0c3b91be50678693868c10fefc3678008834d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:55 +02:00
Lars Knoll 16f92ad85c Convert builtin methods to return a ReturnedValue
Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:47 +02:00
Lars Knoll 6c9f1c8ed9 Use a ReturnedValue for Managed::getIndexed()
Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:36 +02:00
Lars Knoll bdb27b96ac Use ReturnedValue for Managed::get().
Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:33 +02:00
Lars Knoll 8d26084ae5 Use ReturnedValue for Managed::construct()
Change-Id: I9e702d60c4e1b7ba19a699ff7a8d53876d6cd5f7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:30 +02:00
Lars Knoll d6837e9ca3 Rename QV4::ValueScope to QV4::Scope
The class is going to be used all over the place, so let's
give it a short name :)

Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:23 +02:00
Lars Knoll 002e6105f6 Require a ValueScope for ScopedCallData as well
This brings things more in line with ScopedValue, and
also simplifies cleanup of Scoped values.

Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:21 +02:00
Lars Knoll 1a2a83f80b Use a ReturnedValue for Managed::call()
Change-Id: Ief2d75e9789dd367c603d90dc0fe5316a0d055e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:18 +02:00
Lars Knoll 262d726103 Continue conversion to using scoped values
This converts all methods in qv4runtime_p.h to not
use raw values in arguments anymore.

The conversion of return values will be done in a separate
commit.

Change-Id: Ie6e8f3bed459d09cb831f7f87920b7eada161502
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-11 13:02:23 +02:00
Lars Knoll f9fda643ab Change signature of call/construct() to take a pointer to a CallData
Change-Id: I5467aadba083e4b01fb0a7170946695207033680
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-11 13:01:57 +02:00
Lars Knoll 6e8e5d16e1 Move CallData onto the JS stack
Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-11 13:01:50 +02:00
Lars Knoll edee5c3dc0 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>
2013-09-02 17:27:36 +02:00
Lars Knoll 819b4ef8b1 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>
2013-09-02 17:27:36 +02:00
Lars Knoll 6f472680eb 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>
2013-09-02 17:27:36 +02:00
Peter Varga 221f93d8c7 Factor out protoHasArray and hasAccessorProperty
The Object::protoHasArray() function returns true if any object in the
prototype chain contains an array element. The new member
hasAccessorProperty of the Managed class is set true if the object
has any accessor property.

Change-Id: Ic29d303eb058d4faed2a47ed8fab18e376ccba68
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-08-17 12:51:56 +02:00
Lars Knoll 0da208381f Never convert the this object when calling a builtin function
When calling builtin methods, the this object should should be
passed unmodified to the method. This failed so far because some
of our buitin methods where implemented slightly wrong.

Change-Id: I725f4dc952b4af6101645cf702e01b5410406a92
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-08-17 09:26:40 +02:00
Peter Varga fa84e06a75 Fix Array.prototype.concat
The following tests failed in the test262 test suite due to incomplete
implementation:
- ch15/15.4/15.4.4/15.4.4.4/15.4.4.4-5-c-i-1
- ch15/15.4/15.4.4/15.4.4.4/S15.4.4.4_A2_T1
- ch15/15.4/15.4.4/15.4.4.4/S15.4.4.4_A2_T2
- ch15/15.4/15.4.4/15.4.4.4/S15.4.4.4_A3_T1

Change-Id: I423e77fe3d34140a08c61efdc18c81ef251bc927
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-08-14 21:12:06 +02:00
Lars Knoll 3288b87e2f Restructure source code
Move the v4 engine classes from a subdir of qml/qml into
two subdirs (compiler and jsruntime) of the qml module
Remove an unsued qv4syntaxchecker class, and move
the moth code directly into compiler.

Change-Id: I6929bede1f25098e6cb2e68087e779fac16b0c68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-08-08 12:22:30 +02:00