Commit Graph

95 Commits

Author SHA1 Message Date
Florian Schneider 1b3a53883c Add missing abstract modifier.
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2714783003 .
2017-02-23 13:44:23 -08:00
Florian Schneider 521526d259 Fixup redefinitions before doing code motion
Also use redefined receiver consistently when inlining recognized methods.

This CL re-enables type propagation from CheckClassId instructions which
was disabled as a temporary stop-gap to prevent illegal code motion.
(reverts https://codereview.chromium.org/1928633002)

Now uses of redefined values that are dominated by the redefinition are renamed before doing LICM.

Related to #26347.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2709093003 .
2017-02-23 12:34:55 -08:00
John McCutchan d264156cfb Add tests of line numbers to causal async stack tests
BUG=
R=devoncarew@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2694013003 .
2017-02-15 00:38:46 -08:00
John McCutchan 19abef97f1 Reland improvements to causal async stack traces
Original CL: https://codereview.chromium.org/2690683002

Improvements to causal async stack traces

UX improvements:

- [x] Stop printing the suffix <%s_async_body> and <%s_async_gen_body> for the generated closures.

Fixes #28743

- [x] Don't include the duplicate frame below the asynchronous suspension marker.

Fixes #28742

Bug fixes:

- [x] Fix service protocol enum naming so that it is consistent with other enums.

Fixes #28726

Misc:

- [x] Stop using package:stack_trace now that the VM does it for us.

BUG=
R=asiva@google.com, devoncarew@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2691213003 .
2017-02-14 05:00:04 -08:00
John McCutchan e84d8a1f11 Revert "Improvements to causal async stack traces"
This reverts commit 8538d81473.

BUG=

Review-Url: https://codereview.chromium.org/2694213002 .
2017-02-14 02:29:40 -08:00
John McCutchan 8538d81473 Improvements to causal async stack traces
UX improvements:

- [x] Stop printing the suffix <%s_async_body> and <%s_async_gen_body> for the generated closures.

Fixes #28743

- [x] Don't include the duplicate frame below the asynchronous suspension marker.

Fixes #28742

Bug fixes:

- [x] Fix service protocol enum naming so that it is consistent with other enums.

Fixes #28726

Misc:

- [x] Stop using package:stack_trace now that the VM does it for us.

BUG=
R=asiva@google.com, devoncarew@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2690683002 .
2017-02-14 00:56:55 -08:00
John McCutchan a0ee5b24db Track async causal stack traces
This CL improves the stack traces that accompany exceptions. Whenever an
async function is entered, we remember how we got there. This is similar
in spirit to package:stack_trace but the implementation is more efficient
and memory usage can be more easily reasoned about.

Tracking causal stack traces:

- [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Before returning from an async function, clear the Thread's asynchronous stack trace.
- [x] After resuming an async function, load the sychronous stack trace prefix into the Thread.
- [x] Filter stack traces to remove async machinery.

Service protocol changes:

- [x] Send causal async stack trace.

Observatory changes:

- [x] Display causal async stack trace below async functions.

Fixes https://github.com/dart-lang/sdk/issues/27661

R=asiva@google.com, rmacnak@google.com

Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing
Review-Url: https://codereview.chromium.org/2646443005 .
2017-02-09 15:39:44 -08:00
Jens Johansen 919b5ac8d0 Test for kernel async stacktrace bug
BUG= https://github.com/dart-lang/sdk/issues/28446
R=kustermann@google.com

Review-Url: https://codereview.chromium.org/2638403004 .
2017-01-19 12:37:58 +01:00
Florian Schneider d54341927e Change test to work with app-snapshots.
App snapshot don't contain column information. Change the expectation to
only expect line numbers.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2624023002 .
2017-01-10 14:29:07 -08:00
Florian Schneider 204bd5a932 VM: Add missing token position in async rethrow
Fixes #28325.

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2626753002 .
2017-01-10 13:49:13 -08:00
Vyacheslav Egorov ff5292e5fb VM: Fix lazy_deopt_vm_test timeouts by limiting (re)optimizations to a single function.
BUG=
TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2594013003 .
2016-12-21 17:03:50 +01:00
Vyacheslav Egorov e763fac3b7 VM: [DBC] Fix more problems with lazy deopt.
Catch entries must record a lazy deoptimization descriptor because we patch catch entries if exception reaches a frame that has a pending lazy deoptimization.

StringInterpolate instruction was recording an incorrect lazy deoptimization environment - on DBC we drop arguments from it because it is a part of the return sequence and not a part of the calling sequence like on other architectures. This means one needs to pass correct argument count down to RecordAfterCall(Helper). StringInterpolate however has argument count of 0 but internally emits a call with a single argument leading to a mismatch if RecordAfterCall is used. Use
RecordAfterCallHelper instead.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2595553002 .
2016-12-20 17:30:06 +01:00
Vyacheslav Egorov 1fcc7384aa VM: [DBC] Fix lazy deoptimization after calls that return no values.
On DBC calls return value on the stack instead of a dedicate register but not all calls have a return value (e.g. CheckStack does not) and such calls don't push anything. Implementation of a lazy deopt however assumed that value is always present and tried to manually preserve it by popping and pushing it back after the frame was rewritten. This of course damaged the frame if we performed a lazy deoptimization after the call that did not push anything.

Instead of manually preserving result value value use frame translation to handle it. This allows to handle calls that return value and those that do not uniformly in the Deopt bytecode. Compiler takes care of creating the right deoptimization environment instead.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2587133002 .
2016-12-19 23:08:26 +01:00
Ben Konyi 7e918f5b48 Fixed the conditions of an assert causing the debug VM to crash when trying to load a library from an invalid path. Created copy of a previous deferred_import_t02.dart test from co19 as a regression test until deferred_import_t02.dart is reverted to the previous test.
Fixes #27201

R=zra@google.com

Review URL: https://codereview.chromium.org/2537253002 .
2016-11-29 14:07:19 -08:00
Florian Schneider 890bfa8015 AOT: Fix bug in receiver type propagation after unique selector calls.
Insert Redefinition instructions to prohibit unsafe code motion. If we propagate
the receiver type downwards from a call to a unique selector, we must not hoist
instructions that were optimized using this type information across the call.

R=vegorov@google.com

Review URL: https://codereview.chromium.org/2498073004 .
2016-11-16 10:14:40 -08:00
Florian Schneider 368409d3e4 DBC: Fix bugs with array allocation
Guard against negative length in the fast path.

Add missing PC descriptors for correct exceptions.

BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/2490803002 .
2016-11-08 15:45:31 -08:00
Ryan Macnak d5580f3b00 Fix unaligned access to TypedData from native code.
Split unaligned access test and mark the float half as failing on Android.

R=zra@google.com

Review URL: https://codereview.chromium.org/2473553002 .
2016-11-02 15:53:26 -07:00
Ryan Macnak 26245de7a5 Support unaligned integer loads on ARM and MIPS.
Fixes SDK build with SIMARM/SIMARM64/SIMMIPS.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2452453002 .
2016-10-31 17:41:53 -07:00
John McCutchan 8007a98b5b Produce the correct assertion failure expression in the face of inlining
Fixes #27671

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2453263002 .
2016-10-27 07:29:22 -07:00
John McCutchan 7fd9df4d91 Improvements to NoSuchMethodError.toString
This makes the following improvements:

* Always show the call that was made, with arguments.
* ...and show the actual arguments in more cases.
* Be less confusing in the case of a call on the null receiver.
* Be less redundant in the output.
* Report when a constructor is called with the wrong number of arguments.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2405353002 .
2016-10-12 09:52:51 -07:00
Florian Schneider e25461c151 VM Propagate receiver type from calls to unique selectors in AOT compilation.
If there is no override of noSuchMethod in any class, we can
propagate the receiver type downwards from calls that call a unique
selector.

This speeds up dart2js by around 3%, a particle simulation benchmark by around 10%.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2412653002 .
2016-10-11 13:17:47 -07:00
Ryan Macnak e1a252a017 Fix a throw returning to a frame marked for lazy deopt that captures the stacktrace.
A lazy deopt via a return needs to preserve one value (the result), but via a throw needs to preserve two values (the exception and stacktrace).

Fixes #27446.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2374273002 .
2016-09-28 16:51:45 -07:00
Ryan Macnak e3420eab29 Revert "Pass new pool pointer to the JumpToException stub instead of reloading in through the frame's Code object."
This reverts commit 3413e052b3.

Review URL: https://codereview.chromium.org/2374173002 .
2016-09-28 13:00:00 -07:00
Ryan Macnak 3413e052b3 Pass new pool pointer to the JumpToException stub instead of reloading in through the frame's Code object.
This is prep work for lazy deopt without code patching.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2376843002 .
2016-09-28 10:15:09 -07:00
Florian Schneider 7ca3da1a3a Fix lazy deoptimization in the presence of exceptions
Catch block entries need to be considered when doing lazy deoptimization.

In addition to the return, also patch all catch entry blocks in a function scheduled for lazy deoptimization.

Also, move restoring the pool pointer to the jump-to-handler stub to simplify patching the catch entry.

BUG=#27419
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2357343003 .
2016-09-26 16:24:23 -07:00
Florian Schneider 021ebb2033 Correct and GC unrecognized flags from our tests.
Fix some misspelled flags.

Remove some non-existent flags.

Fix --short_socket_read and --short_socket_write flags used in IO tests.

Running with --ignore-unrecognized-flags is still on because some flags are only visible
in DEBUG mode.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2247733005 .
2016-08-15 18:28:11 -07:00
Regis Crelier 962353674b Delete stray comment in tests.
R=hausner@google.com

Review URL: https://codereview.chromium.org/2067453003 .
2016-06-13 11:30:57 -07:00
Zachary Anderson 6e90ca4e0a DBC: Eager deoptimization and CheckSmi instruction.
R=vegorov@google.com

Review URL: https://codereview.chromium.org/2039913006 .
2016-06-09 09:47:56 -07:00
Florian Schneider 2783afd607 VM: Fix receiver type propagation in presence of try-catch.
With catch blocks appearing as additional function entry blocks,
there can be phis for the receiver (parameter 0).

This CL fixes the problem that the receiver type information
was lost in the presence of try-catch.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1841073003 .
2016-03-30 15:55:11 -07:00
Srdjan Mitrovic b3405d5ebc Add --no-background-compilation to tests that expect to run code in optimized form
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1759973002 .
2016-03-02 16:30:58 -08:00
Florian Schneider 2b7ff6dfab Fix test by removing the --noopt flag from the test file.
Not all platforms (ia32) support --noopt, and test.py --noopt will run the test
with this option anyway.

TBR=rmacnak@google.com

BUG=

Review URL: https://codereview.chromium.org/1497213002 .
2015-12-04 13:08:14 +01:00
Florian Schneider eee0e6d8c3 Fix optimizations on static fields in precompiled code.
Don't perform LICM / or load elimination of static fields in precompiled
code since they may not be initialized and we don't record an explicit
dependency between the initialization and the load of a static field.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1497783002 .
2015-12-04 12:42:39 +01:00
Florian Schneider 94fcce2b0c Fix analyzer warning in a unit test.
Add initializer for a final field.

TBR=rmacnak@google.com

BUG=

Review URL: https://codereview.chromium.org/1494233003 .
2015-12-03 21:45:00 +01:00
Florian Schneider dff13bef8d VM: Fix bug in type propagation at conditionals.
Propagating type/cid at conditional branches is not possible because
it may cause invalid code motion.

For this to be safe we need to explicitly represent the dependency
between checks eliminated in a branch and the condition that constrains the type/cid.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org/1491373005 .
2015-12-03 21:14:35 +01:00
Alan Knight 50b1ea35e9 Fix a couple more tests related to Isolate.spawn semantics change
BUG=

Review URL: https://codereview.chromium.org/1481693002 .
2015-11-25 16:28:59 -08:00
Srdjan Mitrovic 4600d37dc1 Background compilation work:
- Defer deoptimization from optimizing compiler to code installation in mutator thread.
- Defer registration of field and leaf class dependency until code is installed in mutator thread.
- Cleanup.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1433243003 .
2015-11-12 11:25:58 -08:00
Florian Schneider 9f54259d57 VM: Fix FP math discrepancies by adding -mfpmath=sse to 32-bit simulator and cross host builds.
BUG=dartbug.com/24517
R=zra@google.com

Review URL: https://codereview.chromium.org/1395543003 .
2015-10-08 17:16:46 +02:00
regis@google.com 240c208462 Add a separate test verifying that the optimizer does not trip over debug break.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45300 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-20 23:19:58 +00:00
vegorov@google.com 7db7425826 Reland r45243.
Type and constant propagator should guard against mutable class ids.

Constant strings can be externalized so we can't fold away class checks against
them.

Prevent CP from removing redefinitions of constants with mutable cids.

BUG=
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45275 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-20 10:42:54 +00:00
regis@google.com c983ebf506 Fix bigint division (issue 23238).
Add regression test.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45253 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-17 20:30:29 +00:00
regis@google.com 9a2468736a Add support for debug break in Dart source.
The new flag --enable-debug-break turns the otherwise illegal Dart statement
  break "message";
into a break instruction preceded with a debug message, the equivalent of
emitting an Assembler::Stop("message").
Add a language test expecting a syntax error without the flag.
Change expected break instruction in arm64 simulator.
Remove constants related to now deleted simulator tracing on mips and arm64.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45218 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-16 19:32:48 +00:00
regis@google.com 8a0194b846 Fix mint shifting by zero on MIPS (issue 23117).
Add regression test.
Restore formatting space dropped by mistake in simulator tracing output.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45042 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-09 22:50:25 +00:00
vegorov@google.com b2d9992127 Fix incorrect kNumTemps for BinaryUint32OpInstr on x64
R=johnmccutchan@google.com
BUG=http://dartbug.com/22693

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44296 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-06 17:53:39 +00:00
vegorov@google.com 8c89e30eb8 Emit stackmaps even in unoptimized code if slow path pushes untagged values.
These stackmaps cover only pushed registers region, the rest of the stack (copied parameters, locals and temporaries) will be scanned as tagged values.

R=fschneider@google.com
BUG=http://dartbug.com/22621

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44173 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 15:43:32 +00:00
fschneider@google.com ea77da464b VM: Better type propagation for string objects.
For strings we can't propagate the class-id because of externalization,
but we still can record the compile-type (String). This is for example useful
for eliminating number-checks with identical-comparisons.

R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44133 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 16:10:22 +00:00
vegorov@google.com 094e899972 Fix Range::Mul for fully non-positive ranges.
BUG=http://dartbug.com/22541
R=fschneider@google.com, iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44046 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 12:40:55 +00:00
vegorov@google.com 598811048b Fold BIT_NOT and NEGATE during constant propagation.
Convert (a & 2^n) == 2^n into TestSmi instruction.

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43957 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 14:53:02 +00:00
vegorov@google.com e8b7f9cb06 Don't constant fold operation if result is incompatible with it.
For example we can't replace BinarySmiOp with Mint constant because we might have removed the checks based on the assumption that BinarySmiOp always returns a Smi.

BUG=http://dartbug.com/22480
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43875 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 13:48:48 +00:00
fschneider@google.com f7a97fa4d4 VM: Fix slow-path deoptimization environment.
The number of pushed arguments needs to be accounted for.

BUG=dartbug.com/22331
R=vegorov@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43681 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-11 13:34:15 +00:00
vegorov@google.com 2b42069b43 Fix LoadOptimizer's handling of load/stores with constant indices for TypedData.
LoadOptimizer computes KILL sets in assumption that place X[C] can alias place X[K] if and only if K == C. This however does not hold for TypedData where X[0] can alias X[1] if we are reading 32bit value at X[0] and 8bit value at X[1]. The only thing that TypedData guarantees is that all accesses are done with byte offsets aligned by the size of the data type.

This change incorporates TypeData elements aliasing rules into LoadOptimizer:

- Place hierarchy was extended with constant index places for TypedData X[C|S]:
  - C is a byte offset to the element being read instead of an unscaled index that was used before;
  - S size of the element being read.

- KILL set computation ensures the following aliasing rule:

      X[C|S] aliases X[RoundDown(C, S')|S'] for all sizes S' > S

R=fschneider@google.com
BUG=http://dartbug.com/22120

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43137 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 15:14:35 +00:00