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
When inlining implicit getters via the polymorphic inliner
(and not through the flow graph optimizer) the fields loaded
must be added to the list of guarded fields that trigger
deoptimization when a store violated the field type guard.
Also, this CL avoids adding fields to the list from inlining
candidates that do not get inlined after all. Previously, the
optimizer pass on the callee graph would add guarded fields
even if the final graph does not get inlined.
TEST=tests/language/vm/optimized_guarded_field_test.dart
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//24096018
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27655 260f80e4-7a28-3924-810f-c04153c831b5
The print-ast output is useful for debugging front end issues. It is a mix
of fully-parenthesized prefix notation (i.e., Lisp S-expressions) with some
infix.
It is not valid S-expressions for various other reasons. Most obviously, it
uses ' (single quote) instead of " (double quote) to delimit strings.
This change makes the print-ast output a valid Scheme S-expression. It can
be pretty printed by copying it, quoting it (by preceding it with a single
quote), and evaluating it at the REPL of a Scheme implementation.
Also, the AST node pretty names are changed to predictably match the class
name. It doesn't seem helpful to have them be arbitrary.
BUG=
R=regis@google.com
Review URL: https://codereview.chromium.org//23923005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27282 260f80e4-7a28-3924-810f-c04153c831b5
When nesting try-finally, the outer finally was incorrectly executed
twice under certain conditions (a return in the inner try-block and a outer
finally-block that ends with throw)
This was because finally-code was inlined at return/break/continue statements
and it was associated with the wrong catch-handler when compiling.
This CL tracks indices of try-blocks in the parser so that each inlined
finally block has the correct catch handler index.
BUG=https://code.google.com/p/dart/issues/detail?id=11972
TEST=test/language/throw8_test.dart
R=hausner@google.com
Review URL: https://codereview.chromium.org//22184003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25767 260f80e4-7a28-3924-810f-c04153c831b5
This CL removes the remaining missing cases when inlining closure
calls.
In order to benefit for code using forEach, I added GrowableObjectArray.forEach
to the functions that should always be inlined.
I also renamed BuildLoadContext/BuildStoreContext helpers in the flow
graph builder to better match what they do.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//19721004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25551 260f80e4-7a28-3924-810f-c04153c831b5
Add profiling support to select OSR candidates and launch the compiler
for OSR, followed by entry to the function at the OSR entry point.
Implemented only on IA32 and X64. The initial implementation can be
improved in various ways --- specifically: tuning of profiling
parameters and incorporation of feedback about the actual values seen
at OSR entry.
R=fschneider@google.com
Review URL: https://codereview.chromium.org//16693006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24024 260f80e4-7a28-3924-810f-c04153c831b5
1. The result value of an expression
"super.someMissingSetter = val" was incorrect in case of a noSuchMethod call.
To fix this I refactored the BuildStaticNoSuchMethod function. It now no longer
creates AST nodes and visits them, because the last argument may be needed saved
as a result value.
2. The evaluation order of "super[e1] = e2" was wrong in case of a noSuchMethod call.
BUG=dart:8917, dart:10965
TEST=tests/language/super_operator_index7_test.dart, tests/language/super_operator_index8_test.dart
R=srdjan@google.com
Review URL: https://codereview.chromium.org//15979010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23553 260f80e4-7a28-3924-810f-c04153c831b5
This CL affects a subset of expressions that use temporary locals: constructor
calls, array literals and and instance getter postfix-ops.
For expressions that are de-sugared in the parser I added LetNode.
It creates a scoped temporary local bound to an initializing expression.
For expressions where we need a temporary local at graph-building time,
I added a helper class TempLocalScope to easily create a single temporary
local in the graph builder since this is a frequently recurring pattern.
This simplifies code in the parser and the graph builder and also fixes a
bug with indexed-super invocation and NoSuchMethod.
BUG=dart:8918
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//14942010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23401 260f80e4-7a28-3924-810f-c04153c831b5
Two parts:
1. Change AllocateObjectWithBoundsCheck to a normal call that takes
four arguments on the stack using PushArgument IL instructions.
Before inputs were in registers and the instruction pushed them itself
before the runtime call. This make the code more compact and simplifies
the flow graph builder.
2. Simplify instructions for building constructor type arguments for another
special case to simplify the instruction pattern and generate smaller
code for that case.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//15564004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22943 260f80e4-7a28-3924-810f-c04153c831b5
instantiator of generic objects (fixes issue 10149).
This optimization considers the generic type argument vector of the instance
being allocated as well as the generic type argument vector of the compile
time type of the instantiator.
If the instance vector is a prefix of the instantiator vector, the instantiator
vector can be shared by the new instance.
R=srdjan@google.com
Review URL: https://codereview.chromium.org//14106013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22155 260f80e4-7a28-3924-810f-c04153c831b5
Separate the decision to inlin, which produces a graph to inline, from the
act of inlining itself. For polymorphic inlining we need such a separation.
Change the function that integrates an inlined function graph into a caller
graph so that it operates on a graph entry and set of inlined exits rather
than on an entire flow graph. Flow graphs represent a whole function so
this change allows us to replace an instruction with an arbitrary subgraph.
Change the name of the InliningContext class to InlineExitCollector to more
accurately reflect what it does.
Review URL: https://codereview.chromium.org//13932005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21539 260f80e4-7a28-3924-810f-c04153c831b5
Before: we marked the entire graph's dominator tree invalid in case there
were multiple exits from an inlined function and recomputed dominators after
inlining. Now: in case there are multiple exits we collect them in a fresh
join block and compute its immediate dominator as the nearest common
ancestor in the dominator tree over all predecessors.
Review URL: https://codereview.chromium.org//14067002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21268 260f80e4-7a28-3924-810f-c04153c831b5
This is a preparation CL for supporting try-catch in optimized code. Until
now, we used normal TargetEntryInstr for catch blocks.
This meant carrying around handler_types_ and catch_try_index_ for blocks
that are not catch blocks which is not needed.
For now, CatchBlockEntry behaves the same as TargetBlockEntry except for
the additional members needed for catch blocks.
Review URL: https://codereview.chromium.org//12600012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19864 260f80e4-7a28-3924-810f-c04153c831b5