Commit Graph

302 Commits

Author SHA1 Message Date
johnmccutchan@google.com 08c99e80e6 Inline Float32x4 Getters
Review URL: https://codereview.chromium.org//13872020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21897 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 17:52:10 +00:00
vegorov@google.com 207d8eb43a Optimize static field and context load/stores as part of CSE pass.
This change also introduces basic abstractions for aliasing.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21866 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 11:09:14 +00:00
vegorov@google.com 1162595313 Convert EqualityCompare to StrictCompare if reciever is either null or guaranteed to have default equality operator.
R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21696 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-18 19:52:26 +00:00
johnmccutchan@google.com 252d27c293 Binary Float32x4 ops.
Review URL: https://codereview.chromium.org//13867006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21541 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-16 10:04:34 +00:00
vegorov@google.com 81ecaba321 Re-apply r20377.
Compute local variable liveness before translation to SSA.

Use it to remove dead values from deoptimization environments.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21439 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 11:53:50 +00:00
vegorov@google.com 9f3783186f Ensure that all goto instructions have deoptimization target.
R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21351 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 11:19:34 +00:00
johnmccutchan@google.com 968e805cfc Unboxed load/store indexed of Float32x4
Review URL: https://codereview.chromium.org//13818006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21274 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 12:50:46 +00:00
vegorov@google.com 11edd87390 Convert diamond shaped control flow into a single conditional instruction.
Adds a IfConverter pass that right now recognizes two simple patterns cond ? 0 : 2^n and cond ? x : x+-1 that can be generated without branches on ia32 and x64 using setcc instruction.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21207 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-10 15:09:46 +00:00
srdjan@google.com cbe8bd9a3a Restore r20998 with a bug fix: add field to guarded_fields_ when it contains relevant cid. Was missing most cases and did not check for unique adds.
Review URL: https://codereview.chromium.org//13726023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21008 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 23:26:53 +00:00
srdjan@google.com e7f1ae5383 Revert r20998.
Review URL: https://codereview.chromium.org//13739002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21001 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 21:44:17 +00:00
srdjan@google.com 44938de19c Fix guarded_cid handling: add field to list of guarded_field at LoadField creation time.
Review URL: https://codereview.chromium.org//13529021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20998 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 21:01:30 +00:00
srdjan@google.com 29d8c954ac There are still issues with using guarded-cid (tests/compiler/dart2js/cpa_inference_test.dart fails). Disabled via flag until I have figured it out.
Review URL: https://codereview.chromium.org//13455008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20935 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-04 18:13:00 +00:00
srdjan@google.com d01002343e Fix checked mode crash when clearing reaching type of a value.
When replacing uses we clear type information that is set by a previous type propagation (e.g. by CheckSmi). This led to unexpected behavior: value guarded by a CheckSmi but not Smi. Adding another type propagation pass before code generation.
Review URL: https://codereview.chromium.org//13125002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20921 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-04 16:13:50 +00:00
fschneider@google.com 5e0ac1419e Use range analysis to improve constant propagation.
This CL runs a second round of constant propagation after range
analysis to eliminate additional unreachable code. Range analysis
is changed to mark branches as constant if the constraints they
generate are unsatisfiable.

The second pass of constant propagation only visits branches and
removes unreachable code, but does not do full constant propagation.

This proves useful when inlining array view operations where the
following pattern occurs:

for (i = 0; i < length; i++) {
  if (i < 0 || i >= length) {
    throw 123;
  }
  foo();
}

In this example the if-statement will be eliminated completely.

Also, fix a bug in range analyis where constraints of already
constrained values were missing.
Review URL: https://codereview.chromium.org//13469013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20914 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-04 12:42:17 +00:00
srdjan@google.com ae25ca904c Fix issue 9608: When replacing call with assert assignable, transfer call's deopt_id to the new node.
Review URL: https://codereview.chromium.org//13464021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20871 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-03 16:22:24 +00:00
srdjan@google.com 60e57ecfe1 Optimizes 'as' operation in similar way as 'instanceof': collect type feedback in unoptimized mode and try to convert it to a simple classcheck in optimized code.
Review URL: https://codereview.chromium.org//13190014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20783 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-02 15:30:14 +00:00
srdjan@google.com 3f4c3f0d8a When optimizing instanceof allow also for raw types (List, ..).
Review URL: https://codereview.chromium.org//13215006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20744 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-01 19:45:47 +00:00
asiva@google.com ec0ec36e62 More preparation for removal of dart:scalarlist
- remove the intrinsification of scalarlist functions
- changed class Ids to TypedData class Ids
Review URL: https://codereview.chromium.org//13004017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20595 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-27 23:15:27 +00:00
srdjan@google.com c5e562d18d Improve code for !identical(a, b):
"x = (a === b); y = (x !== true)" => "y = (a !== b)".
Review URL: https://codereview.chromium.org//12852007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20550 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-26 23:41:27 +00:00
srdjan@google.com 895aae5c3b When attempting to to inline a field getter we use the incoming cid. That type may differ between value()->Type() and value->definition()->Type() if the definition is a load field with a guarded cid. Therefore, if value's type is dynamic we check definition's type as well.
Review URL: https://codereview.chromium.org//12843043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20548 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-26 22:02:09 +00:00
vegorov@google.com 535ed8eb25 Revert "Compute local variable liveness before translation to SSA."
Attaching environments to branches on strict comparisons breaks pattern matching in the optimizer and regresses performance.

This reverts commit r20377.

TBR=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20400 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 18:32:17 +00:00
vegorov@google.com 66ecd504f9 Compute local variable liveness before translation to SSA.
Use it to remove dead values from deoptimization environments.

R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20377 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 12:33:42 +00:00
vegorov@google.com 1c9d22d75c Collect type feedback for fields.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20235 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 20:15:10 +00:00
fschneider@google.com 86da5111ad Replace scalarlist optimizations and split external array loads into two IL instructions.
This CL removes optimized access for scalarlist, and only the new TypedData classes
are optimized. I changed the runtime libraries core and math to use typedData
instead of scalarlist (Uint16List is used in StringBuffer, Uint32List by Math.random).

Instead of using LoadIndexed for internal and external arrays,
split external loads into a load of the backing store and a load
of the element.

v3 <- LoadIndexed(v1, index)

becomes

v2 <- LoadUntagged(v1, ExternalTypedData::data_offset)
v3 <- LoadIndexed(v2, index);

For this I introduce two new representations in the IL:

 kUntagged (for values that hold a untagged pointer) and
 
 kNoRepresentation (for instructions accept any input
 representation)

Deoptimization does not need to know about kUntagged
since these values can never occur in the environment.

Also with this change:
* fix COMPILE_ASSERT and use it in one place.
* Cleanup IL printer output of deopt ids.
Review URL: https://codereview.chromium.org//12871010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20198 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 12:06:23 +00:00
fschneider@google.com f1fa8c68c2 Fix bug in optimized byte array views on tranferable backing stores.
This affects views when using scalarlist: The code generated
did not take the receiver class into account correctly,
so it only works for internal byte arrays.

For now, I just disable optimization for external backing stores.

The optimization will be added again for TypedDataViews in a future CL.

TEST=tests/standalone/byte_array_view_optimized_test.dart
Review URL: https://codereview.chromium.org//12779007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20036 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 17:13:44 +00:00
fschneider@google.com a792eec392 Revert: Support TypedData getters/setters in the optimizer.
Revert https://code.google.com/p/dart/source/detail?r=20018 because this CL was not complete and broken.

TBR=
Review URL: https://codereview.chromium.org//12742006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20024 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 14:09:38 +00:00
fschneider@google.com a25625e109 Support TypedData getters/setters in the optimizer.
The optimizer now  handles _TypedList which replaces _ByteArrayBase
and functions on TypedList getX/setX where X = Int8, Uint8, Int16, etc. are
optimized.
Review URL: https://codereview.chromium.org//12801003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20018 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 13:07:54 +00:00
fschneider@google.com 924e321c35 Optimize TypedData in the same way as ScalarList.
Review URL: https://codereview.chromium.org//12775009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20002 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 10:39:20 +00:00
fschneider@google.com ef6251908c Add a new, separate block entry instruction for catch-blocks.
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
2013-03-12 13:51:32 +00:00
fschneider@google.com d0959080ab Inline ByteArray setters like setUint8 in the optimizer.
Review URL: https://codereview.chromium.org//12378039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19781 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-11 12:16:54 +00:00
kmillikin@google.com ef0580c26a Implement a branch optimization pass.
Branch optimization pushes some branches that test the value of a phi
to the predecessor blocks.  This can avoid materializing a boolean
object solely for the purposes of branching on its boolean value.

The optimization is performed after inlinining which creates
opportunities, and before constant propagation, because it exposes
opportunities for unreachable code elimination.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19682 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 11:14:08 +00:00
vegorov@google.com e1e7051b22 In LoadOptimizer::EmitPhis check for environment uses of phis.
Previously we checked for input uses only. This caused some phis
to be not emitted if they had only environment uses. The bug was masked
by an elimination pass done before the register allocation.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19390 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-04 14:55:33 +00:00
fschneider@google.com 86d5e856a5 Use enum instead of bool parameter in IL instructions to indicate if a store barrier is needed.
R=vegorov@google.com
Review URL: https://codereview.chromium.org//12377017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19232 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-28 14:30:37 +00:00
kmillikin@google.com 9ee9cfb78d Remove dead phis as soon as they are discovered.
Previously we removed dead phis late, in the register allocator.  This
change removes them as soon as they are discovered to be dead and packs the
phi array to squeeze out NULLs.  This speeds iteration but doesn't save
space because the phi array is zone-allocated.

The PhiIterator is used everywhere to iterate phis except a few places that
need to know the phi index (e.g., SSA construction, phi elimination).

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19206 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-28 08:25:58 +00:00
kmillikin@google.com 45a6441346 Add functions for setting an environment and rebinding a use.
Add functions for setting or clearing an instruction's environment, which
initialize the environment uses.  Add a function for changing a use's
definition.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19036 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-26 11:50:28 +00:00
srdjan@google.com 1bc8991142 For Doubl erounding call C-function instead of attempting to inline it. Fixes issue 8760.
Review URL: https://codereview.chromium.org//12334080

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19013 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-25 23:05:43 +00:00
kmillikin@google.com bfdad288d9 Set instruction/use_index when adding an input to an IL instruction.
When setting an input (including in the constructor) of an IL instruction,
automatically set the input use's instruction and use_index fields.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18961 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-25 11:24:08 +00:00
lrn@google.com 3c0ac360e7 Remove deprecated string features.
Make String.codeUnits return a List.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18960 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-25 10:48:09 +00:00
vegorov@google.com 339c914f2c Ensure that compile time types for comparisons are recomputed once comparison are specialized.
Turn CompileType into a value object instead of zone object. Provide a transparent zone allocated wrapper for CompileType. This simplifies code paths that recompute and update type and reduces number of allocated zone objects.

Split ComputeInitialType into ComputeInitialType and ComputeType.

ComputeType returns values type as a value object. ComputeInitialType returns a pointer and by default it delegates to ComputeType.

This split reflects differences between instructions: majority of them have their own type, but some can return the type of an input which should not be unwrapped and rewrapped again because this will destroy the connection between types.

R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18895 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-22 16:33:37 +00:00
fschneider@google.com d4fc4b291d Insert missing test for unboxed mint support when inlining _setIndexed, getInt32, getUint32.
Int32Array and Uint32Array can only be optimized on ia32 when SSE 4.1
is supported.
Review URL: https://codereview.chromium.org//12328055

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18890 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-22 13:41:24 +00:00
srdjan@google.com 19995faa3a Recognize pattern (a << b) & c with c being a positive Smi and allow left shift to truncate the result.
Review URL: https://codereview.chromium.org//12218181

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18859 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 22:24:42 +00:00
kmillikin@google.com 509261dd45 Reapply "Change the SSA construction pass to also construct def-use chains."
This reapplies svn commit 18813 with a bug fix.  In the case of an
inlined call whose value is not used, the inliner hase inserted a use
of the return value's definition, which must be removed.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18827 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 12:57:43 +00:00
fschneider@google.com 8fa3140676 Inline ByteArray._setIndexed in the flow graph optimizer.
Review URL: https://codereview.chromium.org//12317011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18818 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:35:19 +00:00
kmillikin@google.com 733a05c801 Revert "Change the SSA construction pass to also construct def-use chains."
This reverts svn revision 18813 due to dart2js test failures.

TBR=kasperl@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18817 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:06:31 +00:00
kmillikin@google.com 85c27b7733 Change the SSA construction pass to also construct def-use chains.
Also modify constant propagation to preserve def-use chains.  Fix a small
bug in the def-use chain for definitions of inlined function return values.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18813 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 10:09:10 +00:00
fschneider@google.com d9667c75c4 Copy propagated type info when inserting conversion.
Use propagated type info to improve smi-checking before
double operations (CheckEitherNonSmi)
Review URL: https://codereview.chromium.org//12298034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18692 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-19 15:25:47 +00:00
kmillikin@google.com 622efda5fb Convert some compiler passes to preserve valid def-use chains.
Change the ApplyICData, ApplyClassIds, Canonicalize, and
SelectRepresentations passes to preserve valid use lists.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18676 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-19 12:09:01 +00:00
fschneider@google.com 266a36eb5d Optimize _getIndexed on byte arrays.
Until now we only optimize the [] operator, but don't have a
fast path for polymorphic invocations of [] on byte arrays.

I also added additional test coverage for Uint8Clamped list.
Review URL: https://codereview.chromium.org//12282029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18624 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-18 13:18:28 +00:00
fschneider@google.com 0a1d6d15f9 Fix bug in optimizing string .length loads.
We're not allowed to hoist a .length load if the corresponding
class-check is not also hoisted out of a loop.

TEST=tests/language/optimized_string_charcodeat_test.dart
Review URL: https://codereview.chromium.org//12256037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18519 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-14 15:59:18 +00:00
fschneider@google.com e2a0c8f7ca Optimize stores to ExternalUint8Array and ExternalUint8ClampedArray in the optimizer.
This CL adds support for these two array types to the StoreIndexed instruction.
Review URL: https://codereview.chromium.org//12263010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18517 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-14 12:59:51 +00:00