Commit Graph

182 Commits

Author SHA1 Message Date
fschneider@google.com e994d8b697 Revert r31326.
TBR=johnmccutchan@google.com,

Review URL: https://codereview.chromium.org//118133004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31332 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 12:21:09 +00:00
fschneider@google.com fe726e1971 Use parallel move resolver for optimized try-catch.
This CL has no change in functionality and is purely clean up and
refactoring. Instead of manually generating the moves at throwing
instructions in try-catch, construct a parallel move and use the resolver
to emit the native code. This eliminates a lot of duplicated code
from all platforms.

It will also allow to re-use stack space that is currently allocated
separately for each individual try-catch in a function.

I added a few more unrelated minor changes in various parts of the VM
* Simpilify guard code generation
* Resolve refactoring TODO in deoptimization
* Improve names

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//119213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31326 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 09:41:42 +00:00
fschneider@google.com 6abd6e326e Add mutable double boxes for fields.
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
2013-12-16 15:11:31 +00:00
kmillikin@google.com fe4e6645e5 Remove extraneous assembly comment.
It is not necessary to have a comment at deferred code for each live
floating-point register.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org//104143003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30849 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-04 10:37:01 +00:00
regis@google.com d1e945994e Improve type test and type equality for generics (issue 15148).
R=srdjan@google.com

Review URL: https://codereview.chromium.org//81363002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30546 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-21 21:30:51 +00:00
regis@google.com db2cec593d Distinguish between malformed and malbounded types more efficiently using the
recently introduced LanguageError 'kind' field.

R=hausner@google.com

Review URL: https://codereview.chromium.org//75713002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30383 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-18 23:31:12 +00:00
regis@google.com 2a355a7bb6 Lazily format LanguageError messages (fix issue 15069).
R=iposva@google.com

Review URL: https://codereview.chromium.org//68113028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30308 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-15 18:54:24 +00:00
fschneider@google.com 88726f7f70 Streamline code generator for branches and comparisons.
This is another refactoring step. It turn all comparisons
 to be generated after the same pattern and removes duplicated
 code from each of the different comparisons (smi, mint, double, etc.)

A comparison as an expression now follows the same patterns as a comparison
inside a branch. It just adds a common epilogue to materialize the boolean
result.

In another CL this common epilogue will be generated by reusing the IfThenElse
IL instruction.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//64483002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30243 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-13 18:21:27 +00:00
johnmccutchan@google.com 29c01044bc This is the final breaking change in dart:typed_data needed for Dart 1.0. We need this change because the ECMAScript SIMD specification only includes Int32x4 and Int32x4List and our types must match.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//56023004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29849 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-04 21:56:59 +00:00
fschneider@google.com 9031c80c88 Change == into an instance call to allow polymorphic inlining of ==.
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
2013-11-04 11:32:52 +00:00
srdjan@google.com 16c251a96e Cleanups.
R=regis@google.com

Review URL: https://codereview.chromium.org//53753003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29717 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-31 23:09:43 +00:00
fschneider@google.com ce9573722c VM: Fix checked mode crash (issue 13831).
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
2013-10-31 16:49:55 +00:00
kmillikin@google.com 253fc69ecc Record a correct deoptimization environment for slow-path code.
Slow-path code is not marked as a call, so the deoptimization environment
built by the register allocator can contain unspilled registers.  However,
all registers are spilled before the call.  Compute the spill slot for all
registers and change the ones in the deoptimization environment to be
spilled.

BUG=https://code.google.com/p/dart/issues/detail?id=13995
R=fschneider@google.com

Review URL: https://codereview.chromium.org//26823006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29239 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-25 10:17:10 +00:00
regis@google.com 2f900dab13 Cache number of type arguments in class object instead of recalculating it.
Reduce size of num_native_fields field in class object.

R=asiva@google.com

Review URL: https://codereview.chromium.org//26682003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28670 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 18:31:31 +00:00
kmillikin@google.com e375053d2f Pattern match on generated code to find edge counters.
In unoptimized code, use platform-specific pattern matching on generated
code to find edge counter arrays.  Previously we searched pointer offsets,
but that does not work on platforms that encode the edge counters as indexes
into an object pool (i.e., x64, ARM, MIPS).

BUG=
R=fschneider@google.com, zra@google.com

Review URL: https://codereview.chromium.org//24744002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28085 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 10:22:47 +00:00
fschneider@google.com e9f0b93eb1 Revert r28050 due to crashes with --optimization-counter-threshold=5.
TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//25277002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28052 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-30 14:29:44 +00:00
fschneider@google.com acb389dbf9 Optimize conditional branches that have same true/false targets.
Branches that have the same true/false target, or where both
target blocks reach the same common join block via empty blocks
can be replaced by a goto to the common join block.

In code like this

var a = unknown();
var b = null;
if (a == null || b == null) {
  ...
}

it eliminates the test (a == null) if b is known to be null. Until now,
the compiler could only eliminate the test for b, if a was known.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//23549020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28050 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-30 12:41:28 +00:00
kmillikin@google.com 1255f3ce1c Fix an off-by-one error in deoptimization compression.
When compressing the deoptimization info, suffixes of length one are not
shared (the compression is the same length as the original, but more
indirect).  However, they were grafted onto the trie as if they were shared,
i.e., one level lower than they should be.

Add debug code to verify the compression/decompression round trip.

BUG=dartbug.com/13273
R=fschneider@google.com

Review URL: https://codereview.chromium.org//23788012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27602 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 10:16:11 +00:00
kmillikin@google.com 94ca56a774 Fix a bug in block reordering/block compaction.
The compiler assumes (a) the graph entry is followed in the block order by
its normal entry, and (b) the normal entry block is non-empty.  There is not
necessarily true, so stop assuming it.

BUG=https://code.google.com/p/dart/issues/detail?id=13101
R=fschneider@google.com

Review URL: https://codereview.chromium.org//23766021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27377 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 12:32:58 +00:00
hausner@google.com fd57843900 Update handling of ambiguous name references
Update VM to latest spec. Referencing a name that is imported
from more than one library is no longer a compile-time error.
If one of the sources of an ambiguous reference is a dart library,
the dart library declaration is automatically hidden.

Also fixes a bug where looking up a getter name in a library
found the getter even though the name is filtered out in the
'hide' combinator.

Long-term we should fix the need for repeatedly convert between
the mangled getter and setter names and the untangled name.

Fixes 12915, 12913, 12724.

R=regis@google.com

Review URL: https://codereview.chromium.org//23484020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27312 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 21:52:40 +00:00
zra@google.com df2054dae7 Sets a register aside on x64 for use as a pool-pointer. It is loaded and restored from the code object on Frame entry and exit. All LoadObject calls that can, and many calls and jumps through ExternalLabels now use the pool-pointer. The --compiler-stats flag when running dart2js indicates that code size is reduced ~13%, and more is probably possible.
R=fschneider@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//22825023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27295 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 15:39:26 +00:00
fschneider@google.com 40013fe1c0 Simplify compilation of relational operators.
Instead of having a separate IL instructions relational comparisons
are built as normal instance calls initially. When optimized, we replace
the instance call with a smi/double/mint comparison instruction.

This enables generic inlining of relational operator calls and simplifies
code generation, too.

Merging comparisons with branches is done in the optimizing compiler's
branch simplification phase.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//23757016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27058 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 14:02:53 +00:00
srdjan@google.com 97891ce193 If a rethrow is encountered in the catch block, then its handler must be marked that it needs stacktrace. Fix issue r12584.
R=iposva@google.com

Review URL: https://codereview.chromium.org//23691024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26963 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-31 00:26:47 +00:00
srdjan@google.com e06ea63b60 Mark exception handlers if they have a stacktrace specified. Do not build a stacktrace if the handler has no stacktrace.
R=asiva@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//23445012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26823 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 22:42:21 +00:00
kmillikin@google.com 00f20f3ffc Collect edge count profiling data and reorder basic blocks.
In unoptimized code, collect edge counts for all edges.  Use the counts
to reorder basic blocks in optimized code.  Basic blocks are reordered
by using Pettis and Hansen's "Profile Guided Code Positioning" bottom-up
algorithm.

R=fschneider@google.com, regis@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//18111006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26773 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 09:17:07 +00:00
fschneider@google.com d3b5da1335 Always generate full unoptimized code for intrinsified methods.
Until now, we skipped regular code generation for some intrinsics
because the body was unreachable (no slow case).

With inlining and optimizing those methods, we may need the 
unoptimized code for deoptimization support. Instead of deciding
case-by-case which of these methods may potentially deoptimize,
we always generate the full unoptimized code now, together
with the corresponding deoptimization info.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//22866025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26703 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-27 11:11:48 +00:00
regis@google.com 81bcb1f18a Distinguish between malformed and malbounded types (fix issues 12552 and 12554).
Add test.
Update status files.

Explanation of change: A malbounded type argument should not be mapped to
dynamic, as is a malformed type argument.
This change also adds a bunch of TODOs related to the encounter of malbounded
types in unexpected places.
A follow-up change will address these TODOs, add more tests, and may simplify
code that is still handling malformed types where they cannot occur anymore
after the spec simplified their handling.

R=hausner@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//23190035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26665 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 17:56:02 +00:00
fschneider@google.com ba0f59d1bc Polymorphic inlining for some recognized methods in the optimizing compiler.
The optimizing compiler currently recognizes a certain frequent native methods
like array length or string length and provides an inlined implementation.
Inlining does currently not work for polymorphic call sites of these methods.  
This CL enables also polymorphic inlining in the case of .length getters for
arrays and strings.

1. The method is recognized at flow graph build time. The builder creates
 the body of the method for both compilers (non-optimizing and optimizing).
 Native methods that are not recognized, are translated as before using a NativeCall
 IL instruction.

2. The flow graph inliner handles recognized methods in the same manner as normal methods.
Until now intrinsic and recognized method could not be inlined. This CL enables it.

3. There is no need for an intrinsic assembly implementation because recognized methods
have an IL implementation that does not call into the C++ runtime. I left the intrinsics
in for now, but they can be removed if there is not noticable performance benefit anymore.

4. The inlining heuristics are tweaked in a way that enables more aggressive inlining
of recognized methods: +1 level of inlining depths, call sites of recognized methods are
not counted in the inlining heuristic.

R=kmillikin@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//22839003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26429 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 12:58:08 +00:00
jacobr@google.com 605b33c1bc fix cpp11 compile errors
R=asiva@google.com

Review URL: https://codereview.chromium.org//23072026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
regis@google.com 9581071936 Refactor resolution code in the vm to properly handle ambiguity errors.
Add test.

R=asiva@google.com

Review URL: https://codereview.chromium.org//19662003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25324 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 00:19:39 +00:00
srdjan@google.com 5781d7cc84 Collect both arguments for math's min/max static functions. Later that information will be used to inline the operation if possible.
R=regis@google.com

Review URL: https://codereview.chromium.org//19774007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25225 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 16:49:29 +00:00
srdjan@google.com 46c46f5c62 List class was not initialized properly (it has type parameters). Do not preinitialize it incorrectly, instead let it be loaded and finalized the normal way.
R=asiva@google.com

Review URL: https://codereview.chromium.org//18737004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24922 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-11 17:32:16 +00:00
srdjan@google.com 7d945c593a Remove skip_static_calls_ as it uses an obsolete way to check for uncalled static calls. Will be replaced by ICData tracking.
Add two different PCDescriptors to differentiate between optimized and unoptimized static calls (the former loads args. descr, the later loads ICData before calling).
Populate static call's ic_data field when optimizing.

R=asiva@google.com

Review URL: https://codereview.chromium.org//17723002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24433 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 21:31:37 +00:00
srdjan@google.com fa7817bf79 Change static calls in unoptimized code to always call via a stub. Using ICData, the call count of static calls is collected as well.
TODO: Use call frequency to guide inlining.

R=asiva@google.com, hausner@google.com, zra@google.com

Review URL: https://codereview.chromium.org//17554003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24307 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 23:35:10 +00:00
asiva@google.com 16c945cb88 Minor cleanups to use null_array(), null_object() and null_string() handles.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//17501003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24247 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-20 19:49:30 +00:00
srdjan@google.com 47de186e76 Store arguments descriptor in ICData. Remove loading of arguments descriptor at unoptimized call site (the ones using ICData).
R=asiva@google.com, zra@google.com

Review URL: https://codereview.chromium.org//17421003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24239 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-20 16:29:39 +00:00
srdjan@google.com f53a57a64f Fix crash in OSR with --optimization-counter-threshold=-1: do not check for OSR if the optimizaiton is disabled.
R=asiva@google.com

Review URL: https://codereview.chromium.org//17311002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24112 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-17 22:36:32 +00:00
kmillikin@google.com 3e78b2ad4a Reapply "Initial implementation of on-stack replacement (OSR)."
This reapplies SVN r24024 with a bugfix.

After OSR compilation, restore the pre-OSR code (which might be already
optimized) rather than the unoptimized code (which might have its entry
patched).  When the optimized code entry is patched it is only safe to call
it as a static call, not as an instance call.

R=fschneider@google.com

Review URL: https://codereview.chromium.org//17233003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24088 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-17 11:05:15 +00:00
kmillikin@google.com d6f3eccdf2 Revert "Initial implementation of on-stack replacement (OSR)."
This reverts commit 24024.

TBR=fschneider@google.com

Review URL: https://codereview.chromium.org//16888013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24025 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 10:30:53 +00:00
kmillikin@google.com 0b39927d30 Initial implementation of on-stack replacement (OSR).
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
2013-06-14 10:10:55 +00:00
fschneider@google.com c698b7c348 Don't double-count stack slots when compiling optimized try-catch.
The fixed slots used by try-catch are already accounted for in the
register allocator. This change avoids wasting unnecessary stack space
for optimized functions containing try-catch.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//16520006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23899 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-12 09:31:31 +00:00
fschneider@google.com 9a6657cd4d Eliminate temporary locals for some expressions
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
2013-05-30 12:19:21 +00:00
kmillikin@google.com dae9ae2073 Remove an unnecessary setter.
A field of the CompilerDeoptInfo had a setter that was always and only
called immediately after construction.  Instead, set it in the constructor.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org//15563007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22981 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-22 06:21:03 +00:00
kmillikin@google.com 4ca50f4f39 A few simple cleanups.
* Remove BlockEntryInstr::PrepareEntry and use EmitNativeCode to emit the
  native code.
* Use Array::element_offset in a few places.
* Comment and identifier fixes.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org//15529003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22924 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-21 09:34:50 +00:00
regis@google.com 9e867eb4a1 Make deoptimization architecture dependent (it depends on the frame layout).
R=srdjan@google.com, zra@google.com

Review URL: https://codereview.chromium.org//15110003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22719 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-14 23:23:54 +00:00
fschneider@google.com 8ad125f607 Optimize functions containing try-catch.
This is a first step towards fully optimizing try-catch-finally.

At a catch entry, all local variables and parameters are
expected at a fixed stack location. There is a list of
initial definitions at the catch entry block, similar to
the initial definitions at graph entry.

Inside every try-block there is a special prologue code before each
call (instruction that may throw) inside the try-block. This prologue
is similar to a parallel move instruction: It moves all locals+parameters
to the locations expected by the catch-entry block. The stack frame
is extended with the corresponding number of fixed slots right below
the normal spill slots.

Every function containing try-catch has additional compiler-
generated local variables to pass the context, the exception and
the stack trace.

Variable liveness analysis is adapted to treat locals inside try{} blocks
specially: Every call has an implicit LoadLocal of every local variable.
This CL uses a safe approximiation of liveness which can be optimized further.

Current restrictions which are planned for future CLs:
 * No inlining inside try-blocks.
 * No inlining of functions containing try-catch.
 * No try-finally yet.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//14682020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22615 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-13 10:33:24 +00:00
vegorov@google.com 2565ca222f Implement a variation of scalar replacement for non-escaping allocations.
AllocationSinking pass discovers non-escaping allocations that have no input uses other than uses in the stores into its own fields.

Every environment use of such allocation is replaced by a state snapshot (MaterializeObject instruction) that describes the state of each initialized field in the object. State snapshots are computed through an additional round of load-forwarding.

Once snapshots are computed allocations are removed from the graph.

MaterializeObject instructions are not compiled into native code but produce deoptimization instructions instead that describe how object should be materialized at deoptimization.

Deoptimization instructions now follow the following format:

[mat obj #1]...[mat obj #N][ret addr][... mat arguments ...][... real frames ...]

- the prefix describes each object to materialize on deopt via kMaterializeObject instruction;
- actual values that are needed for materialization are emited as a part of bottom-most stack frame. This is done to simplify implementation: they need to be discoverable by a GC during materialization phase. At the end of deoptimization they will be removed from the stack;
- normal stack slots can refer to materialized objects via kMaterializedObjectRef instruction.

Additionally this change contains fixes in load-forwarding that are needed to guarantee that all artificial LoadField instructions inserted during AllocationSinking are correctly replaced with actual values.

Limitations of the current implementation:

- can't eliminate allocations that flow into phis but otherwise don't actually escape;
- can't sink allocations out of loops;
- allocation with type arguments are not handled.

R=regis@google.com, srdjan@google.com, zra@google.com

Review URL: https://codereview.chromium.org//14935005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22485 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-07 23:40:42 +00:00
kmillikin@google.com 7e31a88a0a Initial support for polymorphic inlining.
Consider each polymorphic variant separately for inlining in frequency
order.  Share inlined bodies for shared targets.

Insert an SSA redefinition of the receiver in each inlined variant to
prevent hoisting.  Hoisting code specialized to the receiver (e.g.,
direct access to internal fields of typed data arrays) out of the
inlined body is not safe.

R=fschneider@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//14740005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22434 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-06 17:22:18 +00:00
johnmccutchan@google.com 26c86b504e Inline Float32x4 comparison.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//14288006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22144 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-29 19:17:38 +00:00
srdjan@google.com 67cdbd0653 Detect leaf optimized methods and skip stack check overflow test in those, unless it is in a loop (to be able to stop it).
Review URL: https://codereview.chromium.org//14308009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21692 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-18 18:37:24 +00:00