Commit Graph

1657 Commits

Author SHA1 Message Date
regis@google.com 61297238fb Support redirecting factory constructors in the VM (issue 3969).
Add test (negative tests still missing).
Some more work is needed regarding when to throw a dynamic error and when to
report a compile-time error. Some questions are not answered by the spec.
Review URL: https://codereview.chromium.org//10964058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12791 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 17:28:37 +00:00
kmillikin@google.com c70bcfcfa3 Support constant folding of instructions with constant smi values.
In sparse conditional constant propagation, replace instructions with
constant smi values with their constant value.  Extend the analysis to
understant shift and bitwise binary operations.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12778 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 13:14:54 +00:00
zerny@google.com 89bf06ab7f Remove caller arguments from nested deoptimization environments.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12777 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 13:01:55 +00:00
kmillikin@google.com c6ef238b86 Check for a NULL value before passing it to a function that assumes non-NULL.
R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12776 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 12:56:25 +00:00
vegorov@google.com 6560f5c84b Fix convergence issues in range analysis.
Split it into three phases: initialization, widening and narrowing.

During widening and narrowing phi-ranges change according to classical widening and narrowing operators defined as:

Widening:
  [_|_, _|_] v [a, b] = [a, b]
  [a, b] v [c, d] = [c < a ? -inf : a, d > b ? +inf : b]

Narrowing:
  [a, b] ^ [c, d] = [(a == -inf) ? c : min(a, c), (b == +inf) ? d : max(b, d)]

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12772 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 12:00:19 +00:00
zerny@google.com b4ccb26cb6 Disable loop invariant code motion on deoptimized functions.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12771 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 11:28:51 +00:00
kmillikin@google.com 63fa392807 Reapply "A simpler scheme for garbage collection of ureachable phi inputs."
Fix two issues:

* Unreachable code elimination did not correctly identify all unreachable
  blocks.

* Loop detection in the register allocator relied on the block IDs.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12756 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 07:27:36 +00:00
vegorov@google.com e5d132e2f8 Disable range analysis. Causes timeouts on dart2js buildbots.
TBR=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12740 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 21:51:40 +00:00
vegorov@google.com 5cc5ab0e04 Do not collect smi values with no ssa index for range analysis.
TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12738 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 21:08:32 +00:00
vegorov@google.com 5355309db1 Fix Mac build broken by r12733.
TBR=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12734 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 20:17:15 +00:00
vegorov@google.com 17907d32de Implement range analysis for smi values.
And use it to eliminate overflow checks on + and - operations.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12733 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 20:06:31 +00:00
zerny@google.com eecf2ae922 Fix for off-by-one error in assertion for r12715.
TBR=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12718 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 15:25:21 +00:00
zerny@google.com 2f549da394 Use the inner deoptimization frame when setting incoming arguments.
This fixes issue 5318 where deoptimization of an inlined call resulted in an
incorrect value being set in the deoptimized frames.

R=vegorov@google.com
BUG=5318

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12715 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 14:58:30 +00:00
fschneider@google.com d2e7dba0b5 Fix bug in assigning the positions of safepoints.
Safepoints are associated with the end of instructions so that
splitting a live range at a safe point position makes the safepoint
at that position belong to the correct live range.
Review URL: https://codereview.chromium.org//10963029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12708 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 14:07:46 +00:00
vegorov@google.com 149c119a01 Improve ShouldSpecializeForDouble to handle ICs with multiple checks.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12703 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 13:30:23 +00:00
ager@google.com b065e9cb29 Fix implicit super constructor calls for sub-classes of native field wrappers.
The current code does not add implicit super calls for any sub-classes
of native field wrappers. It should only omit them from the actual
native field wrappers.

I encountered this issue when looking into dartbug.com/5301.

The test in the parser is not pretty. However, since the native field
wrappers can be generated through the API a better solution was not
immediate. I wanted to check if the class was from the
dart:nativewrappers library, but through the API you can create
native wrappers in any other library as well.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12679 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 05:40:33 +00:00
asiva@google.com 4140ed9d5b Fix for issue 5223 : Import 'dart:core' implicitly only if it has not been
already explicitly imported in the script.
Review URL: https://codereview.chromium.org//10949028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12673 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 00:43:08 +00:00
asiva@google.com 72f3a9c2ba Issue a more meaningful error message when we see duplicate definitions (ambiguous reference)
Review URL: https://codereview.chromium.org//10969002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12657 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 21:04:14 +00:00
iposva@google.com b9327e0236 - Make the VM understand the --checked flag to be aligned with dart2js.
- Adjust some of the checked mode tests to pass --checked and --enable-checked-mode.
Review URL: https://codereview.chromium.org//10962013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12651 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 18:19:06 +00:00
iposva@google.com e95e5160ce - Fix flag names.
Review URL: https://codereview.chromium.org//10958002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12649 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 17:38:01 +00:00
zerny@google.com 5d2c29fef7 Disable inlining by default.
Inlining deoptimizable code currently causes errors.

See Issue 5318.

R=fschneider@google.com
BUG=5318

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12645 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 15:36:26 +00:00
vegorov@google.com 5fdc89e84b Improve SminessPropagator to propagate sminess across cycles of phis.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12630 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 12:05:02 +00:00
kmillikin@google.com 52af2225e9 Revert "A simpler scheme for garbage collection of ureachable phi inputs."
This reverts svn revision 12621.  It causes unexpected test timouts.

TBR=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12624 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 09:11:44 +00:00
kmillikin@google.com 13ef2a994e A simpler scheme for garbage collection of ureachable phi inputs.
Simplify the garbage collection of unreachable phi inputs.  Assign immutable
block ids to basic blocks and ensure that both predecessor blocks and phi
inputs are kept sorted by block id.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12621 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 08:47:57 +00:00
kmillikin@google.com 67021511ca Make some static helpers into member functions.
Four helper functions that moved from lib/integers.cc to vm/object.cc so
they could be used during constant folding are more properly member
functions than static functions.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12620 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 08:38:33 +00:00
ager@google.com e676e88f81 Introduce a VM-only dart:scalarlist library for byte arrays.
Include it in the SDK so users can use it. Create a dummy
implementation and patch file for the library for dart2js so it can be
documented. Johnni, can you think of a nicer way of making
documentation generation work for a VM only library? Also, it seems that
patching kills the documentation comments and they do not show up in
the generated docs.

R=iposva@google.com,johnniwinther@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12616 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-20 07:08:10 +00:00
vegorov@google.com cd578d9de7 Ensure that parser throws an error when parsing x is! T with malformed type T.
Otherwise VM crashes in the flow graph builder

R=regis@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12608 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 21:48:50 +00:00
regis@google.com 99818005d8 Control static type propagation with a flag in optimizing compiler.
Minor cleanup.
Review URL: https://codereview.chromium.org//10952009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12601 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 20:59:01 +00:00
hausner@google.com 38f8f3cbfa Add virtual method to Object to ease dictionary code
Add a virtual method at the root of the object hierarchy
that returns the name of the object that is used in the
namespace dictionary. Only object types that are kept in
the dictionary need to overwrite the default implementation. 
Review URL: https://codereview.chromium.org//10945020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12577 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 17:09:42 +00:00
kmillikin@google.com 76495c3a8a Fix a typo in an input index computation.
Bug was found by varying the order of predecessors.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12570 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 16:05:58 +00:00
vegorov@google.com adf926862d Turn definitions that do not produce results (e.g. Checks) into instructions.
This allows more uniform iteration of IR for example when we are looking for all Smi values.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12563 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 14:38:31 +00:00
kmillikin@google.com be0492a8a8 Reapply "Initial implementation of sparse conditional constant propagation."
With a fix for compilation on Mac.  GrowableArray is DISALLOW_COPY_AND_ASSIGN,
so we can't create a temporary one to be ignored and have to pass one in to be
ignored.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12561 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 14:10:14 +00:00
zerny@google.com 58b3f8871c Remove check for stack overflow on entry to an inlined function.
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12556 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 12:43:48 +00:00
zerny@google.com 8ca2c4e6e9 Replace start_env with initial_definitions in GraphEntryInstr.
The initial definitions do not have any deoptimization information and can be
represented as just a list of definitions. For easy access, the constant_null
getter remains but assumes that index 0 contains the constant.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12555 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 12:37:57 +00:00
kmillikin@google.com 5e449aea52 Revert "Initial implementation of sparse conditional constant propagation."
Revert due to compilation failures on Mac.

TBR=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12552 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 11:04:36 +00:00
kmillikin@google.com ae9efbfab0 Initial implementation of sparse conditional constant propagation.
Use the results of SCC to eliminate unreachable code.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12549 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 10:34:14 +00:00
fschneider@google.com 542c853d64 Delete code for the now unused IL instruction NumberNegate.
It was replaced by an unboxed double operation in a previous change.
Review URL: https://codereview.chromium.org//10938011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12539 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 08:33:07 +00:00
cshapiro@google.com 69e1aefb72 Constraint List length values to the Smi type.
This change also makes the fast path and slow path cases in some integer
handling functions explicit.  Values are asserted not to be a Smi in the
slow path as they should have been picked off in the fast path.

BUG=https://code.google.com/p/dart/issues/detail?id=1750

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12527 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-19 01:11:37 +00:00
cshapiro@google.com 40604757dc Lazy peer API.
This change provides getters and setters for a lazily allocated field
associated with every heap allocated object.  It is a generalization
of the peer field of external string instances, external byte array
instances, and the smrck field of closure instances.

Review URL: https://chromiumcodereview.appspot.com//10905251

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12511 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-18 21:15:46 +00:00
regis@google.com 87c144334f Fix bad optimization of instance-of with uninstantiated types (issue 5216).
Fix bad assert when type check elimination is disabled (issue 5217).
Cleanup of type elimination code in optimizing compiler.
Add test.
Review URL: https://codereview.chromium.org//10942006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12502 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-18 15:12:43 +00:00
zerny@google.com aa5281c88a Reapply "Deoptimization support in inlined code."
This reapplies r12488 with a fix.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12499 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-18 13:41:20 +00:00
vegorov@google.com 7c0aae937d Prohibit inlining of functions containing throw. Inliner does not handle abnormal control flow.
In StrictCompareInstr::Canonicalize don't remove right_constant from the graph. It might leave the graph in the inconsistent state.

R=srdjan@google.com
BUG=dart:5136

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12497 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-18 13:27:21 +00:00
zerny@google.com e174be3f27 Revert "Deoptimization support in inlined code."
This reverts commit a78e33f178aae74a97f4231ca98183adf97fda71.

TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12492 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-18 12:18:04 +00:00
zerny@google.com 64a9ca2b81 Deoptimization support in inlined code.
Review URL: https://codereview.chromium.org//10928232

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12488 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-18 11:53:59 +00:00
fschneider@google.com aa3d3af639 Avoid using a temp register when unboxing a known smi.
Instead of saving into a temp, restore the input by re-tagging
it after the conversion.
Review URL: https://codereview.chromium.org//10909272

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12443 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 16:34:22 +00:00
fschneider@google.com b52bf2d298 Fix typo introduced by wrong conflict merge.
TBR=vegorov@google.com
Review URL: https://codereview.chromium.org//10907256

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12439 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 15:17:38 +00:00
fschneider@google.com 7b70f56dfd Simple redundant load elimination.
This analysis uses bit vectors to track side effects. Currently, there is
only one type of side effect which affects all mutable load-field instructions.
The elimination pass is a dominator tree preorder traversal like the existing
CSE pass. Instead of a hash-map it keeps an array with the current dominating
occurrence for each load expression.
Review URL: https://codereview.chromium.org//10914314

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12437 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 14:27:45 +00:00
fschneider@google.com c368f0891e Enable CSE for binary smi ops and constants.
Review URL: https://codereview.chromium.org//10917292

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12430 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 11:33:48 +00:00
vegorov@google.com 48220400b1 Mangle private names in the method recognizer otherwise they are not recognized.
R=fschneider@google.com
BUG=dart:5203

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12427 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 09:50:21 +00:00
hausner@google.com 19c8f19f5e Stop making classes implicitly abstract
Allocating an implicitly abstract class is no longer a runtime error.
Review URL: https://codereview.chromium.org//10910284

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12408 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-14 22:46:54 +00:00