Commit Graph

355 Commits

Author SHA1 Message Date
srdjan@google.com 5694a140e3 Fix allocation of array tables (use store barrier if needed, store values directly instead of via stack).
Review URL: https://codereview.chromium.org//12212050

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18464 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-13 18:44:27 +00:00
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 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 7fc8f72c25 Inline getters of byte array view in the optimized flow graph.
This CL provides inline IL code for the getters _getInt8, _getInt16, etc.
to speed up [] and byte array views.

The code uses the existing LoadIndexed instructions by passing a index
scale factor explicitly: For normal arrays loads, the scale factor is equal
to the element size. For byte array access, the scale factor is always 1.

I'm adding inlined setters in a separate CL.
Review URL: https://codereview.chromium.org//12218008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18173 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-06 15:18:57 +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 a518a0a36f Add a use list iterator that allows mutation of current.
Add Value::Iterator that supports removing the current use from the
underlying use list, including deleting it or moving it to another use
list.  Use it in range analysis and representation selection.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18055 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-04 17:04:02 +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 6e26ea871d On Ia32 optimistically assume that results from int32 and uint32 array loads fit into Smi. Only if the instruction caused deoptimization will we assume mixed Smi/Mint operations. In absence of precise tracking of deoptimization history (location/reason) conservatively assume that a method that was deoptimized once may have been deoptimzied because of uint32/int32 loads.
Significant improvement for MeshDecompression on ia32.
Review URL: https://codereview.chromium.org//12086045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17810 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-29 21:16:44 +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 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
vegorov@google.com f6f7f1579e Optimize double.floor and double.ceil down to roundsd when SSE4.1 is available.
R=fschneider@google.com
BUG=dart:7971

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17278 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 14:28:25 +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
vegorov@google.com a77fc9701c When requested to extract a method M from class C inject a method extractor (consisting of a single AST node CreateClosure) as a getter get:M into C.
This allows to cache and optimize method extraction requests as normal method invocations and at hot method extraction sites that significantly decreases overhead of method extraction which previously required two trips into runtime system and was not cached at all.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17261 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-18 11:54:45 +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
podivilov@google.com d2d26a6656 Fix use of uninitialized memory in debug assert.
deopt_id() -> ASSERT(CanDeoptimize()) -> operands_class_id_ which is not initialized at this point.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17205 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-17 13:43:44 +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
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
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
kmillikin@google.com 0f65888e88 Change the inlining context from an enum to a class.
To support inlining in test contexts, the inlining context needs to have its
dispatched behavior and state.  This change introduces a context class
representing calls inlined for their value or solely for their effects.  The
intermediate array of exits is moved from the graph to the inlining context.
The implementation behavior is otherwise the same as before.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16965 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-11 11:43:48 +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
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
srdjan@google.com 29e06db609 In unoptimized code use call for instanceof instead of inlined checks. This allows us to collect type feedback and to reduce the code size of unoptimized code. Next will be work on type tests as well.
Review URL: https://codereview.chromium.org//11694003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16589 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-02 22:22:39 +00:00
hausner@google.com a2d682d1d8 Improve line info accuracy in debugging
Review URL: https://codereview.chromium.org//11696005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16550 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-28 18:51:58 +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
vegorov@google.com 04c4cf1860 Set kArrayCid as ResultCid for CreateArray instruction.
Propagate the length of the array returned by CreateArray in constant propagation.

Fold constant RelationalOp instructions.

Together this allows to kill considerable amount of unrechable code emitted from array literal allocation.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16331 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 17:47:01 +00:00
fschneider@google.com 3a1ab92a21 Make getter for capacity in _GrowableObjectArray private.
Review URL: https://codereview.chromium.org//11606023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16314 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 11:48:30 +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
asiva@google.com 6749a3be79 Add read only handles for the following predefined symbols
"=="
 "[]"
 "[]="
 "this"
and use them in the code.
Review URL: https://codereview.chromium.org//11519006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15942 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-11 01:20:02 +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
regis@google.com 91ad9a0180 Remove support for interfaces.
For now, disable tests using obsolete syntax.
Tests disabled in this cl and in previous ones removing default factory classes
will either be deleted or updated in a later cl.
Review URL: https://codereview.chromium.org//11411271

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15562 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-30 01:26:31 +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
fschneider@google.com 26e054bbc4 Support loads from Uint8Array and ExternalUint8Array in the optimizing compiler.
This is done by extending LoadIndexed to handle Uint8Array and ExternalUint8Array.

Small cleanups:
 - Share code for computing the element addresses for indexed loads.

 - Remove kGrowableArrayCid where it cannot occur. We only ever emit
   LoadIndexedInstr for fixed-size arrays. Loads from growable arrays
   are split into loading the backing store first and then an indexed
   load from the backing store.
Review URL: https://codereview.chromium.org//11411142

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15305 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-26 11:50:07 +00:00
vegorov@google.com 5402bf689d Heuristically predict interference on the back edge and use it to minimize number of register reshuffling which is especially expensive when cycles of XMM registers arise.
When allocating free register check if hint can potentially interfere on the back edge try ignoring hint and search for a better candidate.

Additionally fix handling of constants in the liveness analysis to accommodate constants used as immediates.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15291 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-23 16:04:34 +00:00
fschneider@google.com 2693c71850 Inline [] operator on one-byte strings.
str[i] is translated into

temp = str.charCodeAt(i)
result = StringFromCharCode(temp);

The existing code for charCodeAt is reused and contains
the necessary range class id and range check.
Review URL: https://codereview.chromium.org//11416129

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15246 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-22 12:06:52 +00:00