Commit Graph

275 Commits

Author SHA1 Message Date
Florian Schneider 2e4101fc6c VM: Remove too strict assertion in rethrow.
With custom zones and async code we may end up invoking rethrow
with an error object where the stacktrace is not initialized.

In that case we can just use the stacktrace passed into rethrow
explicitly.

Fixes #27839.

R=kustermann@google.com

Review URL: https://codereview.chromium.org/2511573003 .
2016-11-17 12:11:33 -08:00
Todd Turnidge 1cdb3d2155 Revert "JumpToFrame refactor"
This reverts commit 5ed13d3298.

BUG=

Review URL: https://codereview.chromium.org/2503623003 .
2016-11-14 15:57:01 -08:00
Todd Turnidge 5ed13d3298 JumpToFrame refactor
- Refactor the JumpToExceptionHandle code so that it is now built from
  two pieces: JumpToFrame and RunExceptionHandler.

- Refactor the Simulator::Longjmp() code so that it is no longer
  exception-specific.  Instead it uses the RunExceptionHandler stub.

This makes it so that the JumpToFrame stub and Simulator::JumpToFrame
have the same semantics.  This will make it easier to land the Rewind
changes I am working on.

There are some oddities for dbc.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2503653002 .
2016-11-14 14:38:21 -08:00
Zachary Anderson a64272b912 DBC: Fix checked mode stack traces
fixes #27732

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2493353002 .
2016-11-11 21:39:47 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Ryan Macnak 1c23917b09 Remove frames skipped by a throw from the lazy deopt table.
Be careful to unmark the frames first so stack walks can still succeed. Likewise update the frame before removing the table entry in DeoptimizeCopyFrame.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2396433003 .
2016-10-04 15:12:54 -07:00
Ryan Macnak 9dda00c8b0 Don't remove any entries from the pending deopts table before a throw.
The profiler may attempt a stack walk between removing these entries and the stack being unwound. These entries will instead be removed during DeoptimizeCopyFrame.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2388343002 .
2016-10-03 16:52:02 -07:00
Ryan Macnak 763daa9d06 Reapply "Lazy deopt without code patching."
When throwing to a frame scheduled for lazy deopt, update the continuation pc for that frame to be the catch handler.

Weaken new assert that the deopt pc belongs to the frame's code as the deopt pc for the last eager deopt in a function lies outside the code, after the call to the deopt stub.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2392613002 .
2016-10-03 11:31:48 -07:00
Ryan Macnak 4e9a473746 Revert "Lazy deopt without code patching."
This reverts commit 6cff17c59a.

Review URL: https://codereview.chromium.org/2382953004 .
2016-09-30 18:04:58 -07:00
Ryan Macnak 6cff17c59a Lazy deopt without code patching.
Keep a side table that maps a fp back to a deopt pc.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2380403003 .
2016-09-30 16:53:29 -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
Siva Annamalai da487a567c Fix for issue 27380 - VM stuck in deadlock with background finalization and background compiler thread
- fixed an inadvertant flip in the safepoint check in this cl
    https://github.com/dart-lang/sdk/commit/e72c1fb47

  -  return (IsMutatorThread() ||
  -          (isolate_ != NULL && !isolate_->thread_registry()->AtSafepoint()));
  +  return (IsMutatorThread() || IsAtSafepoint());

- increase the scope of CanCollectGarbage in Heap::AllocateOld to also
  account for the tasks lock as checking for tasks inside a safepoint
  scope can lead to deadlocks

- fix an aggressive assertion in compiler for expected errors being only
  LanguageErrors to allowing UnhandledExceptions (OOM, stack overflows etc.)

- fix an aggressive assert in exception handler (handler pc can be 0 even in the mutator thread.

- workaround issue 27413 in PageSpace::CanIncreaseCapacityInWords

BUG=27380
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2363823002 .
2016-09-23 10:14:12 -07:00
Matthias Hausner 3e0d13bc28 Make compile-time errors catchable
If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.

The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#

Example:
     1	void bad() {
     2	    return 5
     3	}
     4
     5	void main(args) {
     6	    bad();
     7	}

Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^
$

After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^

#0      main (file:///Users/hausner/tmp/e.dart:6:3)
#1      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$

Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.

BUG= https://github.com/dart-lang/sdk/issues/23684
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2044753002 .
2016-09-16 10:10:38 -07:00
Florian Schneider 743fe92c49 VM: Better handling of OOM errors in the background compiler
Don't expect to find a Dart frame on the stack when an exception
occurs in background compilation.  Propagate OOM error as an
unhandled exception, and disable optimization for the function
where it occurred.

BUG=#27206
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2341523002 .
2016-09-13 17:13:49 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
Todd Turnidge 6b28b4f7ef Remove DebuggerEvent. Refactor remaining code.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1978603002 .
2016-05-13 09:49:31 -07:00
Ivan Posva 5be5d54529 - Refactor Symbol allocation to expect a thread parameter.
- Preallocate all tokens as symbols to avoid repeated lookups.
- Pass thread/zone where useful while doing this change.
- Avoid allocating symbols for error messages.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1870343002 .
2016-04-11 16:28:29 -07:00
Matthias Hausner 425b9a36b9 Use symbols when looking up fields in a class
The slow string comparison is only necessary when looking up
non-symbols or untangled private names.

Compiling all of dart2js seems to be about 1% faster, but it's really in the noise.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1868803002 .
2016-04-07 16:36:35 -07:00
Regis Crelier 966aea003b Remove recently introduced FunctionType vm class by merging it into class Type.
Fix syntax used when printing function type with optional named parameters.
Fix several issues discovered with cloning function types.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1815733003 .
2016-03-21 14:08:57 -07:00
Siva Annamalai 56e888d4cd - Move
stack_limit_,
   stack_overflow_flags_,
   saved_stack_limit_,
   stack_overflow_count_ and
   other interrupts mask fields from Isolate structure to Thread structure

- Change the stack overflow check in the prolog to load the stack limit
  from the THR register, this removes the back to back dependent loads to
  load the stack limit from the Isolate structure

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

Review URL: https://codereview.chromium.org/1812753002 .
2016-03-17 12:57:36 -07:00
Regis Crelier ba69c8a898 Enumerate URIs of all types in type errors in order to help the user diagnose
the error (it was previously only printed for types with identical names).
Cleanup and simplify construction of type errors.

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

Review URL: https://codereview.chromium.org/1778133002 .
2016-03-09 15:16:47 -08:00
John McCutchan b482480b65 Improve behaviour when we hit a stack overflow / OOM error
Fixes #25815

VM changes:

- Don't crash in SignalExceptionThrown when we have no stack frames.

- Notify the debugger about an unhandled stack overflow / OOM *after* setting the sticky error. This allows Observatory to display it.

- When pausing without a debugger attached, print the sticky error if one is set.

- Improve stack trace frame numbers when printing for a stack overflow.

Observatory changes:

- Report the sticky error for pause at unhandled exception as well as exit.

- Let the user know that we cannot pause for unhandled stack overflow / OOM exceptions.

- Don't show the "at <func> (<script location>)" string in the isolate summary, if we don't have a top frame.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1709383002 .
2016-02-25 07:33:01 -08:00
Vyacheslav Egorov a9498ee8cb Remove --abort_on_assertion_errors and all associated infrastructure.
R=fschneider@google.com
BUG=http://dartbug.com/25753

Review URL: https://codereview.chromium.org/1703503002 .
2016-02-16 15:32:40 +01:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
Vyacheslav Egorov 03d2a819e4 Make --abort_on_assertion_errors more selective.
Only abort() if we detect that we have likely encountered internal Dart2JS
compiler error.

This flag was added in attempt to gather more information on buildbots but
it turns out that always aborting on type/assertion errors does not scale:
some dart2js tests actually test that an error was thrown.

BUG=http://dartbug.com/25753
R=srdjan@google.com, whesse@google.com

Review URL: https://codereview.chromium.org/1691443002 .
2016-02-10 18:49:10 +01:00
John McCutchan d295b9c311 Remove many features when building product mode
Move all JSON printing code from object.cc to object_service.cc.

Not compiled in:

- Service protocol
- Debugger
- Debugger API
- JSONStream
- ObjectIdRing
- Profiler service
- Object JSON printing

Size of dart_bootstrap before: 5670365 bytes
Size of dart_bootstrap after: 5287631 bytes

Reduction in size: 382734 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1660063002 .
2016-02-05 09:55:51 -08:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

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

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
Vyacheslav Egorov 6c85aca6d2 Introduce a flag to force program abort on type/assertion errors.
We intend to switch this turn this flag on for dart2js buildbots to collect more
information about impossible type-errors that sporadically occur there.

R=iposva@google.com
BUG=

Review URL: https://codereview.chromium.org/1654153002 .
2016-02-02 01:53:03 +01:00
Florian Schneider b042cd9a9a VM: Remove non-existent/unused functions from precompiled entry points.
These are not present / or not used currently.

Also remove associated native functions from vm-service.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1536003002 .
2016-01-04 12:41:16 +01:00
Srdjan Mitrovic b9426418d8 Get rid of deprecated methods accessing mutator_thread_ instead of current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1410643008 .
2015-10-20 10:26:08 -07:00
Srdjan Mitrovic e520dd567f Remove isolate argument from handle allocation: Part I
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1393373003 .
2015-10-12 11:32:08 -07:00
Srdjan Mitrovic 8c7a94e9f4 Preparation for moving reusable handles to thread and more cleanups: isolate -> thread based handle allocation.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1384403002 .
2015-10-06 10:17:12 -07:00
Lasse R.H. Nielsen d755dd65b9 Update range errors to agree on the numbers.
Also ensure that typed-data errors are consistent with other lists.

Fixes issue #24295
BUG= http://dartbug.com/24295
R=floitsch@google.com, iposva@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1318943005 .
2015-09-11 13:05:36 +02:00
Lasse R.H. Nielsen 1b8f3fba14 Make List constructor give better error messages for non-int arguments
BUG= http://dartbug.com/15986
R=herhut@google.com, iposva@google.com, sra@google.com

Committed: https://github.com/dart-lang/sdk/commit/33c76638268e3e24fb7a73a8f6f141f38272e8dd

Review URL: https://codereview.chromium.org//1214723009 .
2015-08-17 13:01:13 +02:00
Lasse R.H. Nielsen 51fa195f16 Revert "Make List constructor give better error messages for non-int arguments"
There are VM-only tests that assume exact text of failure.

BUG=

Review URL: https://codereview.chromium.org//1294483003 .
2015-08-14 15:05:17 +02:00
Lasse R.H. Nielsen 33c7663826 Make List constructor give better error messages for non-int arguments
BUG= http://dartbug.com/15986
R=herhut@google.com, iposva@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1214723009 .
2015-08-14 13:44:19 +02:00
Florian Schneider 63a8e5227d VM: More abstract interface for generating stub calls.
This makes the code in the code generator independent from how stubs
are actually called (i.e. directly embedding the target address, or
indirectly by loading the target address from the code object).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1270803003 .
2015-08-05 10:18:35 +02:00
Daniel Andersson 32046b2eb8 Migrate stack resource unwinding to Thread.
Also remove some uses of deprecated StackResource constructor.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1261873005 .
2015-07-31 12:57:19 -07:00
Lasse R.H. Nielsen cf4eaae5a6 Change RangeError instances to use RangeError.range.
This avoids using the (sometimes confusing) "[...)" notation for half-open ranges.
Also change argument tests to simpler interval tests, and move error handling to the end of the functions.

Mostly in VM typed-data libraries.

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

Committed: https://github.com/dart-lang/sdk/commit/932bcc6901d70492c6f1b8d000b9555a0db62f4b

Review URL: https://codereview.chromium.org//1132603003
2015-05-29 10:50:20 +02:00
Lasse R.H. Nielsen 9e175d27d7 Revert "Change RangeError instances to use RangeError.range."
Method hashes needs to be updated.

Review URL: https://codereview.chromium.org//1160903002
2015-05-28 10:46:15 +02:00
Lasse R.H. Nielsen 932bcc6901 Change RangeError instances to use RangeError.range.
This avoids using the (sometimes confusing) "[...)" notation for half-open ranges.
Also change argument tests to simpler interval tests, and move error handling to the end of the functions.

Mostly in VM typed-data libraries.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1132603003
2015-05-28 10:34:03 +02:00
Daniel Andersson 6542a451c3 Refactor Isolate -> Thread in NativeArguments and exception handler jump.
Further reduces the one-to-one assumption about isolates and threads: native entries now ask the thread for its isolate, rather than the other way around.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156143003
2015-05-26 16:49:51 -07:00
koda@google.com e3a345a84b Rename NoGCScope -> NoSafepointScope.
The old name makes less sense in the context of concurrent GC (and multiple threads in general).

Document the intended semantics of this (DEBUG-only) guard scope.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44616 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-20 22:08:25 +00:00
koda@google.com 97c6a8bc04 Get C++ stack pointer in an ASAN-compatible fashion when jumping to exception handler.
R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44480 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 21:49:55 +00:00
koda@google.com c1008f15c0 Save top StackResource in entry frame.
This avoids relying on stack address order, which enables us to benefit from AddressSanitizer's detect_stack_use_after_return feature.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43927 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-20 20:46:31 +00:00
iposva@google.com 7d1785e760 - Allow any implementation of StackTrace to participate in async/
await exception handling.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43880 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 16:17:19 +00:00
iposva@google.com 606687a6d2 Fixes http://dartbug.com/22305
- Increase the size of the preallocated stack trace to give
  more context in the case of stack overflow.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43867 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 05:16:15 +00:00
iposva@google.com db9faebe98 - Simplify collection of stack traces. If we determine that a stack
trace is needed we collect the full stack trace instead of piecing
  it together as we walk up the stack.

R=rmacnak@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43863 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 02:18:53 +00:00
koda@google.com 554f25b53c Verify/document assumption about stack resource addresses.
We assume that addresses of stack resources refer to the actual stack and are ordered accordingly.
Using the AddressSanitizer with detect_stack_use_after_return will break this assumption.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43858 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-18 23:21:32 +00:00