Commit Graph

8878 Commits

Author SHA1 Message Date
Alexander Markov 28793ea130 [VM] Add option to print precompiler entry points
Change-Id: Ieba8d086e34e669c0789db96ddbb00932a764cfa
Reviewed-on: https://dart-review.googlesource.com/18511
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-07 19:41:09 +00:00
Vyacheslav Egorov b2721473aa [VM,Kernel] Report an error on import of dart:mirrors when mirrors are disabled
Otherwise VM simply crashes further down in the pipeline.

Update corelib/apply3_test status to match this change.

R=kustermann@google.com

Bug:
Change-Id: Iffb4d2bc7e513d5a79123b029f7ea7c4e1033056
Reviewed-on: https://dart-review.googlesource.com/19003
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-11-07 15:37:09 +00:00
Vyacheslav Egorov fe7a9e27a3 [VM,Kernel] Fix IR produced by StreamingFlowGraphBuilder::BuildAssertStatement.
On the otherwise path it was producing a block that ended with a call. Such IR
is invalid because blocks can only end with control flow instructions, like
Branch, Goto, Return or Throw.

Bug:
Change-Id: I67971fba00c01f1e063ac584abfa6aec2ea376d9
Reviewed-on: https://dart-review.googlesource.com/19004
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-11-07 14:44:39 +00:00
Erik Corry f607a2edae [VM] Don't try to disassemble Stop pseudoinstruction
R=zra@google.com

This was causing crashes on OSs that place constant strings at high
addresses.
Bug:
Change-Id: Id61c6c7e817a7bb44fdc998f5b918e61b971153a
Reviewed-on: https://dart-review.googlesource.com/18546
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2017-11-06 23:28:20 +00:00
Paul Berry 23d3baddb6 Update source fingerprints for min and max functions.
This should fix debug build failures after 3e85ad23cf.

Change-Id: I05797004359bb88007077b5176aaa9499a2162bc
Reviewed-on: https://dart-review.googlesource.com/18519
Reviewed-by: Alan Knight <alanknight@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-11-03 23:12:34 +00:00
Siva Chandra 3289dd2bff Move the kernel offset fields under !defined(DART_PRECOMPILED_RUNTIME).
Also added the missing reading/writing of kernel offsets of libraries
and patch classes in raw_object_snapshot.cc.

Fixes #31258 and #29850.

Change-Id: I7d22ccda9dd1ded9ad1f0963da33bce3975b84ba
Reviewed-on: https://dart-review.googlesource.com/18400
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-03 23:01:40 +00:00
Ryan Macnak f3c32edc1d [vm, reload] Don't report typedefs as unused.
Bug: https://github.com/flutter/flutter/issues/12868
Change-Id: Ibf0a97f918763abc0e0667be6d2ee2bda9e073fa
Reviewed-on: https://dart-review.googlesource.com/18514
Reviewed-by: Alexander Aprelev <aam@google.com>
2017-11-03 20:55:56 +00:00
Ryan Macnak 32a02404c9 [vm, gc] Bitvector-based sliding compactor.
With the current block size, this reduces space for forwarding information from two words per moved object to two words per (kObjectAlignment * kBitsPerWord) bytes of heap (1.6% on 64-bit, 3.1% on 32-bit).

dart2js compiling dart2js:
Compactor/Sweeper             Runtime  Max RSS
Sliding (binary search table) 105   s  1.085 GB
Sliding (bitvector)            57.8 s  998.566 MB
Evacuating                     66.2 s  1.714 GB
Concurrent sweep               53.8 s  1.183 GB
Blocking sweep                 55.0 s  1.181 GB

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Ia6eec4f0162c3959154c5155df24cc06694ecac7
Reviewed-on: https://dart-review.googlesource.com/17721
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-11-03 19:38:55 +00:00
Alexander Markov 172786b906 [VM] Extract simple JSON writer out of VM service-specific JSONStream
The purpose of this refactoring is to provide a convenient way to
write JSON independently of VM service, which is excluded in PRODUCT
build mode.

Change-Id: I55700d9ead6ef9269a98714d8178f1edb35435cb
Reviewed-on: https://dart-review.googlesource.com/18502
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-11-03 18:31:50 +00:00
Ryan Macnak 8753545178 [vm] Document ownership of Dart_CreateIsolate's error message.
Change-Id: Icab6f6d169445f66b6ba9469511164e6e21ef49a
Reviewed-on: https://dart-review.googlesource.com/18425
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-03 18:10:53 +00:00
Ryan Macnak f60efb7e40 Reapply "[vm] Popcount via compiler intrinsics."
Add missing rename of CountOneBits in ARM assembler.

Change-Id: I735da06343248573a1b049109ebc2bf0d1634960
Reviewed-on: https://dart-review.googlesource.com/18504
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-03 17:39:16 +00:00
Ryan Macnak 2761c556ca Revert "[vm] Popcount via compiler intrinsics."
This reverts commit c4f4cdbf29.

Reason for revert: ARM compile-time errors

Original change's description:
> [vm] Popcount via compiler intrinsics.
> 
> Change-Id: I8913beea7b984f04cec7f9efc00673aa12095eda
> Reviewed-on: https://dart-review.googlesource.com/18423
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=rmacnak@google.com,zra@google.com

Change-Id: I5efe8100e3c1fa404b1c24f369dca5c137acd2b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/18640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-11-03 16:50:47 +00:00
Ryan Macnak c4f4cdbf29 [vm] Popcount via compiler intrinsics.
Change-Id: I8913beea7b984f04cec7f9efc00673aa12095eda
Reviewed-on: https://dart-review.googlesource.com/18423
Reviewed-by: Zach Anderson <zra@google.com>
2017-11-03 16:34:35 +00:00
Peter von der Ahé b4dcb76518 Read patch files directly when building legacy platform files.
Change-Id: Ib2e614b676021660c6a053dfc59f639c004279b9
Reviewed-on: https://dart-review.googlesource.com/18520
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-11-03 12:43:50 +00:00
Ryan Macnak 702430718b [vm, reload] Don't report changes to synthetic classes introduced during mixin application.
In particular,

class S {}
class M {}
class MA extends S with M {}

=>

class S {}
class M { newFunction() => 42; }
class MA extends S with M {}

Should not report class S&M nor S&M.newFunction.

Bug: https://github.com/dart-lang/sdk/issues/31265
Change-Id: Iaca4facd68315e1f2921cd2af666608f3e1aa695
Reviewed-on: https://dart-review.googlesource.com/18149
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-11-02 22:49:00 +00:00
Martin Kustermann 08408affa3 [VM] Enable recognized method inlining in CallSiteInliner again with fix
Change-Id: I4f0f92231530f10e054ebb04606df96a00366812
Reviewed-on: https://dart-review.googlesource.com/17940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2017-11-02 10:46:18 +00:00
Ryan Macnak 8ed836fd6d [vm] Factor out the image snapshot code.
Prep for aligning image pages.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: I5abd5d73ac9fed427942218a827e144fc74593de
Reviewed-on: https://dart-review.googlesource.com/18121
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-02 00:57:42 +00:00
Martin Kustermann 19ac48da44 [VM] Disable recognized method inlining in CallSiteInliner (after enabling it recently)
It appears like the manual flow graph building code for
MethodRecognizer::kObjectRuntimeType is wrong and was exposed by
enabling it recently.
Change-Id: Ia4be8c4bc7c3342e0cdf1cb8b270dc48b5f2fde4
Reviewed-on: https://dart-review.googlesource.com/17920
Reviewed-by: Martin Kustermann <kustermann@google.com>
2017-11-01 16:15:12 +00:00
Martin Kustermann 56050f47fb [VM] Let FlowGraphTypePropagator know that LinkedHashMap.index is kTypedDataUint32ArrayCid
Now that we do eager rehashing of linked hashmaps we no longer have the
index field be `null` (which in the past signaled we needed rehashing).

This means we can teach the optimizer that loads from the index fied
always result in kTypedDataUint32ArrayCid.

Change-Id: Ic012881c12b2310a6337696521fa1355afd4069f
Reviewed-on: https://dart-review.googlesource.com/17447
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-01 15:52:14 +00:00
Martin Kustermann bf9dd5342f [VM] Inling recognized methods even without speculation in some cases
Change-Id: I40df1c7f89952463a15fc43f24cd8925047717cf
Reviewed-on: https://dart-review.googlesource.com/17446
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-01 15:11:24 +00:00
Martin Kustermann 8d043ccb89 [VM] Use TryReplaceStaticCallWithInline also in the normal inlining path
Previously we would sometimes build specifically hand-crafted flow graph
code for recognized methods and sometimes let the normal flow graph
builder do it (depending on whether inlining was triggered via
[CallSiteInliner] or [CallSpecializer]).

This CL makes us use the hand-crafted flow graph building for recognized
methods in both cases.

Change-Id: I58405b16adca810fd7ccff32027b9d4a13858976
Reviewed-on: https://dart-review.googlesource.com/17445
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-01 13:55:01 +00:00
Martin Kustermann 239f45b5ca [VM] Combine use_speculative_inlining/inlining_blacklist into SpeculativeInliningPolicy
Change-Id: I20a1354842d825ed1df0a19de57405a6d4041bd8
Reviewed-on: https://dart-review.googlesource.com/17444
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-01 11:06:00 +00:00
Jens Johansen c8e51ef922 [kernel] Add offset to this[i] and super[i]
Bug:
Change-Id: Ic65b69c4977be834c7b69638d6c030727c7210e5
Reviewed-on: https://dart-review.googlesource.com/17441
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-11-01 09:57:00 +00:00
Siva Chandra af44a37c1a Move the kernel_offset_ field of RawClass out of !DART_PRECOMPILED_RUNTIME.
Change-Id: I18b160955f7a690bf6c336cf328ef3ede24dca8d
Reviewed-on: https://dart-review.googlesource.com/17760
Reviewed-by: Siva Chandra <sivachandra@google.com>
2017-11-01 06:25:02 +00:00
Siva Chandra fe2fa9e61f Do no write/read class' kernel offset for full AOT snapshots.
Change-Id: I736a9294c47f9b069ca87c910665f3d6275d3a5e
Reviewed-on: https://dart-review.googlesource.com/17740
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Chandra <sivachandra@google.com>
2017-10-31 22:37:36 +00:00
Alexander Markov c84e2968ac [VM] Avoid dynamic call in _Double.==
Change-Id: Iab301370f33c375db1cd52f8eb87500955dfab09
Reviewed-on: https://dart-review.googlesource.com/17722
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-10-31 22:01:09 +00:00
Alexander Markov 6505994d58 [VM] Correct return type of _setHash
Change-Id: I3f02d584d30fc7a2f3bd93858eaf77abe3c9f5b7
Reviewed-on: https://dart-review.googlesource.com/17720
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-10-31 22:01:08 +00:00
Siva Chandra 9f0175059e Load class members lazily when loading from kernel.
This change brings down core snapshot size by ~750KB, and brings
down app-jit snapshot size of simple "Hello, World" dart script by
~650KB. The bot cycle times will also come down by around ~20%.

Change-Id: I2a01c98bedc7ebfa2a653983995486a71504daf3
Reviewed-on: https://dart-review.googlesource.com/16323
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2017-10-31 19:19:25 +00:00
Régis Crelier 9b14a361a8 [VM] Address more TODOs related to generic functions.
Remove parsing support for 'super' that was meant to declare lower bounds of
function type parameters, since this feature did not make it into the spec.

Change-Id: I4087d0e108c5984437083a05a065fe785888d2f7
Reviewed-on: https://dart-review.googlesource.com/17360
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-31 17:55:26 +00:00
Zachary Anderson 9ab8b55663 [gn] Split target arch/os defines from dart_config
This is a baby-step towards building an SDK targeting the host arch
during a cross-build. This will require a similar update to the use
of dart_config in the Flutter engine at //flutter/lib/io/BUILD.gn:19.

Change-Id: I8b871cceb53038cab8407264664c5ce545e6e010
Reviewed-on: https://dart-review.googlesource.com/17523
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-31 17:33:13 +00:00
Erik Corry d0abf73d12 [VM] Add bt immediate instruction for IA32, X64
R=vegorov@google.com

Bug:
Change-Id: I89640ac207877c7b564b6e9713ee72895ca02054
Reviewed-on: https://dart-review.googlesource.com/17443
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2017-10-31 17:06:55 +00:00
Martin Kustermann 55dbd3843e [VM] Add TransitionNativeToVm scopes into vm_tests
Change-Id: Ia8bce60c5d4ad4e3848c418aaf5e6bf588ad30c4
Reviewed-on: https://dart-review.googlesource.com/17500
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2017-10-31 15:46:43 +00:00
Martin Kustermann 84dbb6e0b6 [VM] Do eager rehashing of [LinkedHashMap]s in order to avoid checking on every access
This improves 
  * JIT performance by around 14% 
  * precompiled performance by around 2%
on a simple map microbenchmark.

Change-Id: I623e2a715a709f89f2514ae30fbb504ee2e31661
Reviewed-on: https://dart-review.googlesource.com/17165
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-31 13:42:15 +00:00
Martin Kustermann b7627da50b [VM] Clone metadata from methods when copying functions into mixin application classes
This allows the normal VM metadata lookup code to find metadata attached
to members which come from mixed-in classes.

This allows e.g. putting a @AlwaysInline / @NeverInline annotation on
methods of mixin classes.

Change-Id: I70639dc78fc5bab98ac7cee107c2042f84d07888
Reviewed-on: https://dart-review.googlesource.com/17164
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2017-10-31 12:23:35 +00:00
Erik Corry c140bb7edd [VM-GC] Reduce duplicated code in visit functions.
Also starts to introduce some distinctions that will be needed for
compressed pointers (easy to rip out if for some reason we decide
against them).

R=rmacnak@google.com

Bug:
Change-Id: I36df2f75220ec56decb991df6c3352f8dc6b407a
Reviewed-on: https://dart-review.googlesource.com/17220
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-31 10:42:25 +00:00
Ryan Macnak b247090c9e [vm] Align old-space pages.
Allows quick access to the page header for any old-space object, which is a convenient place to keep forwarding information.

Also combine the reserve and commit operations of VirtualMemory.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Id3fe06932f7bef882bb1cc29d72441b0a3602eb6
Reviewed-on: https://dart-review.googlesource.com/17046
Reviewed-by: Erik Corry <erikcorry@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-30 22:02:20 +00:00
Samir Jindel cde1996372 [kernel] Produce type error for 'AsExpression's marked as such.
Bug:
Change-Id: I0c6ecc619f202867d17f5fbb28af0ef9dbc40d08
Reviewed-on: https://dart-review.googlesource.com/17260
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-30 18:05:04 +00:00
Ryan Macnak c250af2839 [vm, arm64] Prefer BranchIfSmi over tsti + b.
This does not change the generated instructions, but makes is easier to try tbz.

Change-Id: I0914c241149ca21b6797283630dcf645bc53dbde
Reviewed-on: https://dart-review.googlesource.com/17048
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-10-27 22:03:50 +00:00
Jens Johansen 07b6ec3425 [kernel] Allow VM to load concatenated dill file
The kernel format has been designed so that one can concatenate several
dill files into one file and then load it. For instance the dart
function BinaryBuilder.readProgram supports this.

Currently a dill file contains one or more programs.
In the VM each of these programs are called either program or subprogram.
Technically a dill "program" isn't necessarily a program at all (e.g. it
could be missing a library).
This naming snafu should probably be cleaned up at some point, but that's
for another CL.

When loading a dill file via BinaryBuilder.readProgram what happens is
this:
- Each program in the dill file ends in 4 bytes that indicates the size
  of the program.
- Reading the input from the end one can then read the size, skip back
  that amount of bytes, if we have more data (i.e. there's another
  program), read another size and so on, and continue until we have
  accounted for all bytes in the input.
- We then read each program from the start, and basically overwrite any
  library, class, procedure etc. we find.
  The first main reference found is the one used though.
  (Saying that we overwrite is not completely true, but when the library
  is a non-external library that's basically what happens).

This CL introduces (some) support on the C++ side for the same thing.
So far the C++ side could only handle single-program-dills, and trying
to load anything else would probably crash the VM.
The support added is this:
- Assume the SDK (i.e. vm_platform.dill) is not a concatenated file
  (error out if it is).
- For user provided input, loop over each contained program one-by-one,
  for each individual one behave as normal.
- The way LibraryLoad is implemented (i.e. it skips if the library is
  already loaded) this means that it currently would behave differently
  than the dart version (i.e. the first one is used, not the last one).
  For now it is assumed that that's not a problem.
- There is a possibly snafu if the same script is included several times.
  This could probably mostly be remedied by not creating scripts up front,
  but only as needed. By the "keep only one" (and fixing the above point,
  probably by simply loading in the opposite order, i.e. last program
  in the binary first) the (theoretical) problem would probably do away.

Note that we will have separate string tables, canonical name tables etc
per "sub program" and that there might be some duplication.

The implementation was tested as indicated below, but introduces no tests.

$ cat test_lib1.dart
import "test_lib2.dart" as lib2;

String lib1field = "lib #1 field!!";

main() {
  foo();
  lib2.foo();
  print("From lib2: ${lib2.lib2field}");
}

foo() {
  print("Hello, Foo, from test_lib1!");
  var x = 42;
  print(x);
}
$ cat test_lib2.dart
String lib2field = "Lib #2 field!!!!";

foo() {
  print("Hello, Foo, from test_lib2!");
  var y = 34;
  print(y);
}

$ out/ReleaseX64/dart pkg/front_end/tool/_fasta/compile.dart --packages=.packages --platform=out/ReleaseX64/vm_platform.dill test_lib1.dart

$ ls -lha test_lib1.dart.dill
[...] 4.2M Oct 26 14:42 test_lib1.dart.dill

$ dart pkg/kernel/bin/split.dart test_lib1.dart.dill
Wrote test_lib1.dart.dill.part1.dill
Wrote test_lib1.dart.dill.part2.dill

$ ls -lha test_lib1.dart.dill.part{1,2}.dill
[...] 811 Oct 26 14:42 test_lib1.dart.dill.part1.dill
[...] 582 Oct 26 14:42 test_lib1.dart.dill.part2.dill

$ cat test_lib1.dart.dill.part1.dill test_lib1.dart.dill.part2.dill > test_lib1.dart.dill.concat.dill

$ ls -lha test_lib1.dart.dill.concat.dill
[...] 1.4K Oct 26 14:44 test_lib1.dart.dill.concat.dill

$ out/ReleaseX64/dart --kernel-binaries=out/ReleaseX64 --packages=.packages test_lib1.dart.dill.concat.dill
Hello, Foo, from test_lib1!
42
Hello, Foo, from test_lib2!
34
From lib2: Lib #2 field!!!!

Change-Id: I233a033aa3042b202dd4708908a5be3089474588
Reviewed-on: https://dart-review.googlesource.com/16820
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-10-27 12:01:48 +00:00
Ryan Macnak 9d93909715 [vm, arm64] Use a branch instead of two predicated moves for loading cids.
Two instructions shorter.

JIT:
MegaFieldHasGetterOnceIndirect (Odroid-C2) 15.97% (0.8 noise)
        MegaOnlyOverriddenOnce (Odroid-C2) 18.96% (0.9 noise)
MegaOnlyOverriddenOnceIndirect (Odroid-C2) 16.94% (1.0 noise)
                  MegaEquality (Odroid-C2) 5.729% (1.2 noise)
        MegaFieldHasGetterOnce (Odroid-C2) 26.56% (1.2 noise)

AOT:
MegaOverriddenEvery2ndIndirect (Odroid-C2) 2.872% (0.4 noise)
             MegaFieldIndirect (Odroid-C2) 3.856% (0.4 noise)
   MegaNeverOverriddenIndirect (Odroid-C2) 5.658% (0.5 noise)
           MegaNeverOverridden (Odroid-C2) 4.278% (0.5 noise)
        MegaOnlyOverriddenOnce (Odroid-C2) 4.966% (0.6 noise)
                     MegaField (Odroid-C2) 6.310% (0.6 noise)
MegaOnlyOverriddenOnceIndirect (Odroid-C2) 6.355% (0.8 noise)

Change-Id: I66c1d3d5b04bfdada0b09bd4bd9e99d19f8eaa56
Reviewed-on: https://dart-review.googlesource.com/16692
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-10-26 19:50:36 +00:00
Ryan Macnak 3d409223a3 [vm] Report a coverage tick for the function as a whole.
This ensures leaf functions have some coverage data.

Bug: https://github.com/dart-lang/sdk/issues/31215
Change-Id: I6efc2e1c002e26cd0483dce5a8a1c2b6d8958d13
Reviewed-on: https://dart-review.googlesource.com/16684
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-26 16:50:30 +00:00
Ryan Macnak d965998d1c [vm] Begin a sliding compactor.
Improves the space overhead of compaction from O(size of live objects) to O(number of live objects).

Future work includes: 
 - a smaller, faster representation the forwarding table via a bitmap of used allocation units
 - sorting class sizes off-heap to allow sliding classes
 - running forwarding in parallel

Removes unnecessary sweep from evacuating compactor.

Change-Id: If0991bfb75573201c6e8feed142ca0cc69fccab4
Bug: https://github.com/dart-lang/sdk/issues/30978
Reviewed-on: https://dart-review.googlesource.com/15988
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
2017-10-25 21:57:08 +00:00
Ryan Macnak 2aac007bed [vm] Mark the synthetic use of completer.completeError in async functions.
Bug: https://github.com/dart-lang/sdk/issues/31222
Change-Id: I4b143ff88b59602f503c7a4d15690a468c577b48
Reviewed-on: https://dart-review.googlesource.com/16605
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-25 21:02:16 +00:00
Vyacheslav Egorov 2c97d724df [VM, JIT] Lower CloneContext into AllocateUninitializedContext.
CloneContext is implemented as a runtime call so it is considerably slower
than AllocateContext which leads to performance issues in loops that capture
iteration variables in for loops.

Lowering CloneContext into AllocateUninitializedContext and a sequence of
explicit load&store instructions both improves the performance by avoiding
the runtime call and also makes CloneContext semantics exposed to store-load
forwarding and allocation sinking.

PutIfAbsent benchmark from issue #31113 is improved by 5x, while 
ForInGeneratedLoop benchmark is improved by 8x.

Bug: https://github.com/dart-lang/sdk/issues/31113
Change-Id: I03fdede75f1a85fda92487aa8f9307ce06f23903
Reviewed-on: https://dart-review.googlesource.com/16280
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-10-25 11:09:29 +00:00
Samir Jindel 55eb75d56f [kernel] Delay type finalization when parsing function types.
Currently, the Kernel FE doesn't set up parent pointers correctly for
signature function types. This prevents type parameters on generic
function types from being finalized correctly. In addition, finalization
of generic interface types within a generic function type can crash if they
reference not-yet-finalized type parameters of the enclosing function type.

This review solves both issues. Several failing tests pass again, although
more thorough testing is blocked on Github issue #31213 (nested generic function
types crashing in Fasta).

Bug:
Change-Id: Ib5ee6b2566492e3fd6688fe5a6b6976692562ea1
Reviewed-on: https://dart-review.googlesource.com/16360
Reviewed-by: Régis Crelier <regis@google.com>
2017-10-25 10:36:57 +00:00
Régis Crelier 61251c2c4e [VM] Ensure that the constant right-hand side of operator ?? is canonicalized (fixes #31066).
Add regression test.

Change-Id: I48f33b91b75f372e14ed5aa9185e79e105307573
Reviewed-on: https://dart-review.googlesource.com/16330
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2017-10-24 23:50:09 +00:00
Ryan Macnak 107e92d11c Revert "[vm] Tighten stack overflow check in the parser."
This reverts commit eebbac4d78.

Reason for revert: Crash on ASAN bots

Original change's description:
> [vm] Tighten stack overflow check in the parser.
> 
> A recent change increased the accuracy of the stack limit used in the stack overflow check. This allowed the parser to complete some example programs that previously tripped the limit, but the flow graph builder or optimizer (depending on mode) then experienced the overflow. Rather than sprinkle checks throughout the compiler pipeline, we now flag an error in the parser based on the amount of nesting instead of amount of call stack used.
> 
> Bug: https://github.com/dart-lang/sdk/issues/31158
> Change-Id: I794e484d736e61499fe6812cf25185ce097bcdd8
> Reviewed-on: https://dart-review.googlesource.com/15651
> Reviewed-by: Zach Anderson <zra@google.com>

TBR=rmacnak@google.com,zra@google.com

Change-Id: I232d929b24c54191d6688530c6f4c59dcccb5890
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/31158
Reviewed-on: https://dart-review.googlesource.com/16400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-24 23:08:09 +00:00
Ryan Macnak eebbac4d78 [vm] Tighten stack overflow check in the parser.
A recent change increased the accuracy of the stack limit used in the stack overflow check. This allowed the parser to complete some example programs that previously tripped the limit, but the flow graph builder or optimizer (depending on mode) then experienced the overflow. Rather than sprinkle checks throughout the compiler pipeline, we now flag an error in the parser based on the amount of nesting instead of amount of call stack used.

Bug: https://github.com/dart-lang/sdk/issues/31158
Change-Id: I794e484d736e61499fe6812cf25185ce097bcdd8
Reviewed-on: https://dart-review.googlesource.com/15651
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-24 21:38:46 +00:00
Samir Jindel 6b64aa8943 [kernel] Always disable reified generic functions in the Kernel FE.
Currently, we have some tests that run with reified generic functions ON and
some with it OFF. However, this causes inconsistencies when running the Kernel
FE from snapshot in the VM, since the VM requires that the flag be consistent
with the snapshot. Our solution is to turn the reified generic functions flag
into a per-isolate flag, which is always disabled in the Kernel FE's isolate.

Bug:
Change-Id: Ia91e9f0ff5fc059edf4bdbd79ef14abb288b4a49
Reviewed-on: https://dart-review.googlesource.com/16020
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-24 15:21:28 +00:00
Vyacheslav Egorov eaf97656e9 [VM] Fix DEBUG mode builds broken by 4985165e76
Initialize ObjectStore fields using OBJECT_STORE_FIELD_LIST instead 
of enumerating them by hand.

Change-Id: Iaf13104380d0ea08d25a19d5f886eb56f3a3ff17
Reviewed-on: https://dart-review.googlesource.com/16260
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2017-10-24 12:55:25 +00:00