This is needed for generalizing allocation sinking to
work with instance fields and plain field offsets.
MaterializeObject now works with a set of Field/Smi objects
Right now this should be performance-neutral, but it already
simplifies the code be removing the fake fields previously used
for type arguments, closure function/context.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//189513003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33478 260f80e4-7a28-3924-810f-c04153c831b5
Added two new IL instructions: DoubleToFloat and FloatToDouble.
This enables store-to-load forwarding for Float32 arrays which was
not working before because of the implicit conversions.
Loads are now translated as:
v3 <- LoadIndexed(v2, v1)
v4 <- FloatToDouble(v3)
Stores:
v5 <- DoubleToFloat(v4)
StoreIndexed(v7, v6, v5)
There is no explicit representation for float values because
they are never used in a deoptimization environment. The only
real uses are at FloatToDouble and StoreIndexed.
For example when copying a value from one Float32 array to another
there is no intermediate conversions anymore
a[0] = b[0] before:
movss xmm1,[ebx+0x7]
cvtss2sd xmm1,xmm1
cvtsd2ss xmm2,xmm1
movss [edx+0x7],xmm2
after:
movss xmm1,[ebx+0x7]
movss [edx+0x7],xmm1
Also in this change:
Eliminate GuardField based on cid information of list factories.
GC unused symbols
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//172293004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32891 260f80e4-7a28-3924-810f-c04153c831b5
The motivation for the change is to make allocation sinking more
general when type arguments are in play. As a result I cleaned up the code
dealing with constructor type arguments as follows:
* Remove ExtractConstructorTypeArguments and ExtractConstructorInstantiator
from the intermediate language.
* The allocation stub takes now 1 argument (instead of 2) for parameterized
classes.
* The allocation stub always get an instantiated type arguments object
as input. It does not need to do a lookup in the instantiations array anymore.
* The code for looking up cached instantiated type arguments is moved
to the InstantiateTypeArguments instruction. This instruction is now also
used for object allocation. I'm not sure how relevant the cache lookup is
performance-wise. dart2js compilation did not show any regression without it.
R=regis@google.com
Review URL: https://codereview.chromium.org//163683006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32697 260f80e4-7a28-3924-810f-c04153c831b5
The call to the native List factory is lowered into IL instructions if
the length is known to be a valid smi.
This is mostly performance neutral. The acutal allocation now takes place
in the array allocation stub instead of the intrinsic code (and the runtime
List_allocate in case the fast case path fails).
This is a preparation for enabling allocation sinking for arrays and will
be extended to handle type list allocation as well. This way the allocation
site is explicitly represented as a CreateArrayInstr, instead of just being
a static call.
Another benefit is that this allows to simplify the special handling of
recognized factory calls in the optimizer once all array types are handled
this way.
R=johnmccutchan@google.com, srdjan@google.com
Review URL: https://codereview.chromium.org//138523004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32194 260f80e4-7a28-3924-810f-c04153c831b5
The bit has_finally was only used to skip the checking of the stack height
at return statements: There was an unused value floating on top of the
expression stack in unoptimized code if the finally block preceded a normal
return statement. Normallyi, that does not cause harm. Optimized code is not
affected since it has a fixed stack size for expression evaluation.
This CL fixes the stack height for functions with try-finally by introducing
a temporary local where the return value is saved before an inlined
finally-block.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//149603003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32157 260f80e4-7a28-3924-810f-c04153c831b5
This allows the debugger to single step and break on local
variable assignments in unoptimized code. Checks are only added if
the right hand side of the assignment has no safepoints where
the debugger would stop anyway.
Interestingly, generated code size is only 0.1% bigger, so the
cost is negligible.
Addresses issue 10403.
R=iposva@google.com
Review URL: https://codereview.chromium.org//125033007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31575 260f80e4-7a28-3924-810f-c04153c831b5
This allows the optimizing compiler to generate unboxed loads/stores
to fields containing double values. The double value is stored
in a reusable double object.
Unboxed loads/stores are generated for optimized code. Unoptimized code
allocates a new double on loads. To avoid performance regressions
for fields that are only written few times (e.g. only in the constructor)
I put a heuristic in place that
compares the usage count of setters and getters. Unboxed operations
are only generated if the setter is invoked a significant amount of
times (threshold is 10% of getter invocations).
The CL is so big because it changes the way LocationSummmary
is allocated: We now have a bit to generate different summaries
for optimized and unoptimized code.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//99573005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31164 260f80e4-7a28-3924-810f-c04153c831b5
Use the code's nesting to maintain the context level rather than explicitly
tracking it in the graph builder. Nested blocks know their scope and the
nesting stack can be searched to find the current context level.
Nested loops now increment and decrement the graph builder's loop depth
while they are on the nesting stack, though the loop depth state is still
kept in the graph builder itself.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//63903005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30397 260f80e4-7a28-3924-810f-c04153c831b5
In unoptimized code equality is now just another instance call.
The optimizer replaces it with a specialized implementation based on static
type information and type feedback.
Many of the manual optimizations of == in the optimizer are now just handled
by the generic inliner, plus polymorphic inlining of == calls is now possible.
This also eliminates the need for a lot of duplicated code in the backend.
I adapted the inlining heuristics to compensate for the slightly larger
inital flow graph size.
Review URL: https://codereview.chromium.org//27307005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29800 260f80e4-7a28-3924-810f-c04153c831b5
In a static- or top-level variable v
var v = expr
static v = expr
If the initializer expression expr throws, the VM throws a
CyclicInitializationError when loading v afterwards, even though
this has nothing to do with cyclic initialization.
I'm changing the way implicit static getters and static initializers are
compiled. Static initializers are invoked from static getters.
They look as follows:
get:v {
if (field.value === transition_sentinel) {
field.value = null;
throw new CyclicInitializationError();
}
if (field.value === sentinel) {
field.value = transition_sentinel;
init:v();
}
return field.value;
}
init:v {
try {
field.value = expr;
} catch {
if (field.value === transition_sentinel) {
field.value = null;
}
rethrow;
}
}
BUG=http://dartbug.com/5802
TEST=language/lazy_static3_test,
language/throwing_lazy_variable_test,
co19/Language/12_Expressions/30_Identifier_Reference_A08_t02
R=hausner@google.com
Review URL: https://codereview.chromium.org//54713003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29797 260f80e4-7a28-3924-810f-c04153c831b5
The AST for static getters differs between parsing the first time, and
subsequent parsings. This leads to a mismatch in deoptimization-ids
between the optimized and the unoptimized code.
This CL avoids creating different ASTs for the same static getters. To allow
better inlining of these getters, the initialization expression is wrapped in a
hidden static initializer-function. As a result the size of such getters is
constant and does not depend on the initializer expression.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//51123003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29680 260f80e4-7a28-3924-810f-c04153c831b5