Commit Graph

13561 Commits

Author SHA1 Message Date
Zachary Anderson 130f3be297 [dart:io] Move _getUriBaseClosure to dart:io
In a forthcoming change, this will allow Uri.base to be aware of
the isolate's current namespace.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2998373002 .
2017-08-24 20:06:52 -07:00
Ryan Macnak eed3b5e0bb Fix inlining annotations for AOT.
We were only recording metadata positions when mirrors were enabled. Mirrors are not enabled for AOT, so this metadata became unavailable to the inliner. Now we always record metadata position.

The tree-shaker has been updated to know how to remove the metadata.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3003183003 .
2017-08-24 16:32:23 -07:00
Zachary Anderson 4a5cd4dd57 [dart:io] Remove socket_unsupported.cc
Forgot to remove a file in my last change.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3008433003 .
2017-08-24 14:42:25 -07:00
Alexander Markov 4f092b7e5f [vm,aot] Improve performance of certain 'is' operations
AOT may infer the range of Cids to check in order to perform
'is' (instance-of) operation. It is possible that the range contains
the only Cid, so AOT can generate 1 comparison instead of 2.
Note that the optimization of 'x is T' where T is not extended nor
implemented does not fully cover this case, as T could be abstract with
a single subclass or implementor.

The notable real case for this optimization is 'x is double',
as double is an abstract class with single implementor _Double.

This CL also improves type propagation for InstanceOfInstr, and
enables printing of abstract types in IL printer.

R=rmacnak@google.com

Issue: https://github.com/dart-lang/sdk/issues/30480
Review-Url: https://codereview.chromium.org/3003793002 .
2017-08-24 14:27:47 -07:00
Samir Jindel 7b53e209c5 Fix several bugs in closure conversion.
Summary:

1. Previously, in 'BuildGraphOfConvertedClosureFunction', the VM was unable to
   correctly forward parameters to converted closure functions when
   they were captured in the converted function's body. This could happen when, for
   example, a closure was introduced into it by async conversion.

   Now, this is fixed by an approach that mirrors the technique in
   'BuildGraphOfFunction'.

2. Previously, local variables declared inside loop bodies were being saved in
   the loop's enclosing context, so closures within the loop would see new
   values initialized to the variable in subsequent iterations.

   Now, this is fixed by creating nested contexts for all loops, regardless of
   whether the loop variables are captured.

3. Previously, arity checks were not being performed on converted closures, so
   they could be called with too few or too many arguments. In the former case, the
   missing arguments would be filled in with garbage on the stack.

   Now, the assembly generation in 'CompileGraph' inserts argument count checks
   for converted closures as well as regular closures.

Test Plan:

Introduced new tests in the closure conversion suite to test each bug:

1. syncstart.dart
2. loop2.dart, blocks.dart, updated for_in_closure.dart
3. arity.dart

With these changes, closure conversion passes all co19 tests in non-checked mode, except those that are not passed without it:

python tools/test.py -m release -c dartk --vm-options "--reify --reify_generic_functions" co19

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/3000333002 .
2017-08-24 20:21:28 +02:00
Zachary Anderson 747868f2b1 [dart:io] Remove DART_IO_DISABLED
This was only used by Dartium.

Review-Url: https://codereview.chromium.org/3009523002 .
2017-08-24 11:17:52 -07:00
Carlo Bernaschina 179b056e47 Restile Observatory memory dashboard
- Better look for the tab buttons
- Removed the term `Isolate`

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3007513002 .
2017-08-24 09:35:25 -07:00
Siva Annamalai 8039138f39 Move all the isolate reload code under !defined(DART_PRECOMPILED_RUNTIME)
R=zra@google.com

Review-Url: https://codereview.chromium.org/2997243002 .
2017-08-24 09:25:55 -07:00
Martin Kustermann 732a682e52 [gardening] Re-enable vm/cc/UseDartApi on simdbc64
Running this in a loop locally did not reproduce any crash and the issue
was filed in January, so the fundamental problem might have been fixed
already.  Due to the lack of more information in the bug report, the
best thing is to renable the test, close the issue and see if the test
flakes again.

Closes https://github.com/dart-lang/sdk/issues/28499

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/3003203002 .
2017-08-24 11:16:15 +02:00
Martin Kustermann 055dbbfd68 [VM] Disable --deoptimize-every/--stacktrace-every in kernel isolate
Since the kernel isolate is just an auxiliary service, it makes little sense that it "inherit" these flag (similarly --checked is not "inherited" by kernel isolate)

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

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2997403002 .
2017-08-24 11:15:15 +02:00
Ryan Macnak 20002d14b1 [vm, aot] Ensure fixups applied after the world has been compiled are applied to closures in finally clauses.
Finally clauses are inlined into try and catch blocks. This causes the parser to allocate at least two functions for any closure in a finally cause, only one of which will be registered by the flow graph builder. The unregistered function gets compiled, but the program visitor is unable to iterate it. To fix this, we use both the program visitor and the tree-shaker's work queue to apply fixups.

Fixes #30522

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

Review-Url: https://codereview.chromium.org/3003253002 .
2017-08-23 16:42:38 -07:00
Alexander Markov 4743d90f3f [vm] Use strong mode types to calculate CompileType
Strong mode types of fields, parameters and return types of
interface targets of calls are used to calculate more precise
CompileTypes of IL instructions.

R=rmacnak@google.com

Issue: https://github.com/dart-lang/sdk/issues/30480
Review-Url: https://codereview.chromium.org/3004463002 .
2017-08-22 15:54:15 -07:00
Ryan Macnak 878a5f2653 Fix the new generation growth criterion so it is not mislead into performing two growths in a row.
The decision to grow is based on the fraction of the objects that became garbage in the previous scavenge. If the previous scavenge included a growth, the new size of new space does not affect this statistic. If the program's allocation pattern remains the same, the next scavenge will see the same garbage ratio and decide to grow again, even if we would have hit the desired garbage fraction at the current capacity. This CL changes the garbage fraction to use the post-growth capcity as the dominator to prevent this eager double-growth.

This change causes Flutter Gallery to stablize at a 4MB semispace instead of 16MB, with ~10ms instead of ~40ms scavenges while interacting with the time picker on a Nexus 4.

R=danunez@google.com

Review-Url: https://codereview.chromium.org/3003063002 .
2017-08-22 15:10:18 -07:00
Alexander Markov cf28d9a5d6 [vm] Cleanup Instruction::Dependencies(), EffectSet, BlockEffects
This is the final piece of cleanup after Dart_MakeExternalString API
was removed in 5b694c1b1c.

Closes https://github.com/dart-lang/sdk/issues/30474

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/3001403002 .
2017-08-22 12:21:21 -07:00
Ryan Macnak 14b5782544 Remove GC prologue and epilogue callbacks.
These should have been removed along with weak reference set support in 4992bc72a0 since they serve no other purpose.

Review-Url: https://codereview.chromium.org/3001343002 .
2017-08-22 11:19:54 -07:00
Carlo Bernaschina 463dec5135 Restyle Observatory Memory Dashboard buttons
- More polished button style
- Make Refresh and GC buttons styled as buttons

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2996353002 .
2017-08-22 10:36:18 -07:00
Ryan Macnak e77e11ee05 Don't blame old-space GC time against a new-space GC that triggered it.
R=danunez@google.com

Review-Url: https://codereview.chromium.org/3000293002 .
2017-08-22 10:14:10 -07:00
Alexander Markov 36140a7519 [vm] Cleanup Instruction::Effects(), prepare to cleanup Dependencies()
This CL continues cleanup after Dart_MakeExternalString API was removed
in 5b694c1b1c.

* Replace Instruction::Effects() with Instruction::HasSideEffects().

* Prepare to clean up Instruction::Dependencies() - assert that it is
  used only if AllowsCSE(). In such case it always returns
  EffectSet::None().

* Clean up 2 separate maps for instructions with dependencies and
  without dependencies in CSEInstructionMap, as it only works on
  instructions with AllowsCSE() and, as a consequence, without
  dependencies.

* Clean up code which was testing Dependencies() of CheckClassInstr
  and CheckClassIdInstr.

* Fix LoadStaticFieldInstr::AllowsCSE() to take FLAG_fields_may_be_reset
  into account - like in LoadStaticFieldInstr::Dependencies().

R=vegorov@google.com

Issue: https://github.com/dart-lang/sdk/issues/30474
Review-Url: https://codereview.chromium.org/3003593002 .
2017-08-22 08:53:31 -07:00
Kevin Millikin 2f49198520 Allow the VM to read Kernel files with external libraries
The meaning of a Kernel file with an external library is that the
library is one that is already known to be loaded in the VM.

Fixes issue #30111.

BUG=https://github.com/dart-lang/sdk/issues/30111
R=jensj@google.com

Review-Url: https://codereview.chromium.org/2995423002 .
2017-08-22 16:05:19 +02:00
Kevin Millikin b38c00a341 Avoid triggering an ASSERT in TypedData
When a zero-sized string occurs as that last string in the Kernel
string table, the code would attempt to compute the address that lies
one element past the end of the string table's backing store.  Though
this is benign in C++ as long as that address is not dereferenced, it
would trigger an assertion failure in TypedData::DataAddr.

Avoid triggering the assertion by performing the address arithmetic in
the caller based on DataAddr(0) rather than relying on the address
arithmetic in DataAddr.

This fixes issue 30420.

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

Review-Url: https://codereview.chromium.org/3003023002 .
2017-08-22 09:27:24 +02:00
Beeravolu Siva Chandra Reddy eeaeb6fbf6 Adjust the column number where a StackOverflow error is reported.
Before this change, the column number of the StackOverflow error was
reported at the opening '(' of the function parameter list:

  ReturnType function(...) { ... }
                     ^

This change moves it to the opening '{':

  ReturnType function(...) { ... }
                           ^

In case of single statement functions with '=>', the location of the '='
is reported as the column number of the StackOverflow error.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3002833003 .
2017-08-21 11:09:11 +02:00
Carlo Bernaschina e673ff0b25 Update observatory_sources.gni
TBR=asiva@google.com

Review-Url: https://codereview.chromium.org/3003463002 .
2017-08-18 18:11:43 -07:00
Carlo Bernaschina a21eee5c00 Introduce heap snapshot into Memory Dashboard
In the Memory Dashboard, once an isolate is selected, it is now possible
to see the allocation profile or the heap snapshot.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3002843002 .
2017-08-18 18:04:40 -07:00
Carlo Bernaschina b87e991af2 Restore "Speedup Observatory elements first time rendering"
The CurlyBlockElement was using a hack to speedup rendering to allow
RetainingPathElement and InboundReferencesElement to pass the tests.

- Removed hack from CurlyBlockElement
- Converted RetainingPathElement and InboundReferencesElement to the
  waitFor APi.

Related https://github.com/dart-lang/sdk/commit/7568ed5f69e384e1832757a6c27d343616626afb

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

Review-Url: https://codereview.chromium.org/2995923002 .
2017-08-18 17:09:02 -07:00
Régis Crelier b8bce019b3 [VM generic functions] Support generic async calls.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/3001213002 .
2017-08-18 15:25:20 -07:00
Carlo Bernaschina 66c0fd885a Refactor of Observatory virtual-collection
The virtual-collection component uses a div container as a viewport on
a fixed sized spacer div that emulates the full size of the content.
In the spacer div there is a relative positioned div that scrolls
both horizontally and vertically. While the internal items are fully
computed horizontally, vertically we render just a subset of the items.
This buffer component scrolls both horizontally and vertically due
to its father child relationship with the spacer div. When the viewport
is going to show items that are not rendered in the buffer we move
the buffer accordingly (it is relative positioned with a variable top)
and update the content.

Managing the header of a table though is challenging:
1. we want the header to be fixed vertically
2. we want it to scroll horizontally accordingly to the the rest of the
   content
3. we want also to make this container took into consideration during
   the width computation, to allow it to trigger the horizontal
   scrollbar if it is wider that content.
4. we want the header to perceive the same available space as the
   other items in the collection.

We cannot obtain (1) at the same time of (2) (3) and (4) via pure
CSS. The header must be child of just another element.
- If we make it children of collection itself we obtain just (1) while
  we need to emulate the others via code.
- If we make it children of the viewport we obtain (2) (3) and (4),
  but we need to emulate (1) via code.

The first implementation followed the second option. The side effect
though is that smooth scroll (touch or touchpad based) does not fire
the onScroll events required to keep the header on top fast enough to
avoid flickering.

Due to the fact that scroll is the main use case for this element the
new implementation uses the first approach. Vertical flickering is
a problem no more. We obtain (2) by changing the horizontal offset
of the container, possible flickering, but way less common.
We obtain (3) by adding an extra div in the viewport which has the
same minimum size of the header. We obtain (4) by updating the
width of the last header child during the resize operations.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2998103002 .
2017-08-18 14:33:30 -07:00
Siva Annamalai cfac48179b 1. Figure out the modified libraries from the specifeid kernel file during
reload instead of computing it based on the source modification information.

2. Fix for failure in Unit test case https://github.com/dart-lang/sdk/issues/30322

3. Fix crash in test that was being skipped in https://github.com/dart-lang/sdk/issues/30109 and turn that test on.

This CL is work towards completing issue https://github.com/dart-lang/sdk/issues/28051

R=aam@google.com

Review-Url: https://codereview.chromium.org/2998983002 .
2017-08-18 13:42:19 -07:00
Ryan Macnak 60a7160273 Reapply "[vm] Prevent non-fatal errors from causing timers to be dropped."
Fix Linux event handler to re-arm the timer_fd after handling a wakeup.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2996243003 .
2017-08-18 13:38:08 -07:00
Alexander Markov 61ba2f1e9a [vm] Read interface_target_reference from kernel binaries
This CL adds reading of 'interface_target_reference' from kernel
binary files and storing it in InstanceCallInstr IL instructions.
Later, it will be used to generate better code in AOT (in strong mode).

R=rmacnak@google.com

Issue: https://github.com/dart-lang/sdk/issues/30480
Review-Url: https://codereview.chromium.org/3001883002 .
2017-08-18 10:23:09 -07:00
Zach Anderson 783f1e8c04 [infra] Remove dependency on gyp
R=rmacnak@google.com, whesse@google.com

Review-Url: https://codereview.chromium.org/3003433002 .
2017-08-18 08:51:40 -07:00
Kevin Millikin a2712fc099 Do not qualify with dart:: except where necessary
The Kernel C++ implementation no longer has classes like Library,
Class, Field, or String, so it's no longer necessary to explicitly
write `dart::` in most places.

BUG=
R=jensj@google.com

Review-Url: https://codereview.chromium.org/3001103002 .
2017-08-18 11:28:34 +02:00
Alexander Markov 5b694c1b1c [vm] Remove Dart_MakeExternalString and --support-externalizable-strings
This CL removes unused Dart API Dart_MakeExternalString, VM option
--support-externalizable-strings and underlying support for
externalizable strings from Dart VM.

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

Issue: https://github.com/dart-lang/sdk/issues/30474
Review-Url: https://codereview.chromium.org/2997173002 .
2017-08-17 17:49:35 -07:00
Ryan Macnak 9ce7fb5929 Revert "Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime.""
This reverts commit 8ee4436355.

This change caused a 63% increase in AOT snapshot size of Flutter Gallery.

Issue #30472

Review-Url: https://codereview.chromium.org/2997993002 .
2017-08-17 13:33:37 -07:00
Ryan Macnak c536c82521 Revert "[vm] Prevent non-fatal errors from causing timers to be dropped."
This reverts commit 8692f618f6.

This change caused co19/LibTest/isolate/Isolate/spawn_A06_t06 to timeout.

Review-Url: https://codereview.chromium.org/3001863002 .
2017-08-17 13:19:48 -07:00
Ryan Macnak 8692f618f6 [vm] Prevent non-fatal errors from causing timers to be dropped.
Issue #30425

R=zra@google.com

Review-Url: https://codereview.chromium.org/2995103002 .
2017-08-17 11:34:30 -07:00
Régis Crelier 1829af87e9 [VM mirrors and reified generic functions] Mirrors do not (and will probably
never) support reification of generic functions. However, instead of crashing
with an UNIMPLEMENTED, reify function type parameters to dynamic.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2997083002 .
2017-08-17 11:11:05 -07:00
Alexander Aprelev ba543167ec Pass path to platform kernel binary to kernel-service.
Currently kernel-service derives path to platform binary from path to dart executable. It doesn't always work, so dartk tests fail.

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

BUG:http://dartbug.com/30456
Review-Url: https://codereview.chromium.org/3001013002 .
2017-08-17 09:49:48 -07:00
Kevin Millikin 2f48593d9a Remove some "namespace" classes from C++ Kernel
The C++ implementation of Kernel has some classes that are serving as
namespaces for enums.  Remove them.

BUG=
R=jensj@google.com

Review-Url: https://codereview.chromium.org/3001093002 .
2017-08-17 14:34:05 +02:00
Kevin Millikin 7002f7765c Move some functions out of C++ header files.
The helper functions for reading from the Kernel binary should be in
the implementation file.

BUG=
R=jensj@google.com

Review-Url: https://codereview.chromium.org/2999133002 .
2017-08-17 12:36:06 +02:00
Carlo Bernaschina 5f6e3dc5bb Remove dynamic parameters from Observatory helpers
R=bkonyi@google.com

Review-Url: https://codereview.chromium.org/3002763002 .
2017-08-16 17:25:13 -07:00
Devon Carew e3c8338fad Specify sentinels in the return type for evaluateInFrame.
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2999103002 .
2017-08-16 15:14:27 -07:00
Alexander Markov d89b06ab09 [vm,aot] Fix AOT snapshot creation with kernel front-end
The following problems are fixed in dart_bootstrap when it is used to
create AOT snapshot along with new kernel front-end:

* Data race between main isolate and service isolate when accessing
  vmservice_io kernel program stored in DFE::kernel_vmservice_io_.

* Double-deletion of vmservice_io kernel file program from
  VmService::LoadForGenPrecompiled / Dart_LoadLibrary /
  LoadKernelProgram and then from DFE::~DFE.

It looks like both of these bugs were introduced in
c7faf2dc6b.

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

Review-Url: https://codereview.chromium.org/3002733002 .
2017-08-16 12:44:44 -07:00
Carlo Bernaschina 491390eeaa Refactor of the GetEmbedderInformation APIs
The embedder can rely on embedded_dart_io to partially fill the
Dart_EmbedderInformation structure with all the process related
information.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2997013002 .
2017-08-16 10:59:27 -07:00
Régis Crelier c29f5dd4f5 [VM DBC compiler and simulator] Support reified generic functions.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2987323003 .
2017-08-16 10:48:07 -07:00
Samir Jindel 6c5d1fba95 [kernel] Support for top-level generic functions.
Summary:

Previously, there was no support for generic methods in kernel. This prevented
us from being able to pass captured type arguments to the target top-level
function in converted closures, so these type arguments were always instantiated
to 'dynamic'.

Now, we save the type arguments to the closure creation operation in the
context, and read them out and forward them appropriately in closure wrapper
function. Since fasta doesn't currently support generic methods (their type
parameters are replaced by 'dynamic'), only top-level generic functions can
surface in kernel, as they are generated by closure conversion of closures that
capture type parameters of a class.

My focus here is enabling closure conversion to work in only these cases, and as
such, the code has some temporary "hacks" in the VM that may not work for
generic member functions or generic closures when they are enabled in fasta.

Test Plan:

I ran all the tests in closures/, and those which were previously expected to
crash due to missing VM support now pass and produce correct results.

Further testing is paused until we understand why the recent commit "[kernel]
Insert kernel bodies into VM heap" has broken all these tests.

Reviewers: regis@google.com, jensj@google.com, dmitryas@google.com

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

Review-Url: https://codereview.chromium.org/2998803002 .
2017-08-16 15:24:26 +02:00
Jens Johansen 3f9d99be50 [kernel] Add fileOffset on FunctionExpression
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/3000023002 .
2017-08-16 12:10:11 +02:00
Alexander Aprelev a9afb54d6d Revert "Revert "Introduce IKG into kernel-service to support incremental compilation.""
This reverts commit c35510d835
with fix for the build - remove implicit temporary array in TestCase::LoadTestScript.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2998963002 .
2017-08-15 09:03:48 -07:00
Beeravolu Siva Chandra Reddy ab6d7bba53 Fix stepping in when paused in async functions.
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2994983002 .
2017-08-15 14:14:11 +02:00
Zachary Anderson 734beef062 [infra] Translate _sources.gypi files to _sources.gni files
Also deletes code that becomes dead as a result.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2996903002 .
2017-08-14 21:54:36 -07:00
Carlo Bernaschina 0cbbeeb288 Restore "Add current rss and embedder name to Observatory"
Made benchmark_test.cc independent from Service by using the
implementation of MaxRSS from bin::Process

Related https://github.com/dart-lang/sdk/commit/ce736d3ef009bf334a92d5b7d354fc0b04805b4f

R=bkonyi@google.com
TBR=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2994223002 .
2017-08-14 17:02:30 -07:00