Commit Graph

134 Commits

Author SHA1 Message Date
fschneider@google.com 7bec3edaef Remove saving/restoring of the context at function entry.
This is not needed anymore after I changed the current context
to always reside in a local variable.

Further simplifications and cleanup in the debugger.

This also fixes a bad memory retention problem with
non-capturing closures.

BUG=dartbug.com/18886
TEST=tests/language/vm/closure_memory_retention_test.dart
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41433 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 07:35:51 +00:00
fschneider@google.com e6ef4b16bf Fix captured parameters and optimized try-catch.
The stack slots of captured parameters must be skipped when
generating sync code in optimized try-catch. Since those parameters
are initially copied into the context, their values are not recorded
in the environment.

Store-to-load forwarding may though use the original initial value
from the stack and therefore it must not be overwritten by try-sync
code that predeeds every call inside optimized try-blocks.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41099 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 14:48:32 +00:00
vegorov@google.com 1ea5f34f56 Fix incorrect handling of refined aliases during load forwarding.
If intrablock load forwarding refines some store instruction in a way that introduces previously unseen alias fallback to unrefined place with a more generic alias instead.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41009 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-09 11:47:13 +00:00
fschneider@google.com 217dab63db Fix assertion failure in range analysis.
The resulting range was correct, but not precise, as expected (too large by a constant)

BUG=dartbug.com/21245
TEST=tests/language/vm/regress_21245_test.dart
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40932 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-06 14:52:05 +00:00
vegorov@google.com 77c26187f2 Support allocation sinking for compound objects.
- Improve escape/alias analysis:
-- Storing an object into a field of another object does not mean that this object escapes (or has aliases) as long as that object does not have any loads from the same place;
-- Places like X.f and Y.f don't alias if X and Y are two different allocation instructions even if X and Y themselves potentially have aliases;
-- Improve precision of alias analysis for indexed properties;

- Support dematerialization and rematerialization of objects that are referenced by other dematerialized objects.
-- Use fix-point algorithm to collect candidates for allocation sinking;
-- Support aborting unsuccessful allocation sinking.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38404 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-18 18:35:08 +00:00
johnmccutchan@google.com 2ebd74a740 Add Uint32 representation.
- Add new representation: kUnboxedUint32.
- Add BinaryUint32Op, UnaryUint32Op, ShiftUint32Op instructions.
- Add new optimization pass which replaces Mint instructions with Uint32 instructions when possible.
- IA32 completed.
- ARM completed.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38198 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 17:01:02 +00:00
fschneider@google.com 844d6459ad Fix bug with range of shift operations.
A shift can only deoptimize if the rhs is negative: This is the
case if the range of the rhs is not contained within [0, +inf].

!range->IsPositive() is _not_ the same as range->IsNegative(). I find
these names confusing and we should find better alternatives.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37176 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-10 12:58:31 +00:00
fschneider@google.com 16e03db724 Implement simple dead store elimination.
This optimization is the dual to load elimination. It uses
the same infrastructure for handling aliasing. Since dead
store elimination is a backward data-flow analysis it inherits
from LivenessAnalysis.

Instead of eliminating upward exposed loads, it eliminates
downward exposed stores.

First local intra-block analysis is done in ComputeInitialSets.
Afte the fixed point iteration EliminateDeadStores performs the
global optimization on downward exposed stores in each block.

Only fully dead stores are eliminated. No partially dead
stores yet.

Example:

1: o.x = null;
2: if (cond) {
3:   o.x = 1;
4: } else {
5:   o.x = 2;
6: }

The store in line 1 is fully dead and will be removed. Note that
any deoptimization in "cond" will make the store only partially
dead and it won't be removed yet.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35909 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-08 14:26:16 +00:00
fschneider@google.com ac7e9e5c69 Add alias identity information to array allocations.
Loads/stores with non-escaping arrays can be disambiguated from loads/store
with unknown identity.

This enables better load elimination for non-escaping arrays.

For example in the following code:

test() {
  var a = new List(1);
  var b = new List(1);
  a[0] = 42;
  b[0] = 43;
  return a[0] + b[0];
}

we can now eliminate both loads a[0] and b[0] where before all stores to [0] were
considered to interfere with each other..

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33523 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-11 09:39:23 +00:00
fschneider@google.com cb735217ad VM: Fix bug in aliasing computation.
Values flowing into arrays were not correctly computed as aliased.

TEST=tests/language/vm/load_to_load_forwarding_vm_test.dart
R=srdjan@google.com, vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33334 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-05 17:58:46 +00:00
fschneider@google.com 5bd036b0ad Fix bug in load elimination with multiple phis.
The in-set has to be computed on the out-sets of the predecessors with
the phi-moves of the predecessor applied. This is now done on a temporary
copy of out, instead of the out-set itself - otherwise the phi-moves may
 be applied more than once to the same set.

BUG=http://dartbug.com/17159
TEST=tests/language/vm/load_to_load_forwarding_vm_test.dart
R=vegorov@chromium.org

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33118 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-27 16:31:58 +00:00
johnmccutchan@google.com 95dc06ae34 Enable polymorphic inlining of StringBase [] and StringBase codeUnitAt.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32749 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-18 17:41:11 +00:00
fschneider@google.com 5f58066c65 MIPS: Fix bug in allocation stub's slow path.
The CL r32697 that changed the argument count of the AllocateObject
runtime function from 3 to 2 did not correctly adjust SP before
the runtime call.

BUG=dartbug.com/16873
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32735 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-18 10:10:06 +00:00
johnmccutchan@google.com 45cee25fc3 Inline polymorphic typed array view stores
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32656 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-13 15:54:33 +00:00
johnmccutchan@google.com e1ba48aea0 Extend StoreInstanceFieldInstr and LoadFieldInstr to support reusable Float32x4 boxes on IA32, X64, and ARM.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32429 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 15:30:25 +00:00
fschneider@google.com 21214c0f16 Improve aliasing info for load elimination of array loads.
The optimizer can now track side effects to array locations
at a constant index when eliminating array loads. Stores to
arrays with a constant index affect loads from arrays
at the same constant index _and_ loads from an unknown (non-constant)
index. Stores to an array with an unknown index affect all array loads.

For instance code like

var a = new List(2);
a[0] = 123;
a[1] = 456;
print(a[0] + a[1]);

we can now eliminate both loads from a[0] and a[1], where before
only the loads from a[1] was eliminated.

I changed the internal encoding of Alias to use BitField instead of
plain integers. This makes it a little easire to extend.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32014 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-27 11:06:48 +00:00
johnmccutchan@google.com 057e483d51 Support unboxed SIMD types in AllocationSinking
BUG=
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31752 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-13 18:41:08 +00:00
fschneider@google.com 5aa02dce31 Small cleanup and more test coverage for guarded fields.
Some cases of field guards for guarded length  were not covered by our tests.

Otherwise I removed redundant conditions that are either impossible
or always true from the code generator for GuardFieldInstr.

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30887 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-05 11:17:06 +00:00
fschneider@google.com 8b0b3fde4d Generalize if-conversion to arbitrary smi comparisons.
Until now only == and != comparisons were supported.

Further changes are:
 Remove flag FLAG_new_identity_spec: It is not needed anymore.
 Invoke Canonicalize another time before branch optimizations.
 Fixes support for TestSmiInstr with the branch-simplifier pass.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30622 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-25 12:57:21 +00:00
fschneider@google.com b324e06153 VM: Fix identical comparisons with bigints.
The optimizing compiler did not properly preserve registers across
the runtime call that occurs when using identical with bigints.

BUG=http://dartbug.com/14903
TEST=tests/language/vm/regress_14903_test.dart
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30058 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-07 17:27:16 +00:00
fschneider@google.com 1671427c00 Fix static warning in a test.
Need to import dart:async to use Future class.

TBR=kasperl@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29743 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-01 11:07:50 +00:00
fschneider@google.com a037e4874b Fix bug with guarded fields and deserialization.
Since deserialization does not involve the normal object construction
procedure, any values written there won't be reflected in the guarded field
type. This results in incorrect optimized code because deoptimization of
dependent code objects in not triggered.

This CL adds tracking of field types and guarded list length when creating
objects via deserialization.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29741 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-01 10:39:09 +00:00
fschneider@google.com be9875fb2b VM: Fix bug in polymorphic inlining of recognized methods.
The inliner has to insert a redefinition of the receiver to
prevent illegal hoisting of instructions that depend on the
receiver class id.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29389 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-28 20:20:11 +00:00
fschneider@google.com 369a58132e Fix bugs in load elimination and type propagation.
Load elimination should consider the representation of loads/stores
when numbering places. Different representations result now in different
places so that there can't be mixed representations at phis after
load elimination.

Removed the flag --propagate-types because type propagation is required
for correctness of smi-check hoisting. Therefore, switching it off does not
 make sense anymore.

BUG=https://code.google.com/p/dart/issues/detail?id=6663, https://code.google.com/p/dart/issues/detail?id=14271
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28931 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-21 13:59:56 +00:00
fschneider@google.com b5465cf7ef VM: Fix bug in canonicalization of identical in the optimizing compiler.
Make sure that BranchInstr::Canonicalize does not mutate it's input before
all conditions for the optimzations to take place are met. Otherwise, bailing out
leaves the affected comparison instruction in an invalid state.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28646 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 15:15:47 +00:00
fschneider@google.com a329b0e6bc Dart VM: Simplify code generation for equality operators.
By inserting the necessary checks for null inside the callee
at the AST level, the code generation of == operations can be
greatly simplified.

This is a performance-neutral change and a step for allowing
generic inlining of arbitrary == methods. So far we could only
inline them for a common set of types in the flow graph
optimizer.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28084 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 10:10:50 +00:00
fschneider@google.com 1072bc1c60 Reland: Fix bug in field type tracking and polymorphic inlining.
Original CL: https://codereview.chromium.org/24096018/

This fixes the bug by changing FlowGraphBuilder to a zone object
because it is needed by the inliner later in the pipeline.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27695 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 10:35:01 +00:00
asiva@google.com 53a1ec9456 Revert
https://code.google.com/p/dart/source/detail?r=27655
as it is causing dartium build breakage.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27675 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 20:32:16 +00:00
fschneider@google.com 7dea1d8a2c Fix bug in field type tracking and polymorphic inlining.
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
2013-09-19 11:21:11 +00:00
sgjesse@google.com a2865875f2 Update language.status
Add some more issue numbers. Rewrite some tests

R=kustermann@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27193 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 12:37:31 +00:00
fschneider@google.com e174a4c18e Fix a compiler bug caused by Utils::IsPowerOfTwo treating zero as a power of two.
The IsPowerOfTwo function is used together with ShiftForPowerOfTwo.  Both function
do not work with zero. This caused the optimizing compiler to generate invalid code
for the expression

x ? 0 : 0

where it assumed that if one of the constants is a power-of-two, it can
be computed by (1 << n). We check for 0 in a number of places, but instead
I decided to fix Utils::IsPowerOfTwo itself and remove unnecessary checks
for the zero case.

TEST=tests/language/vm/if_conversion_vm_test.dart, runtime/vm/utils_test.cc
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27033 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 09:28:34 +00:00
fschneider@google.com 92e97e5d1a Fix bug with reflection on VM-internal native methods.
My previous approach was not enough, since methods can
be invoked via reflection before they are parsed/compiled.

This CL fixes the problem at hand, but I'd like a more general
approach to mark those methods. Maybe an annotation at the declaration
would be better.

I also refactored the test case as suggested in the previous code review.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27009 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-02 10:43:59 +00:00
fschneider@google.com eba0f840f9 Move VM specific test to the correct location.
TBR=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26627 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 09:29:58 +00:00
sgjesse@google.com 550f3ab7f4 Add issue numbers to language tests status files
Moved VM specific tests to a separate directory

R=kustermann@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26596 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-23 11:31:25 +00:00