Lars Knoll [Fri, 1 Feb 2013 14:59:22 +0000 (15:59 +0100)]
Refactor property access
Move the property descriptors into a a vector
and separate them from the lookup table.
This is a pre-requirement for a hidden class implementation
later on.
Change-Id: Ib08b8152597ae0b6c883eef0fced55ee0cb4c286
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 1 Feb 2013 13:32:30 +0000 (14:32 +0100)]
Fix a bug in Array::push_back
We would in some cases write the value to the wrong place.
This fixes the type error in the DeltaBlue V8 benchmark.
Change-Id: Ic64570248d83890d5e66d718b9087c2bf966690a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Fri, 1 Feb 2013 13:31:24 +0000 (14:31 +0100)]
Fix possible out of bounds access
This lead to crashes in some complex code where a
pointer was just pointing to the end of the allocated chunk,
and we'd then read outside the chunk bounds for marking.
Change-Id: Ica41c4e98eb9901fbb8d291289a9c91078ded111
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Thu, 31 Jan 2013 22:52:09 +0000 (23:52 +0100)]
Avoid duplicated feature defines between tools/v4/v4.pro and src/v4/v4.pro
Centralize the macros in v4.pri that's included by both.
Change-Id: I1ae2ed3b7b97a4e905d2e4ae563c99c964253bb1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Jędrzej Nowacki [Thu, 31 Jan 2013 11:18:02 +0000 (12:18 +0100)]
Build fix.
Add proper LLVM detection for v4 tool.
Change-Id: I03ad3099ce9622df67b7c61ce1e72752b9f6e4bd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Thu, 31 Jan 2013 10:04:47 +0000 (11:04 +0100)]
Re-enable llvm code in main.
The QMLJS_NO_LLVM flag should be provided by a pri file somewhere next
to the other v4.pro, not here.
Change-Id: I55c17d6a09f81141e9fa671bab9d3ee9a5830e6a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Thu, 31 Jan 2013 09:58:01 +0000 (10:58 +0100)]
Fix compilation on Mac with clang.
Change-Id: Ib5ecd92a0b7209ed505d17620ba4097e8d54a53c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Jędrzej Nowacki [Thu, 31 Jan 2013 09:00:06 +0000 (10:00 +0100)]
Cleanup namespaces.
QT_BEGIN_NAMESPACE and QT_END_NAMESPACE was added in header
files. Namespace coding convention got unified.
Change-Id: I971c9a9179d5cd512f8214457609f40992a8ca66
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 31 Jan 2013 08:16:48 +0000 (09:16 +0100)]
V8 benchmark suite
We're currently failing two tests. Performance is between 2
and 20 times worse then V8 in full compiler mode.
Change-Id: Ie78b4e996511777cb665dbf161e41dcfa0210b9b
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Simon Hausmann [Thu, 31 Jan 2013 06:21:19 +0000 (07:21 +0100)]
Don't link v4 against QtGui
The QT variable defaults to core and gui it seems, but we don't
need the latter.
Change-Id: I355d2ab5fb42da4eeaebb6a41ed638203d11650a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 30 Jan 2013 16:11:09 +0000 (17:11 +0100)]
Minor improvements to Context creation
Avoid converting the this object for builtins, and
remove the GC blocker that's not needed anymore.
Move some parts of the code out to the caller
of initCallContext().
Change-Id: I8b11dd1604fb14940e4d4e9f403c2a8bfc837c4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 15:39:36 +0000 (16:39 +0100)]
Convert Math functions to contextless form
Change-Id: I49123f4396d64fb5e2a888d339c87c800981f4f3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 19:48:35 +0000 (20:48 +0100)]
Make things more compliant with a regular Qt module
Move the v4 tool into basedir/tools/v4
Small fix to sync.profile
Install v4 into QT_INSTALL_BINS
adjust test262.py to simply call 'v4' by default
Change-Id: If78f40632c226bc26f64b0eea06fe93d7770af3e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 15:25:57 +0000 (16:25 +0100)]
Remove some unused methods
Change-Id: Ib487078db163e03bb0bd1be762f1aa0da04434b4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 14:43:22 +0000 (15:43 +0100)]
Inline some code for property lookups
Speeds up fact.2.js and crypto.js by ~5-10%
Change-Id: I121b6c3dbbd89060f323a422286adf946d4f924a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 14:39:08 +0000 (15:39 +0100)]
Make sure we compare identifiers
Change-Id: I1fc63a062799857ccd937c194e7f305b31ca3567
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 14:10:39 +0000 (15:10 +0100)]
Convert a few more builtins into versions that don't need a context
Change-Id: I24920f3952cd356d50a056891dc075e56c951775
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 13:56:40 +0000 (14:56 +0100)]
Add an identifier cache
This is very similar to the old string cache with a slight
twist:
Only strings we know will be used as identifiers (property names)
get entered into the cache. These are then also persistent and
won't ever get collected.
Change-Id: Id441694ef9faf30a87433ae22eb833d1db1d84f1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 13:56:19 +0000 (14:56 +0100)]
Don't ignore the v4 subdir
Change-Id: Iea769db7251ba6c6289f23a2d29e194e7d6b2ba5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 12:04:16 +0000 (13:04 +0100)]
Add subtypes to String
This allows to store the full array index in the string,
as well as to optimise identifiers going forward.
Change-Id: I08974a5ee1149869ecfb635932bf54026d2bbab4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 10:04:45 +0000 (11:04 +0100)]
Move string hash and error type fields
Move the string hash back into the String class.
Add a subtype field to Managed, and use that to store
the type of the ErrorObject.
Change-Id: I4aa8f1f39f512e3a9084b249e173bff41175d543
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 08:44:15 +0000 (09:44 +0100)]
Optimise decode/encodeURI
The code contained some needless creation of temporary
QStrings, that were taking up ~50% of the time spent in
these methods.
Change-Id: Iba494e5e92c08a0056d6eb6a947d080209aa7ce5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 12:31:35 +0000 (13:31 +0100)]
Fix compilation on 64bit
Change-Id: I044a7aa1b52aa3df86a22db706d05ffd6a8d2e71
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Jędrzej Nowacki [Wed, 30 Jan 2013 12:26:12 +0000 (13:26 +0100)]
Build fixup, QT_BEGIN_HEADER was removed.
Change-Id: I97b33e4c317aac53cfff1c7ef6f1a04bca9434ba
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Jędrzej Nowacki [Tue, 29 Jan 2013 13:20:50 +0000 (14:20 +0100)]
Say hello to QtV4 module.
Change-Id: I507cd5707b7d7223a0d901cf939896fb2649b684
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 30 Jan 2013 08:11:18 +0000 (09:11 +0100)]
Fix a bug with Unicode surrogates in decodeURI
Change-Id: Id8348c77ad4d5429c4b4116b8ef0dc94e130c4e3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 30 Jan 2013 07:58:27 +0000 (08:58 +0100)]
Allocate larger chunks if we use lots of memory
This avoids excessive GC activity on test cases that allocate
lots of memory. v4 now runs some of the test cases that were
too slow to run before.
Change-Id: Id668b03799b086445ec0fb48d577a5844f962de3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Lars Knoll [Tue, 29 Jan 2013 21:08:35 +0000 (22:08 +0100)]
Use faster calling path for more builtin methods
This speeds up some test cases I have by a factor of 2.
Change-Id: Ief9e2845c974d701fa032937cafced323279e9ec
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 21:07:48 +0000 (22:07 +0100)]
Optimise callProperty for Strings.
Don't convert the String to a StringOject, just to
call a method on it's prototype. The result would
in any case be the same.
Change-Id: I74cea392b20b6c5642d010287ebf6e27c91eea83
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 20:23:19 +0000 (21:23 +0100)]
Add a faster code path for calling builtin methods
Builtin methods usually don't need a Context of their own,
so we can fully avoid the overhead of creating and destroying
it.
Implemented the support for making builtin methods context less
and verified it with some of the methods in String.prototype.
Change-Id: I187b46ba684183b4fba49ae70e3139d32ef585e0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 13:31:42 +0000 (14:31 +0100)]
Remove the virtual Object::className()
Change-Id: I70ecf244792c1c22b57ba7bdfed64b4b5b055e8c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 12:45:32 +0000 (13:45 +0100)]
Remove Object::call()
The method didn't make any sense. It's easier to directly
cast to a FunctionObject and check whether that succeded.
Change-Id: I8d76e2b93dc32d6a8fa82e66173d1d2c1e5da514
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 12:23:32 +0000 (13:23 +0100)]
Allocate execution context and local variables in one chunk
This avoids a few mallocs and in addition memory leaks where
the local variables or arguments array wasn't destroyed before.
crypto.js seems to run without a mem leak now :)
Change-Id: Icca74c5dba764fadabd7a77f233bdf5883046c86
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 29 Jan 2013 10:24:43 +0000 (11:24 +0100)]
Don't copy formals and locals from VM::Function to FunctionObject
This should make creation of a FunctionObject quite a bit cheaper
Change-Id: I0937f9f2354b7abc47c3673f4957bd70ff9a97b8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 15:46:09 +0000 (16:46 +0100)]
Garbage collection for Strings
Let String inherit from Managed, and manage them through
the same garbage collector as for regular objects.
Change-Id: Iae1e047daeff683519d52beddcaca7824a01bb27
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Sun, 27 Jan 2013 08:59:37 +0000 (09:59 +0100)]
Split CallBuitin variants into separate instructions.
This saves space by removing (sometimes) unused parameters, and the need
to store and switch over another enum to determine which of the various
built-in instructions is called.
Change-Id: Ie59c49608bf445a07d406b45fd48cfb94bbfc919
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 29 Jan 2013 08:17:22 +0000 (09:17 +0100)]
"Fix" llvm build by adding empty definitions for missing methods.
Change-Id: I172ad23bc56bda9b3a8276cb102599d6243026c4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Fri, 25 Jan 2013 18:32:30 +0000 (19:32 +0100)]
Change TEMP handling in the interpreter.
By introducing the Param struct, and moving the ValueOrTemp into it
too, the parameter decoding for instructions is cleaner and less
error-prone: it de-couples the HIR/MIR representation from the
interpreter representation, and allows for proper handling of the
with-context.
Change-Id: I0bc8f72bc7ce62b8efa298cbea5711adac4a4d34
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 28 Jan 2013 12:49:03 +0000 (13:49 +0100)]
Fix build on ia32
loadArgument(PointToValue) is architecture independent :)
Change-Id: I6ce8b7900088bc7052002a9ae60cbebdd5357d8d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 27 Jan 2013 20:16:09 +0000 (21:16 +0100)]
Properly working post increment/decrement operators
This required some larger changes in our infrastructure.
Unfortunately the post increment/decrement operators
don't return the old value unmodified, but return
toNumber(oldValue).
At the same time they need to properly store the new value
into the referenced expression. The only way to solve this
(as we can't have two return values) is to pass a proper
reference into runtime methods.
Change-Id: I0e0c2cc011ab22d5d4b27924abc8c18372c104a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 10:42:01 +0000 (11:42 +0100)]
Smaller cleanup
Change-Id: I42a1de385e286bf1e4568769886034161f7fe500
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 09:50:07 +0000 (10:50 +0100)]
new eval() should throw a type error
Change-Id: I487a11a060657ac1eeae4c51085ce907711b51c8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 12:32:08 +0000 (13:32 +0100)]
Add a mechanism to protect managed objects from deletion
Change-Id: I6700dc94ad481e12ee7f00c04c0c37261e22a715
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Lars Knoll [Mon, 28 Jan 2013 09:41:42 +0000 (10:41 +0100)]
Set the prototype for FunctionObject in it's constructor
This avoids a few test failures where the prototype for
eval wasn't set up correctly.
Change-Id: I5a5c1dafe4a6328bf1bbc95901ff22df10083a86
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 09:40:30 +0000 (10:40 +0100)]
Most statements don't return a value
In eval mode, we need to write the result of statements
into the return value. But most statements don't return
a value, so the statement shouldn't write a return value.
Change-Id: I9ce24fe6689bd2bb2aee6241ca84a25f9a266f5c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 28 Jan 2013 09:39:40 +0000 (10:39 +0100)]
Properly set the length of the eval function
Change-Id: I88a483f5c9a758c4983d5d3b2c684f6bc7e8cf55
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 27 Jan 2013 21:39:01 +0000 (22:39 +0100)]
Fix call expressions with a subscript
Call expressions such as foo[bar]() where wrongly converted to a
temporary and then called by value. This made the call have the
wrong this argument, as the reference was resolved in the assignment
to the temporary.
Change-Id: Id6044f833dfcf9ee8fa4f9ec0602a929abdc2c48
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Jędrzej Nowacki [Mon, 28 Jan 2013 11:54:07 +0000 (12:54 +0100)]
Fix constness of Value::toXXX functions.
Change-Id: I66d622555b2cca4e6aa546745fd0e46373dee919
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 27 Jan 2013 21:31:28 +0000 (22:31 +0100)]
Number/Boolean.prototype.toString() also accept matching primitive values
These methods also accept matching (ie. booleans or numbers) primitives
as this argument.
Change-Id: Ib31cadd46d327381abf02847ae35e7be05715f84
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 27 Jan 2013 21:13:28 +0000 (22:13 +0100)]
The function prototype has a length property
Change-Id: I1ef4d7c86ac5c5a8e7ed08081a86c4f826527c0d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 27 Jan 2013 20:27:44 +0000 (21:27 +0100)]
test function names for eval or arguments in strict mode
using these as function names should trigger a syntax error
in strict mode.
Change-Id: I8d83fda72db856b692c8f6f1454c762255bcaef1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 27 Jan 2013 16:30:40 +0000 (17:30 +0100)]
Fix a bug in the evaluation of &&
Change-Id: Ia446bd05dcca3fc146719284e5ac96d4c7d61c06
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Simon Hausmann [Fri, 25 Jan 2013 15:03:06 +0000 (16:03 +0100)]
Fix empty return statement in eval
It should throw a syntax error even inside eval it seems.
Change-Id: I4de6d96f9ba61569d7d7e723ecb5f2d946c8f4ad
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 25 Jan 2013 14:52:42 +0000 (15:52 +0100)]
Fix remaining issues with the delete operator
Delete on known temps should return true and false on known local variables.
Change-Id: I71be8361306eb825b975a3aee294665eb8561366
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 25 Jan 2013 13:00:48 +0000 (14:00 +0100)]
Fix more tests with the delete operator
Delete on non-reference types should return true. Delete on our
temporaries should evaluate to false.
Change-Id: Ic6b39a0cf5833900f2a492ac8b37386fc2963ab3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Fri, 25 Jan 2013 08:34:54 +0000 (09:34 +0100)]
Suppress a linker warning for unused flag.
Change-Id: I53aaf5f7bc7ec63e92e02d18010b2f1d53c40a00
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 25 Jan 2013 12:41:37 +0000 (13:41 +0100)]
Remove the isString and isArray flags in Managed
These are not needed anymore, as we have the type stored
in the object.
Change-Id: I86594f4c3b3669ee0576e1ca141a64494e82a176
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 25 Jan 2013 12:23:58 +0000 (13:23 +0100)]
Inline casting of Value to objects
Change-Id: Ic5538b8a0a1f430a265399bced0ce9fc0a79696e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 25 Jan 2013 12:13:06 +0000 (13:13 +0100)]
Remove a bunch of virtuals in Object
This should speed up casting to the derived types, and
simplify things in the longer term.
Change-Id: I7362c86e5e2724d5b7e245695f9fe29144999715
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 25 Jan 2013 11:43:44 +0000 (12:43 +0100)]
Faster marking of objects in the GC
Change-Id: I4ccbf7fc50758fc176bfdb2f0382a7ec1f18d6ba
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 25 Jan 2013 11:16:45 +0000 (12:16 +0100)]
Add missing return statement
Fixes crypto.js
Change-Id: If3b2d182b8e6a93acd2c32904e5b9a9fd49181cf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 25 Jan 2013 09:38:52 +0000 (10:38 +0100)]
Remove a few virtual keywords that aren't required anymore
Change-Id: Ic7d46d78cd1efeac16a25586c5b8fb3cb761512d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Thu, 24 Jan 2013 14:49:05 +0000 (15:49 +0100)]
Fix compilation of llvm backend.
Change-Id: I714977f7e5e7040a8fd252525cd9f84fbfe40862
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 15:07:18 +0000 (16:07 +0100)]
Delete on a function argument should return false
Change-Id: I36aafcfa43bced2b8315af39432cf7731daaf458
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 14:36:33 +0000 (15:36 +0100)]
Throw a syntax error if eval or arguments is used in increment/decrement expressions
Change-Id: Icd966b626a172302eb4b22f5cadba0085d31c320
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 24 Jan 2013 14:32:12 +0000 (15:32 +0100)]
Fix inplace operators
We actually need to call __put__ on the result of the
operation even if the lhs didn't exist before.
Change-Id: I54acaab203fd34fd88a36685211e382a8399b11b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 24 Jan 2013 14:31:54 +0000 (15:31 +0100)]
Avoid integer division by 0
Change-Id: I5c50878192e3f4dd6e7297e51a450840c4c1037e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 24 Jan 2013 14:03:00 +0000 (15:03 +0100)]
Throw a reference error when trying to use an invalid lvalue
Change-Id: I08c19710eaf58da100852fa9c2b07a4d8bb8b0c4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 13:27:36 +0000 (14:27 +0100)]
Fix return statement outside of function body
Such a program is syntactically incorrect
Change-Id: Ica23c67aae55890a36064987f6019d9d7f50585e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 11:53:47 +0000 (12:53 +0100)]
Fix properties of literal array initialisers
Array entries defined in such a way need to be own properties.
To avoid calling builtin_define_property with the integer index
converted to a string for each property, this patch also introduces
a builtin_define_array_property that takes an integer index instead.
Change-Id: Ib21f99a555b3237753a7930a7edc70bfcd49ac18
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 24 Jan 2013 12:12:26 +0000 (13:12 +0100)]
Fix the remaining test failures for the with() statement
Properly pop the pushed scopes for break, continue and return
statements inside with() blocks.
Change-Id: I7439cd7b7c70819cd5de903395e1b67c394a38c6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 24 Jan 2013 11:13:47 +0000 (12:13 +0100)]
Rename some builtin methods
rename push_with to push_with_scope and
pop_with to pop_scope. This is to prepare
for adding a push_catch_scope.
Change-Id: I73d30d097fc50f4a00d94f5927d154292bcd4482
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 24 Jan 2013 10:58:46 +0000 (11:58 +0100)]
Create a real execution context for with() statements
This is required for full spec compliance.
Change-Id: I0c1a3ed249a458032d29ba80650a5fdc2eac5c01
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 11:26:44 +0000 (12:26 +0100)]
Fix build on Mac OS X
Use std::isnan instead of isnan, like everywhere else in the file.
Change-Id: Ie58288b0a8d2043dc88054babe3beee78007cd15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 10:58:58 +0000 (11:58 +0100)]
Fix evaluation of lhs in binary expressions
The entire left hand side of a binary expression must be evaluated
before the right hand side. In case of for example
x !== (x = 1)
it is important to generate the code for looking up "x" from the
lhs before dealing with the rhs, because this overall expression
is supposed to throw a reference error.
Change-Id: I03aee3257ff7b7a60aa789dba9f0445c387a1ad5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Thu, 24 Jan 2013 10:56:26 +0000 (11:56 +0100)]
Fix compilation of (incomplete) llvm backend.
Change-Id: Ib87c3427cfd937516a58849540e0e668a28cb8dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 24 Jan 2013 09:20:12 +0000 (10:20 +0100)]
Skip Intl tests for now and re-generate TestExpectations
Change-Id: I178222506bf697451a3b83c8595bfb0e88b71eae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 23 Jan 2013 21:49:31 +0000 (22:49 +0100)]
Fix all but one remaining test case for exceptions
Change-Id: I03d42eeeb28a0f75d3cad81cb7af815c9784c43e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 22:11:54 +0000 (23:11 +0100)]
Fix bug in switch statement
Change-Id: I42f509f825d8c095c3762a86e5da881de1038d7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 20:53:54 +0000 (21:53 +0100)]
Fix wrong constant folding
Change-Id: I8c48ae0597c41c69c77d56cba4c6be738d5d282b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 20:47:44 +0000 (21:47 +0100)]
Labelled statements can also appear outside of loops
Change-Id: I121b9341dd102964f52dec2a0278c2a3d74b9a8a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 20:00:38 +0000 (21:00 +0100)]
Loops are local to functions
Loops need to be reset when parsing an inner function,
as labels can't cross these boundaries.
Also throw a syntax error when a continue statement
outside a loop is encountered.
Change-Id: I69484a2f7a550590194e82667bc4c66aba89ae43
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 19:44:47 +0000 (20:44 +0100)]
Don't crash on for(x in null)
Change-Id: I3bd5610fa9bffcc195bb1c96a5a595061931a20e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 19:24:12 +0000 (20:24 +0100)]
Fix a crash when a non direct call to eval caused a syntax error
Change-Id: I89d1eabd248fd844f7cd2caa29667e0c7850958d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 14:20:44 +0000 (15:20 +0100)]
Fix some errors related to strict mode
eval and arguments aren't allowed in variable
declarations or as lvalues.
More correct propogation of the strict mode flag from
eval into Codegen.
Change-Id: Ic519900463aa2f57311a64787e33bc6924838f16
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 23 Jan 2013 13:31:05 +0000 (14:31 +0100)]
Implement JSON.stringify
Change-Id: If1d170767c61c2435fe82f7e26e1ebf8de6327bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 12:21:09 +0000 (13:21 +0100)]
Fix callBuiltinInvalid for the interpreter.
Change-Id: Ifde12261a7c66a7b268129d5fae4ae626e16a00f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 23 Jan 2013 10:50:01 +0000 (11:50 +0100)]
Fix crash when using the built-in regexp syntax
When /someregexp/ appears in the source, we generate a new regexp
object in the MASM back-end at run-time. That object is memory
managed but it's never marked, because we only store its address
in the generated code.
This patch adds a way for the code generator to collect values that
are generated like this and encoded only in the code directly, and
therefore require extra book-keeping when collecting the roots.
Change-Id: Ia4cc3f4578e2e7e4378ea7ab1a32c66f0e6ab4bf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 23 Jan 2013 09:39:58 +0000 (10:39 +0100)]
Refactor JSON.parse
Use a modified copy of the parser in QtCore to get
all test cases to pass and to be a lot faster.
In addition, this will later on to add support for
the second argument to JSON.parse
Change-Id: Iaa4cbda29db9c53c3dd5ab2b2ded71efdaa6f8ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 10:04:48 +0000 (11:04 +0100)]
Fix compiler warnings.
The second call method in EvalFunction was hiding an overloaded virtual
function, hence the name change.
Change-Id: Ic333d1e7359df97ff25dace87c80b40a939a4cea
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 09:22:52 +0000 (10:22 +0100)]
Method signature changes to remove duplicate logic.
Change-Id: Ib4a17dd90629a71f1ee2daa442e49d2237b1073d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 09:12:51 +0000 (10:12 +0100)]
Fix eval when a context gets inherited.
When a context gets inherited, the locals have to be passed into the
CodeGen class, so the indexes in the caller and callee match up.
Change-Id: I21f496e8355a5dd7f13c06e011ede60fc04ccba0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 23 Jan 2013 09:11:05 +0000 (10:11 +0100)]
Split off 2 builtins into their own instruction.
The foreach-iterator-object and foreach-next-property-name now have
their own interpreter instructions. Also cleaned up the parameter
passing helper methods.
Change-Id: I3f375ba29e1ae914e707039b157fa011878b88b6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 23 Jan 2013 09:07:18 +0000 (10:07 +0100)]
Fix direct vs indirect calls to eval (15.1.2.11)
Change-Id: I6f5dc4a1cc538f255c614838821dd2b379ba2832
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 23 Jan 2013 08:42:46 +0000 (09:42 +0100)]
Fix crash when using continue in switch inside loop
Statements like switch() call enterLoop() with a null continue block.
However it is permitted to use continue inside a case in switch, and
that should then continue in the next outter loop that supports it.
Change-Id: I723d2dad3123a2a658964d541522c7961f578dbf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 23 Jan 2013 08:37:13 +0000 (09:37 +0100)]
Fix test results to match exceptations on i386
Use SSE math instead of i387 to get the expected results for
ch08/8.5/S8.5_A2.1 and ch08/8.5/S8.5_A2.2
Change-Id: Ide1a29340c5ea7a786a679ceb4712c033c6e7fd8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Tue, 22 Jan 2013 21:43:07 +0000 (22:43 +0100)]
Fixed remaining failures for Array.prototype.reverse
Change-Id: I688a35f8873012efa3202b18d050542a6ddde196
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 21:23:59 +0000 (22:23 +0100)]
Fix remaining test failures related to Arguments object
Change-Id: I294da46457858c14c6d438cfc022d3144d4385d0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 18:25:02 +0000 (19:25 +0100)]
Fix remaining issues in the URI methods
Change-Id: I0a402fb38f72d067b9bccae1b0c85cfca2cc2812
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 22 Jan 2013 16:24:25 +0000 (17:24 +0100)]
Fix memory corruption in the MM
We never free objects ourselves anymore, and the code here
would only lead us appending the last object in the free
list a second time.
Change-Id: I2aa7bd10fbb0990c990d6948124443d222cf82f5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>