Lars Knoll [Fri, 12 Apr 2013 12:36:41 +0000 (14:36 +0200)]
Simplify logic for put and putIndexed
Change-Id: Ia67dc06f505fdb064a22920a9786708aa6d83e6e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 10 Apr 2013 08:46:23 +0000 (10:46 +0200)]
Move property attributes out of the property arrays
Rather large change that fully separates the property
attributes from the property data. This saves quite some
memory. Since the property data for members is saves
in the class structure it'll also allow optimizations
to the lookup code.
Change-Id: I9ba1d372bb756695bef8188d1b86275562a1b219
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 9 Apr 2013 13:33:26 +0000 (15:33 +0200)]
Small fix to PropertyAttributes
Change-Id: I9fc8b291c434dc6552eba2a39623a4fe75291e0f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 9 Apr 2013 12:28:20 +0000 (14:28 +0200)]
Move functionality from PropertyDescriptor to Property
Change-Id: I37177b5287ec323f54826cce1cb307ee7f678930
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 9 Apr 2013 11:37:31 +0000 (13:37 +0200)]
Use PropertyAttributes in PropertyDescriptor
This further encapsulates the property attribute handling,
and will allow to separate the attributes from the
proprety data.
Change-Id: I140a6c9349cd1e871cd9fdcef51abac7ae78e517
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 9 Apr 2013 07:48:21 +0000 (09:48 +0200)]
Make the PropertyAttributes a proper class
Change-Id: Ia81236136aedcddaad303187b353cfcf03d792c6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 8 Apr 2013 13:38:30 +0000 (15:38 +0200)]
Change internal class when attributes of properties change
This should allow us to share property attributes for different
class instances saving quite some memory. In addition, it
can be used to speed up property access (as we then know in the
lookup whether it's a data or accessor property).
Change-Id: Ide9c6168a07b5c83a1e73d075d8fc4f6594e08fd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 8 Apr 2013 11:53:26 +0000 (13:53 +0200)]
Simplify internal class logic
getOrAddMember was always used for adding. Make that
explicit.
Change-Id: Iff202a83e857aefd231eadf59f310619c4338b52
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 8 Apr 2013 11:42:27 +0000 (13:42 +0200)]
Avoid defining name twice in some error objects
Change-Id: I2e96718556ef5a4262816233351b71dd6a80cb9d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Mon, 8 Apr 2013 07:08:02 +0000 (09:08 +0200)]
Store the global object as an Object pointer in the engine
Change-Id: Ia8b010a9d9c9dd3aacb1b08ce34a42236fa73195
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 7 Apr 2013 15:23:36 +0000 (17:23 +0200)]
Change the Context stack back to a singly linked list
The other implementation was too complicated, and only solved
one special case (indirect eval calls), but that one can be
solved by simply creating a GlobalContext when needed.
In addition it'll make it simpler to implement context
optimisations for simple methods in the future.
Speeds up the V8 benchmark by 3%
Change-Id: I61ac7753821e0174476094f51a9a4e934563f8e0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 19:38:09 +0000 (21:38 +0200)]
Convert the remaining builtin methods to use the SimpleCallContext
Change-Id: Ib01bd0c15578b93829abd6fcf8df22cac12daf14
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 19:15:58 +0000 (21:15 +0200)]
Introduce a SimpleCallContext for simple functions
Use it for most builtin methods. Gives ~10% speed
improvement on the V8 benchmark.
Change-Id: I0039f102e561c0adbe1a9b070150ad32142a33e8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 21:45:15 +0000 (23:45 +0200)]
Fix scope for functions created through bind()
Change-Id: I69718b2943259dc0f6d6bf2856e651bfb4fbe3a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 14:23:22 +0000 (16:23 +0200)]
Move arguments out of ExecutionContext and into CallContext
Change-Id: Ic826e3e71eac9171fa113dec79db7c69982f2386
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 13:57:26 +0000 (15:57 +0200)]
Move activation out of ExecutionContext
Have an activation object (for now) in CallContext, and
a global object in the GlobalContext.
Change-Id: I02b1e6a2e976d914acfcc3d35cd8abda08dfd298
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 12:51:13 +0000 (14:51 +0200)]
Don't create new Objects in the current scope
When creating new objects through the V8 API, use the
root context, not the current context.
Fixes some crashes in QML, after creating contexts on the
stack again.
Change-Id: I9e49fa39f6222dcfa747b7466f1555572dc24f94
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 12:46:27 +0000 (14:46 +0200)]
Move function pointer from ExecutionContext to CallContext
Change-Id: Id992154d38e26ee95ccf6f175eeab360c63c0b04
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 12:37:24 +0000 (14:37 +0200)]
Remove unused methods
Change-Id: I928b9c4816b421e3d79bd038c37e24d09129899d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 12:16:56 +0000 (14:16 +0200)]
Move locals from ExecutionContext to CallContext
Change-Id: I3f6751fc7e0450a74339f1131b10b56a2ebe6a50
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 11:27:38 +0000 (13:27 +0200)]
Split out the Context for With/Catch into their own classes
Change-Id: I8e7d2fe649eb2c8119f9a787d54b8e92c0e9684f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 5 Apr 2013 09:52:08 +0000 (11:52 +0200)]
Introduce different context types
These will be used to split up the context
into more specialized subclasses.
Change-Id: Ic346c1738ad6e9c4d78e2e6f51133c8ea781f59b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 4 Apr 2013 13:05:24 +0000 (15:05 +0200)]
Clean up the property lookup code
Also look a bit deeper into the proto chain. This speeds up
the deltablue benchmark by 10%
Change-Id: Id3f5de58f336d7ca74c7c32e6c30564410baf1e4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 3 Apr 2013 18:24:38 +0000 (20:24 +0200)]
Create some execution contexts on the stack again
This seems to be working now, and speeds up our benchmarks
with another 20%.
Change-Id: Ib01bf8f66db91b0e06090eff705db79b0caf66ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Wed, 3 Apr 2013 18:35:33 +0000 (20:35 +0200)]
Remove stray backslash
Not needed :)
Change-Id: If22d077a05ffa21f393569f93fcb9f599008af82
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 3 Apr 2013 14:47:42 +0000 (16:47 +0200)]
Don't include internal headers in qv4v8.h
Change-Id: I2b43d8c356a8b433836c1e3f6a99675e69b670fa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 3 Apr 2013 13:59:17 +0000 (15:59 +0200)]
Speed up Context creation and handling
Creating context and locals in two mallocs wasn't very good
for performance. This allocates them in one go again, while
still managing them through the garbage collector.
This brings performance up by around 20%.
Change-Id: I9b31d669e1a502c90a117bacf5fee5d23e9821b4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 2 Apr 2013 13:28:04 +0000 (15:28 +0200)]
Define MODULE_VERSION so it builds against latest qtbase
Change-Id: I55404dc70b1de8c9cf5a6aade503e64ec7fe5c84
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 21 Mar 2013 20:32:23 +0000 (21:32 +0100)]
Some further fixes to the v8 API
Better implementation of user comparisons, and fix a bug in
GetPropertyNames.
Change-Id: I2afa87239e4e269707d1809712b0beefed162d0e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 21 Mar 2013 14:16:07 +0000 (15:16 +0100)]
Implement v8::StackFrame and v8::StackTrace
Change-Id: Ib0f210f1d30a0681c3d741544206bbe0d9d26f95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Sat, 30 Mar 2013 16:43:03 +0000 (17:43 +0100)]
Speed up regexp creation through caching
RegExp objects (the backend to the JS visible RegExpObject) are garbage
collected. Now we also keep (weak) references to all live instances in a
QHash<Key, RegExp*> (where key is essentially the pattern), which allows for
quick re-use. Once a regexp gets garbage collected, it also disappears from the
"cache".
Speeds up v8-bench's RegExp test by ~1%.
Change-Id: Ibeb2fa1b234a95b884594817bf5c0468fd54e839
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 30 Mar 2013 16:05:32 +0000 (17:05 +0100)]
Changed RegExp to be garbage collected instead of reference counted
This makes a cache implementation much easier in the future.
Change-Id: I35ec5c416dc7455ea51dc58f889e2a4ee74d0ee8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 29 Mar 2013 03:00:03 +0000 (04:00 +0100)]
Fix license headers
These files are not part of Qt Creator. Use the regular Qt module
template.
Change-Id: Ifde77e7d365c313b3284bf0a65383fa4bd10b4be
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 25 Mar 2013 16:31:38 +0000 (17:31 +0100)]
Fix memory allocation of executable code
Previously we allocated at least one page for each compiled function, even if
it required less bytes (common). That causes excessive memory usages for large
scripts or long running scripts with frequent eval usage.
This patch introduces a simple allocator that allocates also on page
granularity from the system but allocates the remaining space in the pages in
sub-sequent calls. It is optimized to scale with the number of requests and
also return pages to the system as soon as possible.
Change-Id: I0751a8094afe97e94b5f44c6a691a679ecdb1df0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 22 Mar 2013 11:15:19 +0000 (12:15 +0100)]
Fix ch12/12.2/12.2.1/12.2.1-21-s
(indirect eval call writing to arguments should not throw type error)
Correctly propagate needsActivation, usesArgumentsObject and strictMode from
the parsed eval code to the ScriptFunction before creating the call context.
Also don't let the qml activation object overwrite an existing one unless
provided.
Change-Id: Ia92e9c40f947cbe09984fca6ecb0d1e03205ff51
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 21 Mar 2013 19:50:55 +0000 (20:50 +0100)]
Implement fast argument lookups also for outter scopes
Change-Id: If5b652a8ccfd81bdaa4d6f9ce83c0bf88daf18ae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 22 Mar 2013 01:30:19 +0000 (02:30 +0100)]
Fix regression from commit
96ef0e4010b1be01a7b89c136ae9c518eb8492db
Formals only shadow variable declarations, not function definitions.
Also fixes failing ch10/10.2/10.2.1/S10.2.1_A4_T1
Change-Id: I23906fe18bba4393d7c709a9dae5ff35c72d1129
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 21 Mar 2013 19:41:05 +0000 (20:41 +0100)]
Fix identifier lookups when mixing variables and arguments
Suppose the following test-case:
function outter() {
var foo = "bar";
function inner(foo) {
function innerMost() {
print(foo);
}
return innerMost();
}
inner("FOO");
}
When looking up "foo" in innerMost we used to find the variable foo in outter,
because our fast lookup optimization doesn't take function parameters in outter
scopes into account. However we are supposed to find the parameter "foo" from
inner's activation object.
This fixes the last issue with running the Boyer benchmark.
Change-Id: I645ed1c601aff835bc9b7ee1fcfbdfa9c295a70c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 21 Mar 2013 19:35:31 +0000 (20:35 +0100)]
Improve readability of disassembly
Replace the addresses of identifier strings with their actual values.
Change-Id: Icbe905ced7949913655575cac39fcf9250672f7f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Wed, 20 Mar 2013 13:53:27 +0000 (14:53 +0100)]
Fix shadowing of arguments through local variables
The declaration binding instantiation paragraph in the spec (10.5) says that
the formal parameters are entered into the environment before anything else.
Later when processing the variable declarations, CreateMutableBinding and
SetMutableBinding is only called if the HasBinding return false. That means in
the following example the "var foo" declaration does not have any effect, not
even setting foo to undefined:
function fun(foo) {
var foo;
return foo;
}
fun("a") === "a"
This patch implements this behaviour at compile-time by ensuring that no formal
parameter can be entered as member into the environment and thus writes to
these variables will overwrite the parameter values only.
This also advances execution on the EarleyBoyer benchmarks a little further,
which tries to re-declare a lot of parameters again as local variables.
Change-Id: Ic12d71fd39caa44169fc4b62526f03078c2513c4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Thu, 21 Mar 2013 17:39:23 +0000 (18:39 +0100)]
Fix random crashes in leaf functions
A "leaf" function that doesn't call any other JS functions but calls built-in
functions may easily have function->maxNumberOfArguments "calculated" to zero
due to the lack of call expressions. That means we may not have allocated
enough stack space for the variable arguments needed for builtin runtime calls
and then end up overwriting some of the callee saved registers.
This can also happen in non-leaf functions, but is less likely of course.
So in addition to the explicit call expressions this patch also takes the
built-in expression parameter list of the IR CALL into account. It may end up
calculating a maxNumberOfArguments value that is slightly too high, but we pay
a relatively small price for that compared to doing a second pass over the IR
or trying to patch offsets after code generation.
Change-Id: Ic7cddd38952fdccbb1d636bc4d5578c2276fc1c9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Tor Arne Vestbø [Thu, 21 Mar 2013 13:14:42 +0000 (14:14 +0100)]
Move V4 IR into its own V4IR namespace to avoid clash with QtDeclarative
Change-Id: Iddaedeb72b41cab35c3cd51fc07440dffcea81c2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Tor Arne Vestbø [Thu, 21 Mar 2013 13:04:21 +0000 (14:04 +0100)]
Pop stack instead of pushing in platformLeaveStandardStackFrame on ARM
Change-Id: Ice122f89c4bb6d7f29be67732f666dfc0d9d1b89
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Wed, 20 Mar 2013 15:55:08 +0000 (17:55 +0200)]
v8 api: Correctly set up the prototype property for constructors
Also remove some debug output for methods that are actually working
as intended.
Change-Id: Id5df0c87eda40f8ae9769cc43fa05a9ecf67c31c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Thu, 21 Mar 2013 01:08:36 +0000 (02:08 +0100)]
Fix crash with v8-bench.js
Sometimes the arguments array of the context is provided by the caller and not
copied. In that case the address may not be valid anymore after the call, so
we need to reset arguments/argumentCount after the call in popContext, otherwise
we end up calling mark() on dangling pointers.
Also make sure to mark the entire arguments array, not too much and not too little,
i.e. use argumentCount.
Change-Id: I8b96521b0fb15142ed8c723a9354d275be48cc58
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 19 Mar 2013 15:04:10 +0000 (16:04 +0100)]
Fix module operation to conform to IEEE 754 arithmic.
When the two operands are integers, and the result is 0 AND the
left-hand side is negative, then discard it and do the calculation based
on doubles. The reason is that the integer mod can only return +0,
while (-1 % -1) and (-1 % 1) should return -0.
Change-Id: I676e5bbdf3a7dcb29006d9101a9e5e7c33467c49
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 19 Mar 2013 14:29:53 +0000 (15:29 +0100)]
Distinguish better between a FunctionDecl and a FunctionExpr.
An ExpressionStatement can not start with the function keyword because
that might make it ambiguous with a FunctionDeclaration. However, we
insert the same node for either, so if we have a FunctionExpression
that is actually a FunctionDeclaration, that is okay. If we have any
other ExpressionStatement that starts with a "function" token (e.g. a
call expression where the base is a FunctionExpression), error on it.
Change-Id: I76acf9aca97b05f25642f82006631cb375dd8c11
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 19 Mar 2013 13:21:18 +0000 (14:21 +0100)]
Fix Number.prototype.toFixed.
ECMA5.1 paragraph 15.7.4.5, item 7:
If x >= 10^21, then\r a. Let m = ToString(x).
Change-Id: I36516177aefddd10fec8d3f55b7644d8f7f65f64
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 19 Mar 2013 12:56:16 +0000 (13:56 +0100)]
Fix a edge case in String.lastIndexOf.
"".lastIndexOf() should return -1, not 0.
Change-Id: Iaf2359d7c1d315b2584a899ada61b658fc317f3c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 19 Mar 2013 12:15:13 +0000 (13:15 +0100)]
Mark test as passing after qtdeclarative change.
Depends on https://codereview.qt-project.org/51392 .
Change-Id: I2309db6f2f829e4dd05cd20983b9b986c166b607
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 18 Mar 2013 15:27:39 +0000 (16:27 +0100)]
Mark more tests as passing after qtdeclarative change.
Depending on https://codereview.qt-project.org/51264 .
Change-Id: Iaa1cf8e583944d7cf0f873f203b834e85712ea5f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Erik Verbruggen [Mon, 18 Mar 2013 19:53:26 +0000 (20:53 +0100)]
Check if "use strict" has no escaped chars.
Change-Id: I7dc172eba02d454467ead1e18a1a59e98890dd54
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 18 Mar 2013 15:22:58 +0000 (16:22 +0100)]
Fix function declaration best-practice check.
Most checks only apply in strict mode (added that), except for a
function declaratin in a then/else part or a while body, which is in
a function body.
Change-Id: Ib7afecb1fb3a856ea57c7dd8b205854034739692
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 18 Mar 2013 09:52:05 +0000 (10:52 +0100)]
Build fixes for Windows.
Change-Id: I8f758e8c7dced17b556c6cc2531f86b7dd974cb6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 18 Mar 2013 09:46:51 +0000 (10:46 +0100)]
Fixes to run the test suite on Windown.
Change-Id: I94292c873cb3029b19cc90bdfa6f9312215e6011
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 18 Mar 2013 10:03:51 +0000 (11:03 +0100)]
Moved TemporaryAssignment into its own header.
So we can re-use it without including all of qv4engine.h.
Change-Id: I3de1e6a26b20afef4969001dd2dd774688f25620
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 13 Mar 2013 10:13:30 +0000 (11:13 +0100)]
Handle best-practice conditional function declaration.
Change-Id: I58b442b0af279922e8e9d9cbd17ab1d24994f08c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Thu, 14 Mar 2013 21:41:58 +0000 (17:41 -0400)]
Fix initialization of call contexts
Change-Id: Icf32af65ac89e4bf2bf28c72ca7161f4ad65b07b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 21:10:02 +0000 (17:10 -0400)]
rename qmljs_math to qv4math
Change-Id: Ie0a6eb35476da0a672856afdc082a935fb9be92e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 21:08:29 +0000 (17:08 -0400)]
Rename qmljs_runtime to qv4runtime
Change-Id: I46ba9b2621be72116d94bee249ad5b798e951c88
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 21:05:57 +0000 (17:05 -0400)]
Rename qmljs_value.* to qv4value.*
Change-Id: I1d85f5efd43854ea5d96c72d7a32823dc610453e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 14:47:57 +0000 (15:47 +0100)]
Make ExecutionContext garbage collected
This comes with ~10 percent performance regression,
due to the extra allocation of the locals, but fixes
a long standing mem leak.
Change-Id: Ic683cc13a8c3bc66fe3f41dee61d5e388b9f3e32
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 20:56:42 +0000 (16:56 -0400)]
Some more optimisations to the memory manager
Adjust chunk size to the size of objects stored inside.
Move stack base calculation to the constructor, no need to
do it at every gc run.
Change-Id: Id878cb067fb7ab38576e0811dcd3670617f33534
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 13:03:04 +0000 (14:03 +0100)]
Remove the parent pointer from ExecutionContext
It's cleaner to have an explicit stack of contexts
in the Engine, esp. as the global context can get
pushed onto the stack several times. This avoids
an ugly hack in eval() where we created a 'copy'
of the global context.
Change-Id: I3936443fba6c1829a60a8e0e9a106ec75293274f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 11:59:11 +0000 (12:59 +0100)]
Move all context management methods into the ExecutionEngine
Centralizes this functionality, so it can be more easily handled
and modified in the future.
Change-Id: I733fb791b816a117343615ddd7d7a754f42d3dbb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 11:48:00 +0000 (12:48 +0100)]
Rename qmljs_engine.* to qv4engine.*
Change-Id: I452fc11972c802acc14e0a3358d8c408b6dbded8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Thu, 14 Mar 2013 11:43:27 +0000 (12:43 +0100)]
Rename qmljs_environment.* to qv4context.*
Change-Id: I6fe62b501803422f78b47a87c55e4278820725aa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 8 Mar 2013 08:38:46 +0000 (09:38 +0100)]
Optimise put and defineOwnProperty a bit
Change-Id: Ie944ce76a744c2bbadce20da28ceb9104f9c95c2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 8 Mar 2013 08:17:20 +0000 (09:17 +0100)]
Remove unused method
Change-Id: Ie96da445a7c94e43db1d293f254315eed6af6713
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 8 Mar 2013 08:17:11 +0000 (09:17 +0100)]
Remove unused variable
Change-Id: I83cab99dbb6905b4f480cf1584cdb96246fd987d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Mar 2013 21:50:00 +0000 (17:50 -0400)]
Implement another method in the v8 API
Change-Id: I54918914a8c9b395211ccbff891a90ab069be4a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Mar 2013 21:41:42 +0000 (17:41 -0400)]
Message is refcounted
Change-Id: Ic5097ea1eae6503f906157b3d4bf51a028c94280
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Mar 2013 21:39:21 +0000 (17:39 -0400)]
Catch some more exceptions in the v8 API
Change-Id: I23428f7dce0771576ae1243812eeed7a534dc833
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Mar 2013 21:09:18 +0000 (17:09 -0400)]
Remove some debug output
Change-Id: I9178da579194479eac8996290cda1ae056720b15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Mar 2013 21:05:34 +0000 (17:05 -0400)]
Cleanup and unify context creation
* Always create contexts on the heap. When embedding native methods
we can't create contexts on the stack anymore without running the
risk of them being used in some scope chain.
* Unify context creation for call contexts, share the code
* Add a hack for indirect calls to eval and create a new 'fake'
global context there, so we don't mess up the context stack (it
broke badly when unwinding exceptions before).
Change-Id: I5804224dc26582f24ec79518639ceb13a8a3e967
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Wed, 13 Mar 2013 21:03:51 +0000 (17:03 -0400)]
Pass the current context to evalCall
Passing the root context will seriously mess up our
JS call stack.
Change-Id: I513a9eb61bdc24b7a4542bc5f8556bf927af6c75
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Tor Arne Vestbø [Wed, 13 Mar 2013 13:15:50 +0000 (14:15 +0100)]
Fix a few warnings
Change-Id: I82efe66a28a76eb64b1254a7a9c6c60a0fce6228
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Mar 2013 19:34:09 +0000 (15:34 -0400)]
Be conservative and assume that functions need activation
A function that doesn't need it's context allocated on the heap
should state so explicitly. If not it's better to assume that we
need a heap allocated context.
This fixes a crash on the QML clocks demo.
Change-Id: I0a67e6ed38c99e7dd75dd03d6cc2dda10d8b5ad7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Mar 2013 19:06:55 +0000 (15:06 -0400)]
Remove unused method
The method was only used to destroy the global context
and it's usage was wrong and needless there.
Change-Id: If97a0c94862b5f7f7ac4dff5ccb58dc2ef8cec4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Tue, 12 Mar 2013 18:49:13 +0000 (14:49 -0400)]
Add valgrind support to our garbage collector
Tell valgrind about the memory we allocate and free in the
garbage collector. Also mark stack variables as initialized
before walking the stack.
This avoids all valgrind warnings related to GC and gives
proper warnings if we should attempt to access garbage collected
memory.
Change-Id: I7e923a163c25e7a5b4409b1b9c2191f314675f2d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Erik Verbruggen [Tue, 12 Mar 2013 13:18:04 +0000 (14:18 +0100)]
Add debugging function to dump Value contents.
Change-Id: I45e1d1d13fe7dee22809734595a3fbbfd03b123d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Tue, 12 Mar 2013 11:46:44 +0000 (12:46 +0100)]
Moved temp compression to codegen to use for all backends.
Change-Id: I3afba14741f18782e71210b14d9d091fe0bebc51
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Wed, 6 Mar 2013 10:52:40 +0000 (11:52 +0100)]
Added the constant propagation optimization.
Change-Id: I4fe680ff334a13085df425ad2badad08e548f21f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Fri, 1 Mar 2013 13:27:50 +0000 (14:27 +0100)]
Fix & re-enable Temp compression for the interpreter.
Change-Id: Ie9e767d36d3d810bf0d2a173d04954277041f68f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Tue, 12 Mar 2013 09:00:06 +0000 (10:00 +0100)]
Fix crash when calling Object.create(null)
O is allowed to be null here, so don't use objectValue() unconditionally
and instead use asObject().
Change-Id: I3e868d3486d2de109c94aef8a7de16110a3a8326
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Mon, 11 Mar 2013 12:02:59 +0000 (13:02 +0100)]
Add support for ARM exception unwinding
This is used only on Linux/ARM. iOS uses setjmp/longjmp.
Change-Id: I06f907ce702c1b8e06a50ac31b5486d11ef392ec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Sat, 9 Mar 2013 11:51:12 +0000 (12:51 +0100)]
Make it possible to debug exception handling with libunwind
Run qmake with CONFIG+=debug-with-libunwind.
Change-Id: I02f5820a1c8ee9132dac521d182007800c250103
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 11 Mar 2013 11:00:13 +0000 (12:00 +0100)]
Inline the two most common parameter fetch cases.
By inlining temp and local fetching, the interpreter is 30% faster
on x86 on crypto.js. x86_64 gains about 35%.
As the comment in the source already indicates: this might need some
tweaking for QML.
Change-Id: I9aa51036d42d2749f9aeec39a479d9e5f6233a23
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Erik Verbruggen [Mon, 11 Mar 2013 10:29:01 +0000 (11:29 +0100)]
Mark asm math functions as const.
This allows gcc to inline slightly better, gaining 1% in the
interpreter.
Change-Id: Ia0ebc9eb698f12de4ff7860e9f62a62dbd782ccd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Lars Knoll [Sun, 10 Mar 2013 17:43:06 +0000 (18:43 +0100)]
Catch more exceptions in the v8 API layer
Change-Id: I7af3abbbf8cae86abe31a0d55d3d4c7e8c91a803
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 10 Mar 2013 16:53:29 +0000 (17:53 +0100)]
Write properties back to the qml Object
The object acts as a replacement for the QML scope chain.
We need to write values to it even if __hasProperty__ returns
false.
Change-Id: I97856ab8cc3a7a728bb244f40b9f230a415b5a33
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 10 Mar 2013 13:59:44 +0000 (14:59 +0100)]
Add a proper constructor to v8::FunctionTemplate
Change-Id: I59b414484c05d8292ee7300860ef9e0611da49e6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sun, 10 Mar 2013 13:58:35 +0000 (14:58 +0100)]
Properly mark objects at the beginning of a chunk
Objects at the beginning of a chunk didn't get marked
properly as qLowerBound in the mark() method returned an
even number for them. Fix this by subtracting one to the
beginning of the chunk.
Change-Id: I1abd7e24f5b7f374fc0776b7d891a3124fee7270
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Sat, 9 Mar 2013 22:18:25 +0000 (23:18 +0100)]
Fix v8::Persistent
Implement it in a similar way as PersistentValue
Change-Id: If4adba61a8bfedce657f07ee24662c3b13384fd9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Lars Knoll [Fri, 8 Mar 2013 21:52:55 +0000 (22:52 +0100)]
Add exception handling support to the v8 API
Not all calls are yet propertly protected by try/catch
statements, but it should work in principle.
Change-Id: I5ddaf433b0a454106dc2743fe2ccfc5822fb3926
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Simon Hausmann [Fri, 8 Mar 2013 14:48:50 +0000 (15:48 +0100)]
Implement more missing bits & pieces including a fake "QML mode"
Change-Id: Ifbbc5004ada03b6efa7a9884938ff5d59220c5fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Mar 2013 13:11:42 +0000 (14:11 +0100)]
Fix name lookup for named function expressions
Change-Id: Ia36b2b5c5b40475450fe369c7d6cb5e3965a4488
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Mar 2013 12:02:26 +0000 (13:02 +0100)]
Implemented a whole more API...
Change-Id: Ica73c21e58b406abd6310c59ec0f541ae2cc9155
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Mar 2013 10:47:26 +0000 (11:47 +0100)]
Implemented invocation callback on FunctionTemplate
Change-Id: I718f10f28a053eda78e086407183706e8fad317b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Simon Hausmann [Fri, 8 Mar 2013 09:53:41 +0000 (10:53 +0100)]
Implemented v8::Arguments
Change-Id: I02f7072c13c319b1bdf77471360308bd0d0d3d2a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>