Commit Graph

292 Commits

Author SHA1 Message Date
vegorov@google.com baa0347253 Reapply r18377 it was reverted due to the unrelated bug it surfaced.
Remove SminessPropagator and FlowGraphTypePropagator and all associated infrastructure and fields.

Replace multiple fields (result_cid_, propagated_cid_, propagated_type_, reaching_cid_) with a single field of type CompileType which represents an element of type analysis lattice and incorporates information about: value's nullability, concrete class id and abstract super type. This ensures that propagated cid and type are always in sync and complement each other

Implement a new FlowGraphPropagator that propagates types over the CompileType-lattice.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18456 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-13 17:16:35 +00:00
vegorov@google.com b1a343033e When canonicalizing branch on StrictCompare don't fuse comparisons that can deoptimize or serve as pending deoptimization target for representation changes.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18443 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-13 14:14:05 +00:00
vegorov@google.com 487c73e01f Revert "Remove SminessPropagator and FlowGraphTypePropagator and all associated infrastructure and fields."
This reverts commit r12365.

Reason: failure on vm-mac-debug (debug_ia32 standalone/io/file_fuzz_test).

TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18378 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-12 12:36:21 +00:00
vegorov@google.com f8d9a90b2c Remove SminessPropagator and FlowGraphTypePropagator and all associated infrastructure and fields.
Replace multiple fields (result_cid_, propagated_cid_, propagated_type_, reaching_cid_) with a single field of type CompileType which represents an element of type analysis lattice and incorporates information about: value's nullability, concrete class id and abstract super type. This ensures that propagated cid and type are always in sync and complement each other

Implement a new FlowGraphPropagator that propagates types over the CompileType-lattice.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18377 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-12 12:06:47 +00:00
kmillikin@google.com ab3cbf5796 Change CSE, LICM, and range analysis to preserve use lists.
Change the common subexpression elimination, loop-invariant code
motion, and range analysis passes to maintain use lists.

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18209 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-07 09:42:36 +00:00
fschneider@google.com f0caa40576 Add optimized loads from ExternalUint8ClampedArrays.
The generated code is exactly the same as for ExternalUint8Array.

TEST=tests/standalone/byte_array_test.dart
Review URL: https://codereview.chromium.org//12225049

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18183 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-06 19:00:50 +00:00
srdjan@google.com eaa1c974a3 Use SAR for divident by a power-of two constant divisor.
Review URL: https://codereview.chromium.org//12091100

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18075 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-04 20:29:58 +00:00
kmillikin@google.com 361300cb71 Move recording of definition uses from the value to the definition.
It was weird that this method mutated an object that wasn't even
mentioned in the call.  Also, change Definition::ReplaceUsesWith so that
it appends all at once instead of consing each individual use.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18048 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-04 14:01:35 +00:00
fschneider@google.com 2718b54625 Separate the array/string .length load from the bounds check.
This is done in preparation to inline more array and array view
operations.

Since the length is immutable for fixed length arrays, it allows
hoisting the load out of loops.
Review URL: https://codereview.chromium.org//12088108

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17984 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-01 15:10:24 +00:00
kmillikin@google.com a2436038da Make use lists into doubly-linked lists.
At the cost of a word per use, we gain constant time removal from use
lists.

BUG=
Review URL: https://codereview.chromium.org//12079096

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17924 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 16:10:15 +00:00
srdjan@google.com 35ef4ddbd5 Enable correct optimized double modulo operation. (TODO: enable remainder optimization).
Review URL: https://codereview.chromium.org//12082063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17859 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-30 17:40:28 +00:00
vegorov@google.com 44a2659a8a When comparing symbols during the range analysis check that both of them are not affected by side-effect.
R=fschneider@google.com
BUG=dart:8197

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17840 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-30 13:11:43 +00:00
fschneider@google.com dfda7854a8 Fix source position for stack traces with optimized top function.
Fix decoding of the deoptimization info when constructing a stack trace.

Fix stack trace for checked mode exceptions from optimized code.

BUG=dart:8058
TEST=runtime/tests/vm/dart/optimized_stacktrace_test.dart,
     tests/language/stack_overflow_stacktrace_test.dart
Review URL: https://codereview.chromium.org//12049039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17755 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-29 12:38:27 +00:00
kmillikin@google.com 27af144369 Move code around in preparation for better inlining.
To inlining calls in a test context, the code to plug the inlined
function graph into the caller graph should be dispatched on the type
of the inlining context.

This change moves code around without otherwise changing it.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17569 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-24 14:13:02 +00:00
srdjan@google.com d3e5631456 Use builtin fmod for double modulo operation.
Review URL: https://codereview.chromium.org//12049056

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17514 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-24 00:06:16 +00:00
srdjan@google.com 76dffe600c Removed loop depth info tracking at graph build time.
60% compilation speed improvement on pathological case. Improvements for dart2js

The loop depth signal was made unnecessary by the call frequency signal.
Review URL: https://codereview.chromium.org//11975061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17408 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-22 16:15:54 +00:00
vegorov@google.com 932a05420a Reland r17365.
Introduce InvokeMathCFunction that can be used to directly invoke mathematical
function provided by runtime.

Use it to unconditionally inline _Double.pow.

Use it to inline floor, ceil, round, truncate, round when SSE4.1 is not
available.

Perform representation selection phase after constant propagation to minimize
boxing.

Add support for enter instruction in the x64 disassembler.

Add test for optimized pow and fix compilation on windows.

R=fschneider@google.com
BUG=dart:8002

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17393 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-22 12:18:31 +00:00
vegorov@google.com ab91977173 Revert "Introduce InvokeMathCFunction that can be used to directly invoke mathematical function provided by runtime."
This reverts commit r17365.

TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17367 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-21 17:16:16 +00:00
vegorov@google.com a20c8d28b8 Introduce InvokeMathCFunction that can be used to directly invoke mathematical function provided by runtime.
Use it to unconditionally inline _Double.pow.

Use it to inline floor, ceil, round, truncate, round when SSE4.1 is not available.

Perform representation selection phase after constant propagation to minimize boxing.

Add support for enter instruction in the x64 disassembler.

R=fschneider@google.com
BUG=dart:8002

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17365 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-21 16:59:37 +00:00
fschneider@google.com 64039d8ec3 Optimize loads and stores to Int32Array and Uint32Array.
Review URL: https://codereview.chromium.org//12041005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17362 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-21 16:19:42 +00:00
fschneider@google.com 3e94e4a2fa Fix bug in optimization in the presence of externalized strings.
The class-id of string objects can be changed via the Dart API. The optimizer
has to disable hoisting class-id checks across calls. For now, loop-invariant
code motion is disabled for checks of string class-ids.
Review URL: https://codereview.chromium.org//11867020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17288 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 16:29:02 +00:00
fschneider@google.com 657c4944c3 Remove StringCharCodeAtInstr and handle it as part of LoadIndexed.
Review URL: https://codereview.chromium.org//11970038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17274 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 14:03:40 +00:00
regis@google.com 912194a756 Fix vm code base so that it can be built for --arch=simarm (no snapshot yet).
Review URL: https://codereview.chromium.org//11956004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17246 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 00:34:20 +00:00
fschneider@google.com 8c5b198d95 Optimized loads/stores for scalar list: Uint8Clamped, Int8, Int16, Uint16.
This CL adds optimized stores for Uint8ClampedList, and
loads+stores for Int8List, Int16List and Uint16List.


TEST=tests/standalone/byte_array_test.dart, tests/standalone/int_array_test.dart
Review URL: https://codereview.chromium.org//11967012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17190 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-17 10:43:46 +00:00
hausner@google.com 245c0e2c3e Collect debugging info for catch clauses
Collect info about try-statement nesting, and a list of
handled types in each catch clause. This will be used by
the debugger to determine whether an exception is handled
by any handler on the stack.
Review URL: https://codereview.chromium.org//11883023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17100 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-15 22:43:00 +00:00
fschneider@google.com 2904e5bf35 Fix crash bug when deoptimizing from an optimized sqrt operation.
Review URL: https://codereview.chromium.org//11880048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17084 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-15 17:11:11 +00:00
vegorov@google.com d11d988998 Set statically known ResultCid for AllocateObject.
Specialize PolymorphicInstanceCall in ApplyClassIds if receiver cid
was infered: filter out all but one target for attached ICData and drop
checks.

Canonicalize away CheckClass if reciever cid matches at least one in the list of checked.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17079 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-15 15:51:24 +00:00
fschneider@google.com e0395cf4bb Optimize stores to Uint8List.
Review URL: https://codereview.chromium.org//11855007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17014 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-14 10:27:28 +00:00
srdjan@google.com 40a7130741 Inline Doubles truncate and round.
Review URL: https://codereview.chromium.org//11573044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16983 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-11 20:42:47 +00:00
fschneider@google.com 15432b2fee Add canonicalize optimization for branches.
Comparisons where the result is only used in a branch on true
can be folded into the branch instruction.

Patterns like this can occur after inlining and constant propagation.
In normal code, we merge branches and comparisons already at graph
building time.

v3 <- (v1 == v2)
Branch if (v3 === true)

is optimized to

Branch if (v1 == v2)

Also: Remove outdated TODOs and rename the canonicalization pass to a 
better name.
Review URL: https://codereview.chromium.org//11819031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16919 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-10 13:18:31 +00:00
fschneider@google.com 87a3a4b479 Support immediate and memory operands for PushArgumentInstr in optimized code.
If a value is a constant or stored on the stack this change avoids loading it into a
new register before pushing it.
Review URL: https://codereview.chromium.org//11791051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16806 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-08 16:51:57 +00:00
vegorov@google.com 34f1a0795a Delay canonicalization of 1.0 * N until after representation selection.
This allows to avoid Unbox(Box(N)) pair if N is an unboxed double phi:

var N = 0.0;
while (X) N += 1.0 * N;

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16799 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-08 14:27:09 +00:00
vegorov@google.com 05078902d1 Canonicalize away simple arithmetic equivalences.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16795 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-08 13:32:23 +00:00
fschneider@google.com d5f2305515 Support scalar lists in array bounds check elimination.
This allows to eliminate bounds checks for scalar lists in loops like:

for (var i=0; i < a.length; i++) {
  a[i]
}
Review URL: https://codereview.chromium.org//11665005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16716 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-07 15:43:35 +00:00
vegorov@google.com 774187fb8c Ensure that LowerBound and UpperBound return overflow marker when overflow occurs.
R=fschneider@google.com
BUG=dart:7617

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16711 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-07 15:33:36 +00:00
vegorov@google.com 75190542c3 Fix Intrinsifier and MethodRecognizer to correctly match private getters and setters.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16701 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-07 14:51:24 +00:00
srdjan@google.com 0af16251b5 Intrinsify Uint8ClampedArray's store and load indexed, inline load indexed.
Review URL: https://codereview.chromium.org//11783006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16666 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-05 01:07:32 +00:00
asiva@google.com 4c069867e4 - Make Boolean 'true' and 'false' singleton VM isolate objects.
- Change all uses of it
Review URL: https://codereview.chromium.org//11745022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16623 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-04 01:52:05 +00:00
asiva@google.com 7022b39e35 Convert all symbol accessors to return read only handles so that it is not necessary to create a new handle in the code that uses it.
Added a few more strings to the symbols list.
Review URL: https://codereview.chromium.org//11667012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16584 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-02 19:31:59 +00:00
kmillikin@google.com 6ff1d9cfc5 Simplify basic block discovery -- handle all blcoks uniformly.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16420 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-21 08:58:32 +00:00
asiva@google.com 7ea520f10f Create read only handles for empty_array and sentinel objects
(trying out a basic framework and will extend it to others once this
works).
Review URL: https://codereview.chromium.org//11648006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16416 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-21 02:33:05 +00:00
fschneider@google.com 3a38233a6f Inline ByteArrayBase.length in the flow graph optimizer.
Review URL: https://codereview.chromium.org//11628011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16311 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 10:43:13 +00:00
srdjan@google.com 18b376a8ad Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the result.
Review URL: https://codereview.chromium.org//11568044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16272 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-18 18:43:29 +00:00
vegorov@google.com 1ee5f51793 Improve redundant load elimination.
Previously it incorrectly computed OUT sets during the fix point iteration: did not propagate changed from IN to OUT.

However just computing bitset representation of IN set was actually not enough because different values might be coming in from different predecessors.

This algorithm inserts phis at merge points.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16109 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-13 14:10:38 +00:00
fschneider@google.com a63d4f59d4 Narrow result cid and type of BinarySmiOp to be always smi.
After smi-SHL was changed to deoptimize in case of overflow,
the result type can be narrowed to smi only.
Review URL: https://codereview.chromium.org//11557012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16044 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 15:13:21 +00:00
kmillikin@google.com 275c8d928f Introduce a class encapsulating arguments descriptor arrays.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15727 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-05 12:05:57 +00:00
fschneider@google.com 3c81141f1c Instantiate uninstantiated types with known constant type-arguments.
The enables eliminating more type-checks.

For type-checks that have a uninstantiated target type and a constant
instantiator type arguments as input, we can instantiate the type
at compile-time.
Review URL: https://codereview.chromium.org//11280230

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15689 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-04 14:51:43 +00:00
srdjan@google.com aa3ee93c84 Add result cid to StringFromCharCode.
Review URL: https://codereview.chromium.org//11412284

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15614 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-01 00:03:04 +00:00
srdjan@google.com 0ddc6d93b1 Add more spcific ranges for String length and charCode methods.
Review URL: https://codereview.chromium.org//11280248

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15589 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-30 17:19:42 +00:00
srdjan@google.com 85cf9af6ab Fix for issue 6678: Result of identical(a, b) with a and b doubles not consistent.
Implement proposed new identity spec (flag --new_identity_spec). It will be enabled/committed once the new spec been confirmed.

The new spec says that identity of numbers is computed on their values instead of on the object reference. This provides deterministic behavior without having to disable optimizations in the VM. In some cases 'identical' is now slower than 'equality' as more checks need to be done. The VM compiler can optimize 'identical' in the future.

My benchmarks do not show any slow down.
Review URL: https://codereview.chromium.org//11414136

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15332 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-26 18:35:45 +00:00