Commit Graph

492 Commits

Author SHA1 Message Date
srdjan@google.com aa8b03e7d7 For trigonometric functions call to C-libraries: they are faster than x87 operations (3% on Box2D). This also enables quicker trigonometrics on ARM and MIPS. TODO: Make InvokeMathCFunction more flexible so that it can handle both static and instance calls
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27256 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-06 18:14:53 +00:00
fschneider@google.com 40013fe1c0 Simplify compilation of relational operators.
Instead of having a separate IL instructions relational comparisons
are built as normal instance calls initially. When optimized, we replace
the instance call with a smi/double/mint comparison instruction.

This enables generic inlining of relational operator calls and simplifies
code generation, too.

Merging comparisons with branches is done in the optimizing compiler's
branch simplification phase.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27058 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 14:02:53 +00:00
srdjan@google.com 97891ce193 If a rethrow is encountered in the catch block, then its handler must be marked that it needs stacktrace. Fix issue r12584.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26963 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-31 00:26:47 +00:00
srdjan@google.com e06ea63b60 Mark exception handlers if they have a stacktrace specified. Do not build a stacktrace if the handler has no stacktrace.
R=asiva@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26823 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 22:42:21 +00:00
kmillikin@google.com 00f20f3ffc Collect edge count profiling data and reorder basic blocks.
In unoptimized code, collect edge counts for all edges.  Use the counts
to reorder basic blocks in optimized code.  Basic blocks are reordered
by using Pettis and Hansen's "Profile Guided Code Positioning" bottom-up
algorithm.

R=fschneider@google.com, regis@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26773 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 09:17:07 +00:00
mlippautz@google.com b708a455d1 Fix Function.end_token_pos() and implement MethodMirror.source getter.
Move .source getter from ClosureMirror to MethodMirror (as the TODO already suggested) and provide an implementation.

BUG=
R=asiva@google.com, hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26659 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 17:14:07 +00:00
kmillikin@google.com 7f81e17d6f Cleanup of deoptimization environment copying functions.
Change the deoptimization environment copying functions so that they
crash rather than safely copying NULL environments.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26634 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 10:56:24 +00:00
johnmccutchan@google.com 6d59f5d25a Fold Box(Unbox(v)) and Unbox(Box(v)) for Float32x4 and Uint32x4
R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26480 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 22:22:53 +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
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
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
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
mlippautz@google.com 2187a8f63f Move the begin token (token_pos) of explicit functions to the start of the function declaration.
This fixes setting the breakpoints when the signature of function declarations is spread across multiple lines.

Example:
int
get
foo
=>
42;

BUG=
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26080 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 20:11:23 +00:00
regis@google.com 9eb12ad303 Implement updated method overriding rules in the vm (issue 11495).
Introduce --error-on-bad-override flag and use it when generating snapshots.
Fix signature checking when patching methods.
Fix errors in patch files.
Fix receiver type of constructors.
Fix finalization of mixin application typedefs.
Update tests and status files.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26027 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-12 20:28:52 +00:00
srdjan@google.com 72ba657d4f Fix issue 12369: compare kind of unary math instruction and not only the inputs to determine if attributes are equal.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26014 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-12 17:54:36 +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 1b12859a7e Implement IsNullCheck for CheckClassInstr. If input is nullable expected type, then check for null only.
R=johnmccutchan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25907 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-07 23:01:43 +00:00
asiva@google.com b4d9e0d620 Auto create ApiLocalScope before calling native functions, this ensures that
native functions do not have to call Dart_EnterScope/Dart_ExitScope
when they callback into the VM.

Remove Dart_EnterScope/Dart_ExitScope calls around native functions in 'bin'
directory.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25827 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 19:27:48 +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
zra@google.com 40394904bb Enables unboxed mints in ia32 javascript int compatability mode.
Also checks range information before emitting checks on x64.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25740 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-02 18:37:20 +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
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
fschneider@google.com 6a8aa6f073 Reland r25551: Allow inlining of closures with a context change.
Review URL: https://codereview.chromium.org//21087002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25567 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 15:23:41 +00:00
fschneider@google.com 5da27dd763 Revert r25551 to help figure out mysterious build bot timeouts.
TBR=ricow@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25558 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 12:33:40 +00:00
fschneider@google.com 678dff7ea7 Allow inlining of closures with a context change.
This CL removes the remaining missing cases when inlining closure
calls.

In order to benefit for code using forEach, I added GrowableObjectArray.forEach
to the functions that should always be inlined.

I also renamed BuildLoadContext/BuildStoreContext helpers in the flow
graph builder to better match what they do.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25551 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 09:44:02 +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
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
srdjan@google.com 5781d7cc84 Collect both arguments for math's min/max static functions. Later that information will be used to inline the operation if possible.
R=regis@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25225 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 16:49:29 +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 aba90e3763 Always try to inline certain core library functions.
Inlining moveNext and get:iterator enables the iterator
object for allocation sinking.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25057 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-16 16:45:27 +00:00
hausner@google.com 4c629b9b50 Implement forwarding constructors for mixins
By popular demand, fixes issue dartbug.com/9339

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24977 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-12 22:09:18 +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 4456ba26ff Fixed crash in EqualityCompareInstr::IsCheckedStrictEqual : update unary_ic_data_ if ic_data_ is set at a later stage.
Review URL: https://codereview.chromium.org//18089019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24598 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 17:41:51 +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
srdjan@google.com 7defd2255c Use call counts to determine which static calls to inline.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24436 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-25 22:12:49 +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
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 1a9f9f691c Scale the OSR optimization threshold by loop nesting depth.
For on-stack replacement (OSR), code quality is better if we optimize at
the outermost hot loop.  Track loop nesting depth and scale the
threshold based on the loop depth to prefer outer loops over inner ones.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24175 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-19 09:21:25 +00:00
kmillikin@google.com 3e78b2ad4a Reapply "Initial implementation of on-stack replacement (OSR)."
This reapplies SVN r24024 with a bugfix.

After OSR compilation, restore the pre-OSR code (which might be already
optimized) rather than the unoptimized code (which might have its entry
patched).  When the optimized code entry is patched it is only safe to call
it as a static call, not as an instance call.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24088 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-17 11:05:15 +00:00
hausner@google.com 457bb1bdcb Remove support for + prefix in number literals
Also fix some tests that expected + prefix in hex numbers to be illegal. According to our documentation, int.parse() accepts + for numbers in all formats/radixes.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24051 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 21:16:46 +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
kmillikin@google.com d6f3eccdf2 Revert "Initial implementation of on-stack replacement (OSR)."
This reverts commit 24024.

TBR=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24025 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 10:30:53 +00:00