| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Better implementation of user comparisons, and fix a bug in
GetPropertyNames.
Change-Id: I2afa87239e4e269707d1809712b0beefed162d0e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ib0f210f1d30a0681c3d741544206bbe0d9d26f95
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
This makes a cache implementation much easier in the future.
Change-Id: I35ec5c416dc7455ea51dc58f889e2a4ee74d0ee8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
(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>
|
| |
| |
| |
| |
| | |
Change-Id: If5b652a8ccfd81bdaa4d6f9ce83c0bf88daf18ae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
Replace the addresses of identifier strings with their actual values.
Change-Id: Icbe905ced7949913655575cac39fcf9250672f7f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| | |
Change-Id: Iddaedeb72b41cab35c3cd51fc07440dffcea81c2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ice122f89c4bb6d7f29be67732f666dfc0d9d1b89
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Also remove some debug output for methods that are actually working
as intended.
Change-Id: Id5df0c87eda40f8ae9769cc43fa05a9ecf67c31c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ECMA5.1 paragraph 15.7.4.5, item 7:
If x >= 10^21, then
a. Let m = ToString(x).
Change-Id: I36516177aefddd10fec8d3f55b7644d8f7f65f64
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| | |
"".lastIndexOf() should return -1, not 0.
Change-Id: Iaf2359d7c1d315b2584a899ada61b658fc317f3c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I7dc172eba02d454467ead1e18a1a59e98890dd54
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| | |
Change-Id: I8f758e8c7dced17b556c6cc2531f86b7dd974cb6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| |
| |
| | |
So we can re-use it without including all of qv4engine.h.
Change-Id: I3de1e6a26b20afef4969001dd2dd774688f25620
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I58b442b0af279922e8e9d9cbd17ab1d24994f08c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Icf32af65ac89e4bf2bf28c72ca7161f4ad65b07b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ie0a6eb35476da0a672856afdc082a935fb9be92e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I46ba9b2621be72116d94bee249ad5b798e951c88
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I1d85f5efd43854ea5d96c72d7a32823dc610453e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| | |
Change-Id: I452fc11972c802acc14e0a3358d8c408b6dbded8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I6fe62b501803422f78b47a87c55e4278820725aa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ie944ce76a744c2bbadce20da28ceb9104f9c95c2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ie96da445a7c94e43db1d293f254315eed6af6713
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I83cab99dbb6905b4f480cf1584cdb96246fd987d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I54918914a8c9b395211ccbff891a90ab069be4a5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ic5097ea1eae6503f906157b3d4bf51a028c94280
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I23428f7dce0771576ae1243812eeed7a534dc833
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I9178da579194479eac8996290cda1ae056720b15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Passing the root context will seriously mess up our
JS call stack.
Change-Id: I513a9eb61bdc24b7a4542bc5f8556bf927af6c75
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: I82efe66a28a76eb64b1254a7a9c6c60a0fce6228
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|