Commit Graph

8223 Commits

Author SHA1 Message Date
Zachary Anderson 135b1907ee [Fuchsia] Grab the number of malloc'd bytes from jemalloc
This allows us to report the "native heap memory" value in
the Observatory for VMs running on Fuchsia.

This change also renames the flag --enable-malloc-hooks to
--profiler-native-memory to better reflect what the flag
does. (In the future we may also want to rename
--profiler to --profiler-cpu.)

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2829833003 .
2017-04-19 15:51:02 -07:00
Ryan Macnak 8b96a31c7f Move runtime functions to the more logical runtime_entry.cc.
Make --trace-runtime-calls respect the isolate filter.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2827873002 .
2017-04-19 10:22:04 -07:00
Régis Crelier f0622c0567 Allow signature functions to be allocated in new space.
Types generated via instantiation during run time type tests are allocated in
new space and it makes sense (in the case of function types) to also allocate
instantiated signatures in new space.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2821233005 .
2017-04-19 10:10:44 -07:00
Ryan Macnak 17e43f284b Tree shaker:
- Don't remove entries from a library's dictionary while iterating over it.
 - Remove library prefixes from library dictionaries.
 - Compact library dictionaries after removing entries.
 - Track snapshot references in debug mode and give a backtrace when unencountering an unexpected object.
 - Verify removed libraries are not included in the snapshot by marking their top-level classes.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2823873003 .
2017-04-19 10:03:43 -07:00
Erik Corry 0856863355 Fall back to megamorphic stub when dispatching calls to rare classes.
Previously we were converting very polymorphic calls that always end up
in the same implementation into a check-class instruction and a (usually
inlined) direct call.  This works well in artificial benchmarks like
the Megamorphic suite, but tends to cause repeated deopts on large real
programs like dart2js, where new classes arrive after a while, triggering
the check-class instruction to deopt.  After a few deopts, the function
is no longer eligible for optimization, resulting in huge slowdowns.

Instead with this change we can switch to the normal machinery for polymorphic
calls with more than one target.  This has the advantage that we use a
megamorphic stub call to catch rare classes, rather than deopting.
Dart2js is speeded up by a few percent on average and avoids the big
performance potholes described in https://github.com/dart-lang/sdk/issues/29302

Also reverts a less effective workaround for 29302.

R=vegorov@google.com
BUG=29302

Review-Url: https://codereview.chromium.org/2829603002 .
2017-04-19 15:25:24 +02:00
Régis Crelier 4dd686e9df More work on finalization of recursive types (fixes #29357).
Add regression test.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2822323002 .
2017-04-18 17:18:39 -07:00
Jacob Richman b7995140f8 Revert "Fix #28740 demangle constructors in stack traces (A.A becomes new A)."
This reverts commit a84b6b7f7b.

BUG=

Review-Url: https://codereview.chromium.org/2824323002 .
2017-04-18 16:48:33 -07:00
Mike Fairhurst a84b6b7f7b Fix #28740 demangle constructors in stack traces (A.A becomes new A).
Regular constructors and unnamed factory constructors:
- Were A.A, now are new A
Named constructors (including factory constructors):
- Were A.A.name, now are new A.name

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

Review-Url: https://codereview.chromium.org/2818933003 .
2017-04-18 15:18:29 -07:00
Ryan Macnak b15cf1c490 Fix VM crash when encountering an assignment expression in a case expression.
Fixes #29370
Issue #29379

R=regis@google.com

Review-Url: https://codereview.chromium.org/2825843003 .
2017-04-18 13:48:06 -07:00
Siva Annamalai 96bbe512eb Fix for issue 29350 - VM Crashes when covariant is used incorrectly.
BUG=#29350
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2827453003 .
2017-04-18 11:10:28 -07:00
Vyacheslav Egorov 8f563f2c32 VM: Prohibit reload when throwing or processing language errors.
This fixes flaky crashes on negative tests in stress reload mode: when
we attempt to reload an isolate while throwing/formatting compile time error.

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

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2825043002 .
2017-04-18 18:51:49 +02:00
Erik Corry 2a2de1aa23 Temporary fix to ameliorate severe dart2js regression on some workloads
R=vegorov@google.com
BUG=https://github.com/dart-lang/sdk/issues/29302

Review-Url: https://codereview.chromium.org/2798333004 .
2017-04-18 09:42:23 +02:00
Zachary Anderson 9ce608e89d [dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2822943002 .
2017-04-17 14:41:40 -07:00
Zach Anderson d42f61155f [fuchsia] Use new mx_deadline_after interface
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2822833002 .
2017-04-17 13:49:49 -07:00
Ryan Macnak 1c62b6b772 Make --trace-natives respect the isolate filter.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2818253002 .
2017-04-17 10:22:50 -07:00
Ryan Macnak 29de769d98 Allow the resolved names cache to be lazily created like the exported names cache.
R=regis@google.com

Review-Url: https://codereview.chromium.org/2823633003 .
2017-04-17 10:07:27 -07:00
Ryan Macnak 0733810528 Use to_snapshot when cluster serializing LibraryPrefixes.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2822843002 .
2017-04-17 09:04:13 -07:00
Régis Crelier fd5089c9e8 Remove parent_level field of function type parameters.
Add function_type_arguments field in closure instances.
Lots of other smaller changes, also related to generic function semantics.
This is still work in progress, with a change of direction in the design:
The type argument vector of a generic function will be prepended with the type
arguments of enclosing generic functions. The re-allocation and concatenation
will be done in nested generic function's prolog. This will greatly simplify
instantiation of types at run time without having to search the context for
parent function's type arguments. However, a closure instance now requires an
additional field. On the other hand, type parameters do not require a
parent_level field anymore.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2818273002 .
2017-04-17 08:58:24 -07:00
Mike Fairhurst bffe47e678 First stab at #29153 range check in as-casts. Mostly working.
Having an issue forwarding Symbol::InTypeCheck into dart and back;
without it, the exceptions that are thrown are `TypeError`s and not
`CastError`s.

Certainly a bit longform to read, as well.

Committing for feedback/suggestions/help

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2805903004 .
2017-04-13 10:44:57 -07:00
John McCutchan 6f039b508b Kill dead code
BUG=

Review-Url: https://codereview.chromium.org/2819573002 .
2017-04-13 09:55:13 -07:00
John McCutchan 7399d4bdec DBC follow up CL
- [x] Hoist handle out of loop.
- [x] Avoid allocating a handle.

BUG=

Review-Url: https://codereview.chromium.org/2819523003 .
2017-04-13 07:38:15 -07:00
Ryan Macnak 00c2af904f GN: Remove dead target 'libdart' and dead flag 'dart_experimental_interpreter'.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2819453002 .
2017-04-12 16:05:37 -07:00
Ryan Macnak 39040a8a15 Never erase parameter types in the JIT.
Even in unchecked mode with mirrors disabled, we need to be able to forward parameter types to lazily generated implicit closure functions.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2808763008 .
2017-04-12 15:40:42 -07:00
Ryan Macnak 5cffc591aa Refactor AOT deduplication steps so they can run before an app-jit snapshot as well.
Additionally dedup PcDescriptors, deopt entries, deopt lists, and await token position lists.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2815533003 .
2017-04-12 14:23:49 -07:00
Ryan Macnak 91da7428f3 Add --print_stacktrace_at_api_error.
Should be helpful in tracking down flutter/flutter#8612.

Prefer stack bounds from pthreads when available to be able to see frames below the Dart entry frame.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2813283002 .
2017-04-12 14:09:19 -07:00
John McCutchan f0734f99b3 Detect unhandled exceptions in async functions without an awaiter
- [x] Produce an awaiter stack trace even when there is no awaiter.
- [x] Fix fetching the saved context from Closure.call (fixes --trace_debugger_stacktrace)

Fixes #29200

Example code:

```
main(List<String> args) async {
  var f = new Foo();
  print(f.a.length);
  print('Should not get here');
}

class Foo {
  String a;
}
```

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2815863002 .
2017-04-12 13:15:41 -07:00
Regis Crelier 25dbc9b28a Fix look-ahead parsing code in the VM (fixes #29243).
Add regression test.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2812323002 .
2017-04-12 11:04:21 -07:00
Regis Crelier 659511d518 Fix type parameter invocation in the VM (fixes #19725).
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2814833003 .
2017-04-11 13:31:30 -07:00
Regis Crelier d8c17c90f2 Process a pair of registers in one instruction where possible on arm in the VM.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2813903003 .
2017-04-11 10:48:45 -07:00
Ryan Macnak 9ce48e63b2 Remove background finalization.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2809863002 .
2017-04-11 09:54:25 -07:00
Regis Crelier d0a7bad121 Pass a second type argument vector to all type instantiation calls in the VM.
With generic methods, uninstantiated types will require 2 instantiators, one
reflecting the class type arguments (as of today) and one reflecting the
function type arguments (new).
This is work in progress and the second instantiator is always null for now.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2799373002 .
2017-04-10 21:25:33 -07:00
Regis Crelier 820f8d74e6 Added missing canonicalization of typedef signature instantiated during
finalization (fixes #29300).

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2811643004 .
2017-04-10 15:15:31 -07:00
Ryan Macnak 42ec925a9e GN: Add libdart_jit and dart_api.
libdart_jit is always the JIT, unlike libdart which is either the JIT or AOT runtime depending on dart_runtime_mode. Clients of libdart will be updated to explicitly choose libdart_jit or libdart_precompiled_runtime.

dart_api allows libraries such as tonic or intermediate components of the Flutter engine to be agnostic as to whether they're in a JIT or AOT runtime, allowing the final executable making the choice without having to deal with a conflicting dependency brought in by a library.

Remove dead libdart_embedder_noio.

Replace all used of dart_nosnapshot* with dart_nosnapshot_with_precompiler*. We don't care about binary size of their clients, so it's better to have fewer targets.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2814513003 .
2017-04-10 13:44:25 -07:00
Regis Crelier 8ca244ba27 Make finalization of recursive function types more robust, especially since
the Kernel frontend may omit the information that a function type is a typedef.
Re-enable several previously failing tests for dartk.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2806893002 .
2017-04-10 11:06:14 -07:00
Ryan Macnak daddec8308 Mark optimized code for the crash handler and disassembler output.
Optimized code has its function name prefixed with an asterisk, which is also how we display optimized code in Observatory.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2803013004 .
2017-04-07 13:31:51 -07:00
Ryan Macnak 170bf10904 Do not create method extractors during JitOptimizer::TryExpandClassesInICData.
Closes #29230
Issue #29292
Issue #29293

R=erikcorry@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2796283006 .
2017-04-07 09:45:09 -07:00
Ryan Macnak 22eee804cd Do not rewrite the VM isolate's symbol table during AOT snapshots.
This has the effect of making every program generate the same VM isolate, allowing an embedder to load different programs into different isolates.

Verify the number of base objects in clustered snapshots.

Remove dead code leftover from core snapshots switching from saving scripts to saving token streams in the VM isolate.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2790243003 .
2017-04-06 13:22:25 -07:00
Regis Crelier 5f5a698100 Keep types in signatures of function types properly instantiated as the function
type itself gets instantiated.
Until now, the signature was kept unchanged and the instantiation was reflected
by the type arguments of the function type only. This delayed instantiation
would complicate the implementation of generic functions.
This cl actually removes type arguments for (non-typedef) function types. The
function type is now fully represented by the signature. When the function type
is instantiated, a new signature is allocated (instead of a new type argument
vector) to hold instantiated result type and formal parameter types.
The same applies in the case of typedef function types, however, the type
arguments of the typedef are kept as before. This allows for better printing
of typedef function types and for finalization of recursive type involving
typedefs as type arguments.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2793033005 .
2017-04-06 12:28:52 -07:00
Dmitry Olshansky 19a352e0f5 Reland: VM [KERNEL] Avoid emitting :expr_temp and capturing :iterator
This allows us to bypass allocation of Context for some sync*
function such as in Iteration.tree.syncstar benchmark.

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2803853004 .
2017-04-06 17:18:40 +02:00
Ryan Macnak f894b69a02 Don't visit a frame's code object twice.
One slot in each Dart frame contains a "pc marker". Prior to the calling convention change, the pc marker was a fixed offset from the code's entry point, from which the code object could be derived. After the change, the pc marker is a pointer to the code object itself.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2804793003 .
2017-04-05 17:53:34 -07:00
Ryan Macnak cbb8519a69 Do not embed is_auto_setup_scope into the compilation of native calls.
Rather, split NativeCallWrapper into variants that do or do not set up an API scope. This makes it safe for lazy link natives to also lazily resolve.

Issue #24686

R=zra@google.com

Review-Url: https://codereview.chromium.org/2793163002 .
2017-04-05 15:30:06 -07:00
Ryan Macnak 683077944b Conservatively disable use of integer division on Android ARM64 devices.
R=jsimmons@google.com

Review-Url: https://codereview.chromium.org/2800883002 .
2017-04-05 12:45:01 -07:00
Vyacheslav Egorov 7e1d584218 VM: [Kernel] Implement CatchBlockEntryInstr::should_restore_closure_context on all platforms.
This was the only Kernel specific backend change - to simplify the graph builder
we allowed it to capture exception and stack trace variables. This in turn
requires CatchBlockEntryInstr to respect that this variables can be captured
and correctly update them when exception is caught.

This was implemented on X64 and ARM before. This CL expands implementation to
all other implementations including DBC.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2796283003 .
2017-04-05 20:32:03 +02:00
Dmitry Stefantsov 95560cb02a Add Kernel AST nodes for Vector and Closure primitives in VM
Five Kernel AST nodes added: VectorCreation, VectorGet, VectorSet,
VectorCopy, and ClosureCreation.

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

Review-Url: https://codereview.chromium.org/2792333002 .
2017-04-05 15:59:25 +02:00
Dmitry Olshansky ffc4c1df30 VM [KERNEL] Use simpleInstanceOf in kernel.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2794373002 .
2017-04-05 14:56:42 +02:00
Dmitry Olshansky 7c011eda26 VM [KERNEL] Fix a buffer overflow in COMPARE_NAME
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2794113003 .
2017-04-05 14:06:00 +02:00
John McCutchan e33e09a23c Disable async debugger support until context mismatch issue is resolved.
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2795303002 .
2017-04-04 13:36:42 -07:00
Regis Crelier a08c95e003 Rename dart::Genericity::kClass to dart::Genericity::kCurrentClass to avoid
collision with dart::kernel::Tag::kClass.

R=bkonyi@google.com

Review-Url: https://codereview.chromium.org/2796993002 .
2017-04-04 12:08:57 -07:00
Kevin Millikin 04cb9809d1 Restructure the Kernel string table.
Instead of a list of strings given by their length and UTF-8 encoding,
restructure the string table to consist of a list of string ending
offsets followed by a blob of UTF-8 encoded strings without lengths.

This is a step toward copying the string blob into the VM's heap and
building a heap-allocated structure to give random access to them.

BUG=
R=asgerf@google.com, jensj@google.com

Review-Url: https://codereview.chromium.org/2790073004 .
2017-04-04 13:04:25 +02:00
Regis Crelier 5065c1c0c4 Clean up finalization of recursive types in the VM.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2791393002 .
2017-04-03 14:28:01 -07:00