Commit Graph

385 Commits

Author SHA1 Message Date
johnmccutchan@google.com 0180662328 Final cleanup of InsertConversion
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26522 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 14:11:58 +00:00
fschneider@google.com 0753e6fe59 Correctly clone comparisons in branch optimizations of Dart VM.
When cloning comparisons of branches, the type feedback
of some comparisons was lost, resulting in slower generic code
instead of type-specialized code.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26514 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 11:03:41 +00:00
srdjan@google.com 03111ecbeb Fix performance regression on Tracer: recognize _doublePow in Math.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26470 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 20:36:08 +00:00
fschneider@google.com ba0f59d1bc Polymorphic inlining for some recognized methods in the optimizing compiler.
The optimizing compiler currently recognizes a certain frequent native methods
like array length or string length and provides an inlined implementation.
Inlining does currently not work for polymorphic call sites of these methods.  
This CL enables also polymorphic inlining in the case of .length getters for
arrays and strings.

1. The method is recognized at flow graph build time. The builder creates
 the body of the method for both compilers (non-optimizing and optimizing).
 Native methods that are not recognized, are translated as before using a NativeCall
 IL instruction.

2. The flow graph inliner handles recognized methods in the same manner as normal methods.
Until now intrinsic and recognized method could not be inlined. This CL enables it.

3. There is no need for an intrinsic assembly implementation because recognized methods
have an IL implementation that does not call into the C++ runtime. I left the intrinsics
in for now, but they can be removed if there is not noticable performance benefit anymore.

4. The inlining heuristics are tweaked in a way that enables more aggressive inlining
of recognized methods: +1 level of inlining depths, call sites of recognized methods are
not counted in the inlining heuristic.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26429 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 12:58:08 +00:00
johnmccutchan@google.com 6d11a8fa15 Add signMask getter to Float32x4
R=srdjan@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26394 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 21:35:53 +00:00
jacobr@google.com 605b33c1bc fix cpp11 compile errors
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
johnmccutchan@google.com 7c1e9d8298 Add add and subtract operations to Uint32x4
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26358 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 14:34:06 +00:00
johnmccutchan@google.com 8e2b84bfa7 Cleanup conversion insertion in unboxed -> unboxed case.
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26281 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-16 16:53:32 +00:00
johnmccutchan@google.com f05ee4985a Replace shuffle getters with shuffle method and masks.
BUG=
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26278 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-16 16:19:18 +00:00
zra@google.com 83cbc7a525 Adds check for ARM neon support to optimizer.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26239 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-15 23:10:28 +00:00
srdjan@google.com 266b9cb305 Add double unary operation (negate). This is a replica of the destrpyed CL https://chromiumcodereview.appspot.com/23219002/
Review URL: https://codereview.chromium.org//22999011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26169 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 23:45:13 +00:00
johnmccutchan@google.com 069c0e14e1 Insert dummy conversion instruction for impossible conversion requests.
BUG=12417
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26143 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 20:11:02 +00:00
srdjan@google.com 1f31dcc424 Fix for running with --throw_on_javascript_int_overflow: recognize pattern (a << b) & mask and test for overflow only after the mask.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26122 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 15:12:39 +00:00
fschneider@google.com 2793f7ad63 Fix bug with optimized try-catch on ARM/MIPS.
The constant pool pointer must be restored before any parallel
moves at the catch-entry block.

In addition, this CL removes CatchEntryInstr and folds its
functionality into CatchBlockEntryInstr. Until now every catch-block
started with CatchBlockEntryInstr followed by a CatchEntryInstr.

This simplifies a lot of code in the compiler and avoids issues
with allocator-move code inserted between the two instructions.

BUG=https://code.google.com/p/dart/issues/detail?id=12291
TEST=tests/language/try_catch4_test.dart
R=regis@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25918 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-08 08:20:10 +00:00
srdjan@google.com c4a73f6379 When converting from equality to strict equality always note that number check is not needed since equality on numbers cannot be converted to strict equality (numbers override == operator).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25825 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 18:58:38 +00:00
srdjan@google.com bd74c66970 Inline fsin/fcos. Huge speedup on Box2D.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25816 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 15:46:28 +00:00
fschneider@google.com ee0aaf0453 Enable allocation sinking for non-implicit closures.
In optimized code we can eliminate the allocation of closures that are not
escaping and where all calls are inlined.

Closures are currently allocated with a special IL instruction (CreateClosure).
This CL changes this for non-implicit closures and allocates them
like normal objects. The fields for the function and the context are
initialized like instance fields. This way object allocation sinking can
handle closures like any other objects.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25706 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-01 12:03:21 +00:00
srdjan@google.com f9a7a26329 Fix performance degradation in DeltaBlue. When converting equality to strict-equality, note that no special number checks must be done.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25692 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 23:50:56 +00:00
srdjan@google.com 053d885d02 Optimize equuality operation for two Boolean arguments.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25636 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 20:44:25 +00:00
srdjan@google.com 9a3d733b37 Fix incorrectly factored-out code in https://codereview.chromium.org/20468002/
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25625 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 16:57:11 +00:00
johnmccutchan@google.com 10969ab342 Inline two argument shuffle operations on IA32 and X64.
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25580 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 18:57:35 +00:00
srdjan@google.com 14a3cb0cfd Make sure that ICData always contains valid data (non-null values).
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25535 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-26 20:17:04 +00:00
srdjan@google.com 3d6b2fc18e Allow equality operation on mixed double/smi arguments.
Fix a bug in relational operations in 64 bit mode: if ICData specifies double and Smi as possible arguments, we generate code for double and unbox or convert to double the inputs. These works only if smi can fit into the double. Current solution for 64-bit architecture is to disallow two smi-s as input to a polymorphic comparison instruction (equality, relational).

R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25522 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-26 16:48:46 +00:00
johnmccutchan@google.com 53ddd08b84 Allow SIMD types to be used on mips
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25481 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 17:31:19 +00:00
srdjan@google.com b38b19ddf5 Optimize division for two Smi-s as well. Gives ~ 15% speedup on NavierStokes.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25473 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 15:42:26 +00:00
srdjan@google.com eb926ff5df Fix a crash in Meteor, debug mode. BitAnd instruction cannot deoptimize, therefore does not allow accessing its deopt_id.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25445 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 21:56:18 +00:00
srdjan@google.com 5651a2cf78 Optimize double min/max by reducing the code size (reusing left register as result removes the need to copy left into result). Add code for two Smi arguments.
R=regis@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25367 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 20:40:31 +00:00
srdjan@google.com 7e313fa96a Recognize Math's min and max function for doubles and inline the operation.
R=regis@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25287 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 17:27:45 +00:00
srdjan@google.com b0598efc97 Minor cleanup: use deopt-id instead od static call instruction as argument for MathSqrtInstr.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25234 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 18:20:21 +00:00
johnmccutchan@google.com 522a7ef504 Add all 256 shuffle methods to Float32x4
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25227 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 17:03:09 +00:00
fschneider@google.com e317ca8fe0 Replace ChainContextInstr with existing IL instructions.
v0 <- AllocateContext(...)

      ChainContext(v0)

is changed into 

v1 <- CurrentContext
      StoreField(v0.parent = v1)
      StoreContext(v0)

Since v0 is used twice, I used a TempLocalScope in
the graph builder to store the allocated context.
As a result ChainContextInstr can be completely removed
from the compiler.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25200 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 09:15:28 +00:00
srdjan@google.com cce3fcffae Cleanups.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25103 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-17 16:03:07 +00:00
fschneider@google.com dfd21c06e0 Change resolving of instance methods to check early for name mismatch.
The names of actual arguments are checked at resolving time
for a mismatch instead of deferring this check to the function
prologue (emitted as part of the CopyParameters() prologue).

For example:

class A {
  foo({a:42}) => null;
}

main() {
  var a = new A();
  a.foo(b:123);  // noSuchMethod: no named parameter named "b".
}

This enables e.g. fast noSuchMethod invocation in the case
of a named argument mismatch.

It also makes the function prologue for instance functions that
use optional parameters shorter by omitting the check for a 
name mismatch there.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25041 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-16 09:38:13 +00:00
regis@google.com e8a722870b Support type parameters and classes as expression in the vm.
Turn many compile-time errors into runtime errors per latest spec.
Triage affected tests.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24861 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-09 19:35:56 +00:00
fschneider@google.com 965819aed9 Inline native setters for length and data in the optimizer.
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24801 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-08 16:27:46 +00:00
srdjan@google.com 74c379d01b Equality can be converted to a strict equality with checks. If the number of checks exceeds the threshold (--max_equality_polymorphic_checks=32) use megamorphic dispatch instead.
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24592 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 16:15:50 +00:00
iposva@google.com 50fc824be9 - Remove arguments definition test from the VM.
- Update tests still referring to it.

R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24539 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-27 18:37:53 +00:00
fschneider@google.com fd3f443181 Fix a bug in allocation sinking and load elimination.
1. Aliasing information was not computed for allocations that
are never used in a LoadField instruction.

2. CanBeAliased was not correct in the case of a StoreVMField.

BUG=https://code.google.com/p/dart/issues/detail?id=11538
TEST=runtime/vm/flow_graph_optimizer.cc
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24515 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-27 13:26:23 +00:00
fschneider@google.com 7e71783df6 Support type arguments for allocation sinking in certain conditions.
The type arguments are treated like a normal field that is initialized
with the type arguments passed to the allocation stub. This CL restricts
the optimization to the case where no instantiator is passed
(instantiator == kNoInstantiator). In this case the type arguments are
either a constant or loaded from a field.

Also: improve variable liveness analysis by pruning partially dead
variables from the environment. At the beginning of each block, all 
variables that are _not_ in live-in are replaced with null.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24459 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 09:20:46 +00:00
vegorov@google.com 370a99eda4 Refactor load forwarding pass to use a Place abstraction.
Place describes a location that code can load from or store to.

Start forwarding loads through phis.

Previously load forwarding operated directly on load instructions which complicated certain things e.g. implementation of a hash map had to allow looking up a load instruction by store instruction, forwarding through phis might have required introducing synthetic load instructions to be put into the map.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24426 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 18:50:26 +00:00
fschneider@google.com b8db2f0aba Inline object constructor already in the method recognizer.
The call is replaced with "return null". This allows us to always
inline calls to "Object." without extra overhead in the generic
flow graph inliner.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24391 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 10:56:44 +00:00
fschneider@google.com 0bf7251d1a Reland: Optimizing noSuchMethod invocation with no arguments.
This is the same CL as https://codereview.chromium.org/17315008/ with
one bug fixed:

If a method is invoked with a mismatching number of arguments, we don't
add a no-such-method-dispatcher function since the dispatcher currently
can only invoke noSuchMethod and would not work if the method
is invoked with correct arguments at a later point.

I extended the test to cover that case.

TEST=tests/language/no_such_method_dispatcher_test.dart
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24351 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 17:18:51 +00:00
vegorov@google.com 35ce4d245f Ensure that allocation sinking candidates are classified as not-aliased before final load forwarding.
R=fschneider@google.com
BUG=dart:11436

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24325 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 12:16:10 +00:00
fschneider@google.com 48555c83ac Back out r24266 to investigate dartium test failure.
TBR=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24284 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 11:56:32 +00:00
fschneider@google.com ab1981b421 Optimizing noSuchMethod invocation with no arguments.
On each call that triggers a noSuchMethod invocation we 
attach a custom dispatch function that allocates the 
invocation object and invokes noSuchMethod. This dispatcher
is compiled and optimized like a normal Dart function.

Similar to method-extractors, these implicit dispatchers
do not show up as normal functions.

As a first step this CL only handles invocations of getters
and methods with no like o.foo or o.foo().  This CL gives
a >25x speedup of such noSuchMethod invocations. Calls with
multiple arguments still go through the slow path.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24266 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-21 07:31:51 +00:00
asiva@google.com 16c945cb88 Minor cleanups to use null_array(), null_object() and null_string() handles.
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24247 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-20 19:49:30 +00:00
srdjan@google.com 47de186e76 Store arguments descriptor in ICData. Remove loading of arguments descriptor at unoptimized call site (the ones using ICData).
R=asiva@google.com, zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24239 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-20 16:29:39 +00:00
kmillikin@google.com 0104b48892 Fix a small bug in trace printing for discovered loops.
Loop blocks were printed with their preorder number, which is hard to
correlate to the graph.  Use the block id instead.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24184 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-19 13:56:48 +00:00
srdjan@google.com b9b689d20a Split LoadStatic into two instructions: load static field, load value from static field. This allows to canonicalize loads, thus reducing the number of inlined constants. Has large benefit on x64 (DeltaBlue). Note different register allocation spec for ia32, otherwise large regression in DeltaBlue is introduced.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24044 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 18:15:49 +00:00
fschneider@google.com 3208230580 Revert r23330 and r23136 because of a bug with loop invariant code motion.
This CL temporarily remove deoptimzation history which was put in to prevent
repeated deoptimization caused by loop invariant code motion. It caused
illegal code motion under certain conditions.

BUG=https://code.google.com/p/dart/issues/detail?id=11245
TEST=tests/language/licm3_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23989 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-13 15:52:33 +00:00