Commit graph

16608 commits

Author SHA1 Message Date
Teagan Strickland 7f74ed5e4c [gardening] Only check these asserts if we're producing ELF.
Change-Id: Iec753baaef453d8d5bee80aad6314e5490a6c5ce
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129282
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-12-20 13:38:30 +00:00
Samir Jindel c486154ae0 [vm/aot] Inline == in AOT against nullable receiver.
Fixes https://github.com/dart-lang/sdk/issues/39809

Flutter Gallery ARM32: -0.51% instr, -0.43% total
Flutter Gallery ARM64: -0.44% instr, -0.37% total

Change-Id: Idd29f67eaf588bb5895c356555882efae50494cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128584
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-20 12:33:50 +00:00
Clement Skau 886615d0f9 [SDK] Switch to is_sync to identify sync/async running.
This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-20 11:07:10 +00:00
Teagan Strickland 4774141425 [vm/compiler] Generate debugging info during single snapshot pass.
Previously when --save-debugging-info=<...> was used when not
compiling to ELF, we generated the requested snapshot format
and the separate debugging information as two separate snapshot
generation passes. However, we want to avoid this, to remove the
assumption that instruction snapshot serialization must be
deterministic.

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

Also allows --strip to be used with --snapshot-kind=app-aot-assembly,
so that DWARF sections are not output in the generated assembly code.

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

Change-Id: Ibdf1f5c771bae21870af252b38e64250fde53603
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128735
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-20 10:14:10 +00:00
Régis Crelier b92fefdfe9 [VM/nnbd] Pass nnbd mode from compiler via generated code or bytecode to runtime functions performing type checks or type reification.
This continues the work started in https://dart-review.googlesource.com/c/sdk/+/124105
The nnbd mode is now part of the type arguments instantiation cache,
since the resulting vector depends on the mode.

Change-Id: I803c07fa9473024557db8585e87286f16681169a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128307
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2019-12-20 03:26:29 +00:00
Fizaa Luthra 4dd9734b96 [dartfuzz] Disable stopwatch
Change-Id: I5fac0d3538ef6428bd9e90260032c69d89bb5679
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129204
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-12-20 01:19:57 +00:00
Sigmund Cherem 561e8242ce Support building under git-worktree
This makes the location of the `.git` folder a GN argument, so it
can be configured differently when using git-worktree.

See sdk_args.gn for documentation on how to use this.

Fixes #33619 (http://dartbug.com/33619)



Change-Id: Ia8144f401c462a6fbb91a965979949f286b04d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127485
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-12-19 23:12:53 +00:00
Fizaa Luthra 141fcfa610 [dartfuzz] Adding fuzzing support for more core types
Change-Id: Id377a58a54cb17cb3e7e337efb9de01d237aa5a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128766
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-12-19 22:21:13 +00:00
Alexander Markov fbc57b8b13 [vm/compiler/arm] Fix assertion !stub.InVMIsolateHeap() at il_arm.cc:4650
After dab60b485c we decide to use shared
slow path for BoxInt64Instr based on FLAG_use_bare_instructions.
However, even in --use_bare_instructions mode we might be compiling
something before VM isolate stubs are replaced with isolate-specific
stubs. In such case we shouldn't use shared slow path as
BoxInt64Instr::EmitNativeCode generates PC-relative call to the stub.

This change fixes the assertion

../../runtime/vm/compiler/backend/il_arm.cc: 4650: error: expected: !stub.InVMIsolateHeap()
 version=2.8.0-edge.dab60b485ca4544d58970d9be299d5aaf78cf9e5 (Thu Dec 19 17:29:12 2019 +0000) on "linux_simarm"
 thread=28698, isolate=isolate(0x5640171cd800)
   pc 0x000056401446060c fp 0x00007ffec2747190 dart::Profiler::DumpStackTrace(void*)
   pc 0x00005640141d23b2 fp 0x00007ffec2747270 dart::Assert::Fail(char const*, ...)
   pc 0x00005640145fa85d fp 0x00007ffec2747300 out/DebugSIMARM_X64/gen_snapshot+0xa1285d
   pc 0x00005640145b35b6 fp 0x00007ffec2747470 dart::FlowGraphCompiler::VisitBlocks()
   pc 0x00005640145bfd94 fp 0x00007ffec27474a0 dart::FlowGraphCompiler::CompileGraph()
   pc 0x000056401454aa07 fp 0x00007ffec2747af0 dart::PrecompileParsedFunctionHelper::Compile(dart::CompilationPipeline*)
   pc 0x000056401454cf3f fp 0x00007ffec2747d00 out/DebugSIMARM_X64/gen_snapshot+0x964f3f
   pc 0x000056401454765e fp 0x00007ffec2747da0 dart::Precompiler::CompileFunction(dart::Precompiler*, dart::Thread*, dart::Zone*, dart::Function const&)
   pc 0x0000564014470016 fp 0x00007ffec2747de0 out/DebugSIMARM_X64/gen_snapshot+0x888016
   pc 0x000056401446d72c fp 0x00007ffec2747e70 dart::ProgramVisitor::VisitClasses(dart::Visitor<dart::Class>*)
   pc 0x000056401446d9f3 fp 0x00007ffec2747f00 dart::ProgramVisitor::VisitFunctions(dart::Visitor<dart::Function>*)
   pc 0x000056401453e474 fp 0x00007ffec27480c0 dart::Precompiler::DoCompileAll()
   pc 0x000056401453e245 fp 0x00007ffec27484b0 dart::Precompiler::CompileAll()
   pc 0x00005640149c60eb fp 0x00007ffec2748570 Dart_Precompile
   pc 0x00005640141a7a5f fp 0x00007ffec27486f0 dart::bin::main(int, char**)
 -- End of DumpStackTrace

in debug mode.

Change-Id: I5095e8def7b3d8067423455f32bce5aea1e0c381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129141
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-19 21:14:42 +00:00
Alexander Markov dab60b485c [vm/compiler/arm] Fix crashes related to BoxInt64 with --no-use-bare-instructions
BoxInt64Instr::MakeLocationSummary pretended that it is using shared
slow path, but it was not actually used in --no-use-bare-instructions mode.
As a result, BoxInt64Instr slow path pushed only live registers, but
stack map was generated for all registers. This caused various crashes,
mostly in GC.

The fix is to correctly create LocationSummary with kCallOnSlowPath
instead of kCallOnSharedSlowPath if we're not going to use shared
slow path (if --no-use-bare-instructions is specified).

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

Change-Id: Iaba7cd7d88143f2621a007c8559b932bb171de4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129004
Reviewed-by: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-19 17:29:12 +00:00
Liam Appelbe 730191fcbd [vm] Implement nullability check in type equality intrinsic
I'm not able to write a test for this yet, but I manually verified that
it's doing the kLegacy -> kNonNullable mapping correctly, on all 4
architectures.

Bug: https://github.com/dart-lang/sdk/issues/39755
Change-Id: I8d1b014c4d4d067fd55e96166b19015d50c9cc6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128982
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-19 16:55:23 +00:00
Samir Jindel f134164332 [vm] Enable multiple entry-points on ARM64.
Adresses https://github.com/dart-lang/sdk/issues/34162

Change-Id: I7126f8c9b470041aaa260255293327f67d64d1bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128063
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-19 16:41:24 +00:00
Victor Lima 302184f840 [vm/precomp] Enable unbox_numeric_fields flag for AOT
This change stops seting unbox_numeric_fields flag to false in AOT.

It also sets the speculative mode to be non speculative for store
unboxed fields instructions in AOT, since unboxing is done based on TFA.

Change-Id: Ic7a6391f8569e22eea13128251d83d109b06083c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127884
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-19 15:12:52 +00:00
Victor Lima 7a1c91bda9 [vm/precomp] Inline SIMD operations
This CL is responsible for inlining Float32x4 and Float64x2 arithmetic
operations in order to reduce their run-time cost.

Null-checks were required in order to allow the unbox instructions to
be non-speculative.

CheckNullInstr was modified to throw ArgumentError when checking
arguments for those operations.

Change-Id: I18b36d96a36011647480f301eb6dc6bb478f59a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128589
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-12-19 15:09:32 +00:00
Jens Johansen 8d11c1dce6 [kernel][vm] Add uris only from mixins to libraries sourceReferences
index to fix VMs coverage issue

This CL fixes the VM not always reporting coverage for mixin usages
properly.

* When asking the VM for coverage you can do it in one of two ways
  * Ask the VM for coverage for everything; or
  * Ask the VM for coverage for a specific script
* Asking the VM for coverage for everything works perfectly fine.
  The VM goes through everything and reports coverage correctly.
* Asking the VM for coverage for a specific script (which is, at least
  now, what the flutter tools does) doesn't work in the simple mixin
  case described at http://dartbug.com/39779: The VM goes through the
  libraries, asking for the list of scripts they "know about",
  and checks for matches against what you asked for.
  In this case, when asking for 'master.dart', the library for
  'lib.dart' says no when it shouldn't --- because of the way the mixin
  transformation works the content is actually in lib.dart.

This CL updates the content of the field 'sourceReferences' on Library
to fix the issue.


Fixes #39779

Change-Id: I0c38a323c81d1784ade704837b67ece549fc95d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128585
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-19 06:59:28 +00:00
Jason Simmons 09ecfca470 [observatory] Use month numbers ranging from 1-12 in the timeline default filename
Change-Id: I6184efa1e4d7d64e3f0fc4def14587898d29601a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128983
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2019-12-18 23:17:11 +00:00
Samir Jindel f8200991d7 [vm] Remove redundant type-tests from min/max.
MinLib: 4% improvement
MaxLib: 10% improvement

Change-Id: I26459d5cefdbeaa8af3d9e226b401e12eace9ca2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128883
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-12-18 22:33:21 +00:00
Fizaa Luthra aaff5b6951 [dartfuzz] Put gen_api_table.dart constants in alphabetical order
Change-Id: I07506be86e49cd8aaa4fcbe934cb8b706bf677c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-12-18 22:14:31 +00:00
Alexander Markov 7ddf3532de [vm/bytecode] Cleanup support for old versions of bytecode format
This change removes support for all bytecode format versions up to the
current version (27) from the VM.

Version 27 landed Nov 15 2019 in 329d0913ca.

Change-Id: I6af2851543fbb7119bd4b22759f9f05e8c2517dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128940
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-18 19:40:16 +00:00
Alexander Aprelev 0cc27b5db0 Reland "[vm, linux] Try to attach names to all VirtualMemory allocations using memfd."
This reverts commit 4dee4bd204 as it now has the fix for precompiled flow in patchsets 3, 7.

Change-Id: Ib99763a91073df7698e8b597a67e11e557fc131e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128574
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-18 18:02:41 +00:00
Samir Jindel 23bc053b0e [vm] Don't require inputs to be _Smi in InlineByteArrayBaseStore in AOT.
Fixes https://github.com/dart-lang/sdk/issues/39236

Change-Id: I0fe8899021d125d47b06b97a87813c18b31665e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128060
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-12-18 17:30:01 +00:00
Teagan Strickland 64e256f7ce [vm] Reland "Weaken dwarf_stack_trace expected stack trace."
We only check the expected stack starting from the call to
foo in main, so we no longer depend on what is captured in
the stacktrace for how main is invoked.

Also removes the old status lines for this test, which are no
longer applicable, and cleans up the documentation a little.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try
Change-Id: I66746f5a5169bce425bfd1f01a6a912b062e99c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128737
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-12-18 16:11:41 +00:00
Samir Jindel 270966b160 [vm] Fix Fuchsia build of elf_loader.
Change-Id: Ic48821bece19db81d1fa47c47ebfe433b9a577be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128736
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-12-18 14:37:06 +00:00
Teagan Strickland d922945601 [vm] Reland "Add docs for DWARF stack traces and related tools/libraries."
Bug: https://github.com/dart-lang/sdk/issues/35851
Change-Id: Iae4bb32fd8fc2770277cfc0b7961ff89e5928b29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128733
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 14:14:41 +00:00
Teagan Strickland e835e7013b [vm] Reland "De-obfuscate function and file names in DWARF sections."
Note that when generating unstripped ELF snapshots with --obfuscate,
this means DWARF sections in the resulting snapshot will leak
otherwise obfuscated information. To avoid this, use both --strip
to strip the generated snapshot and --save-debugging-info=<...> to
save the unobfuscated DWARF information to a separate file.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I545a737bd58fcd99c329386a552bd8951acf38b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128732
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 14:14:41 +00:00
Teagan Strickland 089aeedf56 [vm/compiler] Reland "Add --save-debugging-info flag to gen_snapshot."
Removes an unnecessary change to the names of type testing stubs that
allowed name collisions to happen.

Old commit message:

The flag can be used when creating AOT snapshots. The resulting file can be
used with package:vm/dwarf/convert.dart to convert DWARF-based stack traces
to stack traces with function, file, and line number information.

Currently the saved file will be an ELF file with DWARF debugging information,
but this is subject to change in the future. To avoid being affected by any
changes in format, read the DWARF information from the file using
Dwarf.fromFile() in package:vm/dwarf/dwarf.dart.

Also adds --dwarf-stack-traces to the VM global flag list, so its value at
compilation will be read out of snapshots by the precompiled runtime.

Fixes https://github.com/dart-lang/sdk/issues/39512, which was due to
a missing compiler::target:: prefix for Instructions::HeaderSize() in
BlobImageWriter::WriteText().

Exposes the information suggested in
https://github.com/dart-lang/sdk/issues/39490 so that package:vm/dwarf
can appropriately convert absolute PC addresses to the correct virtual
address for a given DWARF line number program.

Bug: https://github.com/dart-lang/sdk/issues/35851
Change-Id: I6723449dceb0b89c054a1f1e70e7acd7749baf14
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128730
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 14:14:41 +00:00
Clement Skau 6fcd1de98c [SDK] Fixes missing stack trace line numbers.
CodeSourceMapBuilder::NoteDescriptor(..) would previously only emit
CSM entries if its stack_traces_only_ flag was set, which
FlowGraphCompiler would only do if compiled in PRODUCT mode:
runtime/vm/compiler/backend/flow_graph_compiler.cc:162

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I78c56a18a5a95ef3c8c37a2d7eae6ab612e6674f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127464
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 10:34:41 +00:00
Clement Skau 3764928769 [SDK] Switch to isSync to determine if async func. is running sync-async.
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I1e23a726bf0fbff2c02891e25c714ea599330c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128666
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 08:57:00 +00:00
asiva 8a4cac1ddb Reverting a chain of commits related to debug info splitting.
REASON: the first commit in the chain contains a change that breaks internal
Flutter roll due to duplicated symbols for type testing stubs in assembly
snapshots.

Revert "[vm/compiler] Add --save-debugging-info flag to gen_snapshot."

This reverts commit c2b6c2e1db.

Revert "[vm] De-obfuscate function and file names in DWARF sections."

This reverts commit 4b8fd3c412.

Revert "[vm] Add docs for DWARF stack traces and related tools/libraries."

This reverts commit 5543e5ceb8.

Revert "[vm] Weaken dwarf_stack_trace expected stack trace."

This reverts commit 5824d3ed53.

Change-Id: I95ecd16fe493f61ae761dabfdd91a6ec0c2f0ca3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128776
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-12-18 01:02:05 +00:00
Liam Appelbe 44da51fc72 [vm] More fast paths in type equality intrinsic
Change-Id: I2a5b02c6803b15226ec4bdcab698043252500413
Bug: https://github.com/dart-lang/sdk/issues/39755
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128005
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-12-17 20:39:14 +00:00
Clement Skau 8d74f6ee4a [SDK] Adds function name to CodeDescriptor dumps.
This makes --disassemble output more uniform (as other dump sections already
print their function names), and makes it easier to grep through:

Example output:

Code for optimized function 'dart:core__AbstractType@0150898__AbstractType@0150898.' {
[...]
}
Source positions for function 'dart:core__AbstractType@0150898__AbstractType@0150898.' {
[...]
}
PC Descriptors for function 'dart:core__AbstractType@0150898__AbstractType@0150898.' {
pc                      kind            deopt-id        tok-ix  try-ix  yield-idx
empty PcDescriptors
}
Code for optimized function 'dart:core__ImmutableMapKeyIterable@0150898__ImmutableMapKeyIterable@0150898.' {
[...]
}

Change-Id: I76957e0105a39e47d59d3166dfae6d4593ebd86a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128588
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-17 13:40:16 +00:00
Clement Skau 4dee4bd204 Revert "[vm, linux] Try to attach names to all VirtualMemory allocations using memfd."
This reverts commit f5e57f89d2.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
> 
> For example,
> 
> $ cat /proc/<pid>/smaps
> ...
> 7fd2ad2e0000-7fd2ad2f0000 rw-s 00000000 00:05 15576579 /memfd:dart-zone (deleted)
> 7fd2b2b7f000-7fd2b2d7f000 rw-s 00000000 00:05 15695692 /memfd:dart-newspace (deleted)
> 7fd2b2f00000-7fd2b2f80000 r--s 00000000 00:05 15695687 /memfd:dart-codespace (deleted)
> 7fd2b2f80000-7fd2b3000000 r--s 00000000 00:05 15695685 /memfd:dart-oldspace (deleted)
> 7fd2b3163000-7fd2b3beb000 rw-s 00000000 00:05 15695684 /memfd:dart-profiler (deleted)
> 7fd2b3beb000-7fd2b3eb0000 rw-s 00000000 00:05 15695683 /memfd:dart-timeline (deleted)
> ...
> 
> Bug: b/144232910
> Change-Id: I9722247853b244daff63b7a631678d44e19c2d69
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128603
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=aam@google.com,rmacnak@google.com,asiva@google.com,chinmaygarde@google.com

Change-Id: I8a983d4650ca10e9c7396536603af21c974dcb78
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/144232910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128587
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-17 11:14:19 +00:00
asiva b1afe2d0eb [VM/Runtime] - Ensure the comma separated options under --enable-experiment are stored as individual flags in the VM instead of as a single string. This ensures GetExperimentalFlag will return the correct value for an option.
Change-Id: I28c7a28bac9f9ffa5df8d561f2a21f2b0cc0ec57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128569
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-12-17 01:42:29 +00:00
Ryan Macnak f5e57f89d2 [vm, linux] Try to attach names to all VirtualMemory allocations using memfd.
For example,

$ cat /proc/<pid>/smaps
...
7fd2ad2e0000-7fd2ad2f0000 rw-s 00000000 00:05 15576579 /memfd:dart-zone (deleted)
7fd2b2b7f000-7fd2b2d7f000 rw-s 00000000 00:05 15695692 /memfd:dart-newspace (deleted)
7fd2b2f00000-7fd2b2f80000 r--s 00000000 00:05 15695687 /memfd:dart-codespace (deleted)
7fd2b2f80000-7fd2b3000000 r--s 00000000 00:05 15695685 /memfd:dart-oldspace (deleted)
7fd2b3163000-7fd2b3beb000 rw-s 00000000 00:05 15695684 /memfd:dart-profiler (deleted)
7fd2b3beb000-7fd2b3eb0000 rw-s 00000000 00:05 15695683 /memfd:dart-timeline (deleted)
...

Bug: b/144232910
Change-Id: I9722247853b244daff63b7a631678d44e19c2d69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128603
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-16 23:30:03 +00:00
Régis Crelier f2618b0077 [VM/nnbd] Make type Never a regular type.
This is a follow-up CL to https://dart-review.googlesource.com/c/sdk/+/128001
 Type Never now also accepts legacy and nullable nullabilities.

Change-Id: I52c270bdca9afdad8193f797011774afae618b7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128566
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-12-16 22:25:43 +00:00
Ryan Macnak 6b5d9f1d1b [vm] Progress toward running without TSAN warnings.
- Ignore all data races on object headers. These are harmless because of higher-level constraints in the GC.
 - Make all concurrent marker tasks check-in with the monitor to indicate they are done marking roots, not just the last one. This establishes synchronization between the which ever task read the handle blocks and the mutator resuming and writing to the handle blocks.
 - When a helper thread exits the isolate, perform clearing of the reusable handles under the thread registry's lock so it doesn't race with the GC visiting thread roots.
 - Disable background compilation when running under TSAN. There are lots of races here. Many are harmless. It's hard to annotate these without effectively disabling TSAN checks for the entire Dart heap, so simply disabling the background compiler will give us the most TSAN coverage for the time being.
 - Fix race in abandoning TLABs during helper thread exit.
 - Remove harmless race between concurrent sweeper and allocation of new heap pages.
 - Suppress TSAN on known race in array truncation.
 - Remove racy access FLAG_stacktrace_every, which is no longer needed as compilation can no longer trigger execution to evaluate constants.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: Ibaa101b4f12ff5fa30678471fb37e63608ba7f8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128305
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-16 18:32:23 +00:00
Ryan Macnak 83eeab1e63 Miscellaneous documentation updates.
Change-Id: I9cc022443ba70b0a450a86943f7636dc6f8c975c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128373
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-12-13 23:10:55 +00:00
Ben Konyi df4a022b00 [ dartfuzz ] Output Dart SDK revision to logs during fuzz testing
Change-Id: Ic55b46198455cca399b17b873bfdda1b7efb6c09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128374
Reviewed-by: Fizaa Luthra <fizaaluthra@google.com>
2019-12-13 21:24:23 +00:00
Fizaa Luthra ea6fe62bb4 [dartfuzz] Refactoring gen_api_table.dart
This CL removes the character encoding for types in the fuzzer.

Change-Id: I00fd76158932d8b5723c3f760e2d6c71beb5e5cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-12-13 20:39:26 +00:00
Liam Appelbe 3166b7d976 [vm] Enable nnbd experiment when building the SDK with --nnbd
This is necessary as of https://dart-review.googlesource.com/c/sdk/+/127961
to use the experiment flag in the VM.

Tested: Late modifier tests that had stopped building now pass again.

Change-Id: I49a5f1e99f40c6e8d785b28a333b44e6fac67eca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127984
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-13 20:13:20 +00:00
Ryan Macnak 9a43744f0e [vm, gc] Flatten promotion allocations.
Change-Id: I423885291aa17133c4409b265672792397387211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127423
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-13 18:55:00 +00:00
Teagan Strickland 217e265b02 [vm/compiler] During DCE, remove PushArguments of non-live definitions.
In the current compiler pipeline, PushArgument instructions can
end up outliving the calls to which they are an argument in some
circumstances. For example, the PushArgument is left in the graph
if it also appears in the environments of interleaving instructions.

When the dead code eliminator calculates liveness of a definition,
it ignores appearances in PushArgument instructions. Instead, it
looks for uses of the definition either directly or via
PushArgument in the arguments of calls and environments of other
instructions in the graph. An separate pass run before DCE
removes environments from instructions, so a definition used only
in PushArguments that have outlived their calls is considered dead.

The current DCE removes dead definitions but leaves PushArgument
instructions be. For orphaned PushArguments of dead definitions,
this means after DCE they now reference definitions no longer in
the graph.

This change instead checks the definitions referenced by
PushArgument instructions for liveness. If a PushArgument
references a dead definition, then the DCE removes the PushArgument
instruction, as its call must have already been removed (else
the definition would still be live), and environments, and thus
environmental uses, have already been removed from the graph.

Bug: https://github.com/dart-lang/sdk/issues/39767
Change-Id: I74c8e92a0d93f2aae42f8ff6f06ee70899b2f794
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128403
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-12-13 18:15:04 +00:00
Martin Kustermann 6f6bdfac3a Reland "[vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter"
If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
implementation will load the value of the type parameter using
the (instantiator or function) type arguments. It will then call the
type testing stub (TTS) of that type.

If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
implemented), it can fall back to the slower SubTypeTestCache implementation.

Right now the STC fallback will get the loaded value of the type
parameter for `dst_type` instead of the type parameter. Doing so is
incorrect.

  => This CL ensures we preserve dst_type = TypeParameter for the STC
  fallback.

Issue https://github.com/dart-lang/sdk/issues/39716

Change-Id: Id5b318ed4940b4d749f6ab8b4c2a4efc295d9dde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127888
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-13 15:03:18 +00:00
Teagan Strickland 5824d3ed53 [vm] Weaken dwarf_stack_trace expected stack trace.
We only check the expected stack starting from the call to
foo in main, so we no longer depend on what is captured in
the stacktrace for how main is invoked.

Also removes the old status lines for this test, which are no
longer applicable, and cleans up the documentation a little.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try
Change-Id: I61f0465dcd55d090c49db9c6af503ae9c0df6313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128401
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-12-13 12:09:38 +00:00
yuanhuihui fe9f30c389 [timeline] support vm events available to systrace
more detail: https://github.com/dart-lang/sdk/issues/39757

Signed-off-by: yuanhuihui <gityuan@gmail.com>
Bug: https://github.com/dart-lang/sdk/issues/39757
Change-Id: I6174500796289ffcfb7a53d3f897c5d7f82932ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-13 00:41:46 +00:00
Zichang Guo 11b35c166b [vm/debugger] --trace-debugger-stacktrace prints async causal stack trace
Allow --trace-debugger-stacktrace to print frames in async causal stack trace.

Change-Id: I52bcbcbb22ed939074b682ce18e328df775ea0b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128282
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-12 23:05:51 +00:00
Teagan Strickland 5543e5ceb8 [vm] Add docs for DWARF stack traces and related tools/libraries.
Bug: https://github.com/dart-lang/sdk/issues/35851
Change-Id: I3a9d16a85abab825cb698b491d0846dc50f1fff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127893
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-12 18:38:50 +00:00
Victor Lima 45db297095 [vm/precomp] Reduce arm32 code size for BoxInt64Instr
Change-Id: I018ddd6add8b8ff447019cc61bff579104084f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128072
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-12 18:00:31 +00:00
Teagan Strickland 4b8fd3c412 [vm] De-obfuscate function and file names in DWARF sections.
Note that when generating unstripped ELF snapshots with --obfuscate,
this means DWARF sections in the resulting snapshot will leak
otherwise obfuscated information. To avoid this, use both --strip
to strip the generated snapshot and --save-debugging-info=<...> to
save the unobfuscated DWARF information to a separate file.

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

Change-Id: I8795e2a5623ad5fc5362257007f677e622a7700b
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127166
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-12 17:54:20 +00:00
Teagan Strickland c2b6c2e1db [vm/compiler] Add --save-debugging-info flag to gen_snapshot.
The flag can be used when creating AOT snapshots. The resulting file can be
used with package:vm/dwarf/convert.dart to convert DWARF-based stack traces
to stack traces with function, file, and line number information.

Currently the saved file will be an ELF file with DWARF debugging information,
but this is subject to change in the future. To avoid being affected by any
changes in format, read the DWARF information from the file using
Dwarf.fromFile() in package:vm/dwarf/dwarf.dart.

Also adds --dwarf-stack-traces to the VM global flag list, so its value at
compilation will be read out of snapshots by the precompiled runtime.

Fixes https://github.com/dart-lang/sdk/issues/39512, which was due to
a missing compiler::target:: prefix for Instructions::HeaderSize() in
BlobImageWriter::WriteText().

Exposes the information suggested in
https://github.com/dart-lang/sdk/issues/39490 so that package:vm/dwarf
can appropriately convert absolute PC addresses to the correct virtual
address for a given DWARF line number program.

Bug: https://github.com/dart-lang/sdk/issues/35851
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I80d900fd9e5f1e2399ad3f2fd25c85131a7ea43c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121857
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-12 14:18:59 +00:00
Daco Harkes 4bd3166529 [samples/ffi] Native resource lifetime management
Samples for managing native memory without finalizers.

Design: go/dart-ffi-resource-lifetime

Related issue: https://github.com/dart-lang/sdk/issues/35770

Change-Id: I2d0ac1acb65a78db9f57aea3dd5f25b4948ef6d6
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123662
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2019-12-12 10:27:22 +00:00
Fizaa Luthra 0bc0531e6c [dartfuzz] Add flag for displaying output divergence details
Change-Id: I2cbea08ca809092fad013cc20bb6bceeb4fa770d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128006
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-12-12 01:56:25 +00:00
Ryan Macnak a8d8a18642 [vm, arm64] Fix heap corruption in PushArrayOfArguments.
The store barrier may clobber condition flags, causing the loop to copy past the last argument.

Bug: https://github.com/dart-lang/sdk/issues/36906
Change-Id: Ia863ec88aaa26c4193cadba26df62b43e68c377e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128108
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-12 01:52:48 +00:00
Fizaa Luthra bc40858f94 [dartfuzz] Re-enabling Int32x4
Re-enabling as we fixed https://github.com/dart-lang/sdk/issues/39518.

Change-Id: I4fc2fdf4cbb0bd5dfec96616085c58590d0d87f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128000
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-12-12 00:37:10 +00:00
yuanhuihui 5908fc4d33 [timeline] Add support for timeline asynchronous events in android platform trace
systrace don't support async timeline events, when define sync event can
show in timeline, but not including systrace.
more details, see https://github.com/dart-lang/sdk/issues/39726

Bug:https://github.com/dart-lang/sdk/issues/39726
Change-Id: Iea705f7a4f67e540411ef2cb81ccff9b3b793b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127920
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-12-11 19:36:18 +00:00
Alexander Markov ad1a26b90b Reland "[vm/compiler] Dead code elimination"
This is a reland of b69596bb1b

Original change's description:
> [vm/compiler] Dead code elimination
> 
> flutter_gallery total size -0.9% (arm), -0.77% (arm64)
> flutter_gallery instructions size -1.27% (arm), -1.11% (arm64)
> 
> Fixes https://github.com/dart-lang/sdk/issues/33414
> 
> Change-Id: I9de07ac866ba8a6bf3575df85b790e26a2753750
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127381
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

Change-Id: Id53dddfe22af4d48673e30a3f66e63ed878523ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128010
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-11 19:23:48 +00:00
Ryan Macnak e29a6d6f8d [vm] Initialize the handle vtable table during VM initialization instead of during class registration in each isolate's initialization.
Removes a (harmless) race initializing this table to appease TSAN.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: I9f7bdd0edf2be5e87e56e453601641a9550d157a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127965
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-11 18:54:08 +00:00
Ryan Macnak 7679924ece [vm] Reduce frame size for the functions with the largest frame sizes.
Cf. -Wframe-larger-than.

Change-Id: I47e3144bdf7f8fd8c6f308d5552a7ce4f3f990ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128008
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-11 18:15:27 +00:00
Ryan Macnak 3678a3bd42 [build] Use separate out directories for each sanitizer.
Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: Ie0aeaff758234220c2f0267b462d14f4c076bdf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127821
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-11 18:12:47 +00:00
Alexander Markov 9307b18f1b [vm/test] Fix vm/dart/product_aot_kernel_test for bytecode
Change-Id: Ic074472d2cfbb413283858b1815c56e6abe3a0a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127987
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-11 17:25:27 +00:00
Alexander Markov 12f6eb699f [vm/ffi_test] Fix ClobberAndCall helper on Windows
ClobberAndCall was using an incorrect register for the first parameter
on Windows (rdx instead of rcx). This caused crashes on
vm-kernel-precomp-win-release-x64 bot after landing unrelated change
(https://dart-review.googlesource.com/c/sdk/+/127381).

Change-Id: I5a150ecc743abdb3e00c8afd0d1dd851b777f2e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128009
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-11 17:23:57 +00:00
Teagan Strickland f6d433dc5e [vm] Remove the unchecked entry point offset field from RawInstructions.
There's just one case where we can't get the offset for Instructions
from somewhere else, and that's when we reset active_instructions_ to
instructions_ in Code::Enable(). Thus, we add a caching field for the
uncached offset to RawCode, but only when the active_instructions_
field is added (when not running in the precompiled runtime).

We also output the unchecked offset in snapshots for Code objects so
we can recalculate the entry point cache on loading. (For full JIT
snapshots, we output both the cached offset and the offset for
active_instructions_.)

Bug: https://github.com/dart-lang/sdk/issues/38451
Change-Id: I78572ec83d1574b00820df148bccb57e5c79eaaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125400
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-12-11 10:00:29 +00:00
Martin Kustermann 922a74c96a Revert "[vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter"
This reverts commit 20ec71d447.

Reason for revert: Performance regressions and seemingly broken TypedData.* benchmarks.

Original change's description:
> [vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter
> 
> If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
> implementation will load the value of the type parameter using
> the (instantiator or function) type arguments. It will then call the
> type testing stub (TTS) of that type.
> 
> If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
> implemented), it can fall back to the slower SubTypeTestCache implementation.
> 
> Right now the STC fallback will get the loaded value of the type
> parameter for `dst_type` instead of the type parameter. Doing so is
> incorrect.
> 
>   => This CL ensures we preserve dst_type = TypeParameter for the STC
>   fallback.
> 
> Issue https://github.com/dart-lang/sdk/issues/39716
> 
> Change-Id: Idea2405efbdc01c031ee68dbb345820e721533eb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127640
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

TBR=vegorov@google.com,kustermann@google.com,regis@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I79f2d7db8747743a778126088e375bb4d268c91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128020
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-10 23:56:06 +00:00
Régis Crelier 8caaf3b7fd [VM/nnbd] Map nullable Never type to Null type.
Map nullable Never type to Null type when reading kernel files and also during
type parameter instantiation.

Change-Id: Iea2d895631661fc01adac65bfd6234e9adeecb1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128001
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-12-10 23:22:46 +00:00
Alexander Markov 3a456fb3cc Revert "[vm/compiler] Dead code elimination"
This reverts commit b69596bb1b.

Reason for revert: failures on vm-kernel-precomp-win-release-x64 bot.

Original change's description:
> [vm/compiler] Dead code elimination
> 
> flutter_gallery total size -0.9% (arm), -0.77% (arm64)
> flutter_gallery instructions size -1.27% (arm), -1.11% (arm64)
> 
> Fixes https://github.com/dart-lang/sdk/issues/33414
> 
> Change-Id: I9de07ac866ba8a6bf3575df85b790e26a2753750
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127381
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com,sjindel@google.com

Change-Id: I0bf0e27cc13b4d0708be19304e278977c7eb6558
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128003
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-10 22:59:26 +00:00
Liam Appelbe e1ef70fad4 [vm] Add nnbd-experiment to the snapshot feature string
This means that when snapshots are loaded, the nnbd experiment flag they
were compiled with must match the flag the VM currently has.

Bug: https://github.com/dart-lang/sdk/issues/37479
Change-Id: I907a68f49c7c1ac4467c4c39ce033075eba457a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127961
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-12-10 19:04:15 +00:00
Jason Simmons ec6e8c8dfa Clarify the roles of isolate_data and isolate_group_data in Dart_CreateIsolateGroup
Change-Id: I8b4339a6f3cd7e95e2c8f72ee40178104a668a69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127822
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2019-12-10 19:02:25 +00:00
Alexander Markov b69596bb1b [vm/compiler] Dead code elimination
flutter_gallery total size -0.9% (arm), -0.77% (arm64)
flutter_gallery instructions size -1.27% (arm), -1.11% (arm64)

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

Change-Id: I9de07ac866ba8a6bf3575df85b790e26a2753750
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127381
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-12-10 18:50:35 +00:00
Alexander Markov d03a7686d2 [vm/compiler] Fix inlining of SIMD shuffle operations
When trying to inline SIMD shuffle operation in InlineSimdOp
(inliner.cc), FunctionEntry instruction was created and inherited
deopt_id and environment from call. Inheriting environment also
added FunctionEntry into env_use_list of other instructions.
If inlining didn't actualy happen due to invalid mask argument,
created FunctionEntry still left in the env_use_list.
Later optimization passes (for example AllocationSinking) may crash
while trying to update environment uses of instructions.

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

Change-Id: I6bdb7c6f7a7947259ea5ad097d05eebe5d73269b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127802
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-10 16:40:35 +00:00
Victor Lima 98c13ba18f [vm/precomp] Reduce arm-32 code size in BoxInt64Instr
Change-Id: Id544f20493c0baffb154ee1ea235247ddd844a60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127146
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-10 15:28:45 +00:00
Samir Jindel a846098c18 [vm] Enable ELF loader to read snapshots from memory without any backing file.
Also build Dart_LoadELF_Fd on Linux as well to get minimal coverage for Fuchsia.

Change-Id: I4be3eeae3e4559e95413fd60a26b9e6d2edabb32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127644
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-10 12:26:05 +00:00
Ryan Macnak 617933c3c1 [vm, gc] As a debugging aid, remember the previous object during heap iteration.
Bug: https://github.com/dart-lang/sdk/issues/36906
Change-Id: Id7214aaa475929e33e5e5ae5bc58c99eb927b74b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127743
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-10 00:57:23 +00:00
Martin Kustermann 20ec71d447 [vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter
If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
implementation will load the value of the type parameter using
the (instantiator or function) type arguments. It will then call the
type testing stub (TTS) of that type.

If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
implemented), it can fall back to the slower SubTypeTestCache implementation.

Right now the STC fallback will get the loaded value of the type
parameter for `dst_type` instead of the type parameter. Doing so is
incorrect.

  => This CL ensures we preserve dst_type = TypeParameter for the STC
  fallback.

Issue https://github.com/dart-lang/sdk/issues/39716

Change-Id: Idea2405efbdc01c031ee68dbb345820e721533eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-09 21:02:12 +00:00
Liam Appelbe a17884aff0 [vm] Fix late final local variables in AST mode
- Modify setter logic for late final local variables.
- Remove extra visitVariableDeclaration in late_var_init_transformer
  that was causing nodes to be visited multiple times.

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: Id39925e4b9560a1da1b01e1cf14ef20c515f3928
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127720
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-12-09 20:36:12 +00:00
Fizaa Luthra 55f86c13cb [dartfuzz] Fix infinite recursion
Change-Id: Ie758aae5bf2d455b3232eebfb5a2e960041a4520
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127581
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-12-09 19:29:29 +00:00
Régis Crelier b37f391f34 [VM/nnbd] Make runtimeType return a non-nullable type when the NNBD experiment is enabled.
The nullability of runtimeType must be consistent with the nullability of
a class DeclarationType. Currently, it is always kLegacy. However, this
needs to be set to kNonNullable when the NNBD experiment is enabled.
Note that the nullability of the null instance remains kNullable.

Change-Id: I4ba974c2551c3a7fbd190b02175804090f9b48b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125721
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-12-09 18:27:04 +00:00
Régis Crelier 8894b88467 [VM/nnbd] Implement syntactic type equality.
Legacy types are considered equal to their non-nullable variant.
Type hash is modified to be consistent with the new definition.

Change-Id: If90f7f13cf77e519d5b90b57d9dbf4988f71be13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126283
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-12-09 18:18:59 +00:00
Ben Konyi 16e7647c86 [ VM / dart:typed_data ] Fixed issue where null could be passed for simd types in AOT
Arguments to simd type constructors were being checked in the bootstrap
natives entrypoint but not elsewhere. Checking for null in Dart code
ensures that we don't accidentally miss these checks in AOT.

The changes to sdk_nnbd are required in order to ensure the number of
arguments passed to native code match the number of arguments from the
non-NNBD implementation (we needed to remove the implicit type args
parameter).

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

Change-Id: Iaf7d8790c154f1e85db613b6dc84004c8013df9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126905
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-12-09 15:29:27 +00:00
Samir Jindel 8b8894648f [vm] Fix Meteor regression in "[vm] Enable multiple entry-points for unoptimized calls."
Change-Id: I3ffcdd67ae80b05339861a3376a56b0a6ce642c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127462
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-09 13:45:47 +00:00
Samir Jindel 168cf90131 [vm] Make ELF loader Fuchsia compatible.
Change-Id: I519fb04c6bf1fbef53a833957c714f3a1e394f21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127641
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-09 12:51:07 +00:00
Daco Harkes bd8da4757e [vm/ffi] Remove simulator code
DBC is deprecated, and we're unlikely to implement simarm FFI support.

Removing templating as suggested in https://dart-review.googlesource.com/c/sdk/+/124136/3/runtime/vm/compiler/ffi.cc

Change-Id: I39753129739430093db3b53fb530829c6af936b1
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try,flutter-engine-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127466
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-07 17:10:45 +00:00
Fizaa Luthra c31db57c97 [dartfuzz] Add support for simple recursion
Change-Id: I306d787dbcb154a3c51f13c9e01006d871a2213d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126611
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-12-07 01:36:34 +00:00
Ryan Macnak 98da22a11f [observatory] Display process-wide memory usage with heap snapshots.
Include major memory users known to the VM: isolate heaps, profiling buffers, timeline buffers.

Change-Id: I2580ad74b5d4d07c5c75fde28bb7a5d71fddb09b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127382
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-12-07 00:28:15 +00:00
Ryan Macnak 80aa5fda4b [observatory] Account for external size in the "Classes (table)" and "Classes (treemap)" views.
Mechanically, this renames shallowSize to internalSize and redefines shallowSize as internalSize + externalSize.

Change-Id: I734f5714ad6dff341627e3d6e51e3bdcf26c63ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125993
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-06 23:20:04 +00:00
Liam Appelbe de53a2c33c [vm] Fix late local variables in AST mode
- Set a flag on LocalVariable if it's late, and store its initializer offset
 - Visit late var init in when visiting var get in scope builder
 - Initialize late vars to the sentinel
 - Check the sentinel and run the initializer in late var get

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I5500ed133537ab663e2b3d8cfb5cca04233be25e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126982
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-06 19:54:42 +00:00
Ben Konyi 6267a8194e [ VM / dart:io ] Fix issue where SIGPROF is disabled in processes spawned via Process on POSIX
On POSIX platforms, execvp was being run wrapped in
`VOID_TEMP_FAILURE_RETRY` which blocked SIGPROF, resulting in SIGPROF
being blocked in the new application. This would cause Dart applications
spawned through dart:io as a new process to not receive profiler ticks.
This should fix the issue where `flutter run -d {linux,macos}` would
result in profiling being broken for the spawned desktop application.

Change-Id: I7b176ce48144bcbca29d4ae63c82599623ce3c35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127451
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-12-06 19:46:31 +00:00
asiva b99599bae1 More cleanup of the loader code.
Change-Id: I8ee048f2a06f8aa54cb5efb832740a53b2bd042d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127444
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-12-05 23:07:55 +00:00
Liam Appelbe e20ff1e054 [vm] Prevent late fields from being unboxed
When unboxed doubles are assigned to late fields, it conflicts with the
late field logic and causes a crash.

Bug: https://github.com/dart-lang/sdk/issues/38841
Bug: https://github.com/dart-lang/sdk/issues/39658
Change-Id: I641f597006114f02473a20f8c2526eeaf4fe813f
Fixes: https://github.com/dart-lang/sdk/issues/39658
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127442
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-12-05 22:19:00 +00:00
Alexander Aprelev 929877c822 [gardening] Fix gen_kernel path on Windows for product_aot_kernel_test.dart.
This is follow-up to https://dart-review.googlesource.com/c/sdk/+/127004.

Change-Id: I2ccdfee835beb5182a73ca065dae1791e526295f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127380
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-12-05 18:40:49 +00:00
asiva 5ff9a2ed37 Cleanup the loader code to remove some unused pieces.
Change-Id: I026b2b0dfb964c2dd67a9022260e4aba9c019e9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125444
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-12-05 02:44:18 +00:00
Fizaa Luthra b8dbaaa527 [dartfuzz] Fix infinite recursion in call methods
Change-Id: Ia9add544bdb12fa806dbcfcedf41ccf023d48fa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127204
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-12-05 00:24:08 +00:00
Alexander Markov f56b0f6907 [vm/aot/tfa] Whole-program constant propagation
Size:
flutter_gallery total size -2.48% (arm), -2.3% (arm64)
flutter_gallery instructions size -2.91% (arm), -2.77% (arm64)
velocity_tracker_bench total size -7.5% (arm), -7.1% (arm64)

Performance:
SkeletalAnimation +46.02% (Intel Core i5), +37.75% (Intel Xeon), +24.86% (arm), +39.75% (arm64).
FfiMemory.Pointer* +44-64% (x64)
FfiMemory.PointerPointer +436-465% (x64), +443% (arm64).

Issue: https://github.com/dart-lang/sdk/issues/37710

Change-Id: I6221bfa02b165ccc17d4ee8b857bb89212febaff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125936
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-04 19:19:29 +00:00
Ryan Macnak 9929b53c71 [vm, gc] Allow old-space collections for allocations during safepoints.
Earlier versions of the safepointing mechanism had trouble with this, so we skipped the collections expecting a higher-level caller to eventually clean-up. This is no longer necessary.

Disallow old-space collections under a force-growth scope.

Bug: https://github.com/dart-lang/sdk/issues/39484
Bug: https://github.com/dart-lang/sdk/issues/39493
Change-Id: Id5027899d06a29a307ceeca21dd4d1bc96c94920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127102
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-04 19:08:09 +00:00
Martin Kustermann c52acadd15 [vm/ffi] Split up some tests/ffi into vmspecific and non-vmspecific
The separation will allow flutter/flutter integration tests to run the
non-vmspecific parts.

Change-Id: I0e771f1247ec62d2f0c3faa95ee10560e62524f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127144
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-04 15:56:08 +00:00
Martin Kustermann 1bbbc9f599 [vm/aot] Check in test to ensure in PRODUCT mode we don't retain any code in dart:vmservice_io/dart:_vmservice
The CL also updates a number of pragma annotations to be conditional on
non-product mode.

Change-Id: Ia00b5089d54bbb8f6f6006ef67d65859ab56c132
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127004
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-04 15:30:58 +00:00
Kirill Nikolaev eec49f34c4 Always truncate thread names on linux to 15 chars (16 with the null terminator).
On Linux it is an error for a thread name to exceed 16 bytes. Thus also changing the VM thread pool to use the shorter "DartWorker" name.

Change-Id: I4c5cc2bfb831a5593a8652d6435631b9d3803720
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126163
Commit-Queue: Kirill Nikolaev <cyriln@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-04 14:26:48 +00:00
Vyacheslav Egorov 1c2ad7e2e1 [vm/aot] Remove assertion around committing object pool into GOP.
Our inlining heuristics are not stable and can decide to inline
something on the second attempt, which was not inlined before
leading to generation of new allocation stubs which were not
generated before.

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

Change-Id: I49d6df35d6b0568429abc84a140469e0aae065de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127143
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-12-04 13:38:48 +00:00
Martin Kustermann b0155a72a7 [vm/ffi] Add script to extract existing positive ffi tests into bundle to be used for flutter/flutter integration test
The `tests/ffi/prepare_flutter_bundle.dart` script will try to discover
all synchronous, positive test from the "ffi" test suite, rewrite them
slightly and output a directory which can be used in a flutter/flutter
FFI integration test.

We split the ffi test functions into two parts, because a subset of the
C functions will issue calls to the VM via `dart_api.h`, which is not
available for the flutter/flutter integration test.

=> We make `runtime/bin/ffi_test/ffi_test_functions.cc` a pure C
   library, usable without `dart_api.h` and move the remaining VM
   specific code to .../ffi_test_functions_special.cc contains.

All tests from `tests/ffi/*_test.dart` will be included in the generated
bundle, which

   * don't use async/isolates
   * don't rely on VM api
   * don't rely on DynamicLibrary.{process,executable}
   * don't take too long to execute

The script can be used as follows:

   sdk % dart tests/ffi/prepare_flutter_bundle.dart foo
   Using SDK root: .../sdk
   The following tests will be included:
      aliasing_test.dart
      data_not_asan_test.dart
      data_test.dart
      extension_methods_test.dart
      external_typed_data_test.dart
      function_structs_test.dart
      negative_function_test.dart
      regress_37254_test.dart
      regress_39044_test.dart
      regress_39063_test.dart
      regress_39068_test.dart
      stacktrace_regress_37910_test.dart
      structs_test.dart
      variance_function_test.dart
   The following tests were filtered due to using dart_api.h/async/DynamicLibrary.{process,executable}/...
      function_callbacks_test.dart
      function_gc_test.dart
      function_test.dart
      object_gc_test.dart
      regress_37100_test.dart
      regress_37511_callbacks_test.dart
      regress_37511_test.dart
      regress_37780_test.dart

   Please copy generated files into FFI flutter test application
      * foo/lib/src/generated
      * foo/ios/Classes

Change-Id: Ia13f97df3bbc90829bb8fde8265a7e1d2c0f8260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127006
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-04 13:02:48 +00:00
Clement Skau f9327d3bac [SDK] Adds --lazy-async-stack support for async*.
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I53cd334243649901ea8e0f9799d9f41c126e3627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126729
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-04 12:47:48 +00:00
Martin Kustermann a9c77229c2 [vm/compiler] Avoid undefined behavior in range analysis shift operation
Change-Id: I232f86b58c71746ea6ccb479f28d812c29027938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127141
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-04 11:26:20 +00:00
Ryan Macnak f4e44dd705 [vm] Make kernel buffers live exactly as long as their derived views.
When creating a KernelProgramInfo, we create several logical views into the kernel buffer. These are fresh ExternalTypedDatas, rather than proper TypedDataViews, so they do not automically keep the original ExternalTypedData alive. Create an explicit reference to the orginal ExternalTypedData in the KernelProgramInfo. When creating snapshots, this reference is ignored/null'd and the views are turned into copies, effectively dropping the parts of the original buffer that do not have views.

Fixes a leak with reload and a use-after-free with eval.

Bug: https://github.com/dart-lang/sdk/issues/33973
Bug: https://github.com/dart-lang/sdk/issues/39610
Change-Id: I09d3830133314ccbaa0341d904127c2b6925c4ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126825
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-03 22:00:48 +00:00
Liam Appelbe b7094364fe [vm] Re-add late field initializer code
https://dart-review.googlesource.com/c/sdk/+/126100 deleted the late
field initializer code, presumably a merging error.

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I0c26891b3614995b47a27ded785c4e55ef9ec175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127040
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-12-03 17:52:38 +00:00
Clement Skau 89e31069e8 Revert "[vm/cfe] Elaborate for-in statements during async transform"
This reverts commit 63333deed6.

Reason for revert: Causes failures on Flutter HHH CI in the "flutter test hostonly_devicelab_tests" step due to kernel binary format version mismatch.

Original change's description:
> [vm/cfe] Elaborate for-in statements during async transform
> 
> This allows us TFA to analyze the iterator calls and we generate much tighter
> code in AOT.
> 
> However, due to the increased inlining opportunities, we end up emitting 0.5%
> more code. Inlining of the _GrowableList iterator specifically also includes the
> concurrent modification check and error handling.
> 
> Calls to get:iterator, moveNext and get:current account for 7.12% of all InstanceCall
> instructions in Flutter Gallery.
> 
> Fixes https://github.com/dart-lang/sdk/issues/39516
> Issue https://github.com/dart-lang/sdk/issues/39566
> Issue https://github.com/dart-lang/sdk/issues/39565
> 
> Change-Id: I8dcc08b7571137e869a16ceea8cc73539eb02a5a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126381
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com,johnniwinther@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I89b88c3d9f7c743fc340ee73a45c3f57059bcf30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126734
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-03 12:29:35 +00:00
Fizaa Luthra e25744c44e [dartfuzz] Adding support for callable classes
Change-Id: I631820590faf714fa4f472ce4b78cea62621b2e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126086
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-12-03 00:25:50 +00:00
Liam Appelbe fe64ce38e8 [vm] Fix late static fields (both non-final and final) in AST mode
Changes:
 - Initialize late static fields to the sentinel.
 - Mark implicit setters for static fields as static functions.
 - Call the setters and getters in StreamingFlowGraphBuilder.

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I6b40aa86e44d5cea94bcf22f995ea36e01258197
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126920
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-02 23:24:20 +00:00
Zichang Guo bf69257c5f [dart:io] socket profiler in dart:io
Add socket profiler functionality through service extension.

Change-Id: I717b72fbb1c53503dfb8fa08789417c18300565d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124582
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-02 19:11:18 +00:00
Fizaa Luthra de36aa0f1a [dartfuzz] Temporarily disable Float32x4.reciprocal() and Float32x4.reciprocalSqrt()
Will revert this change after we resolve https://github.com/dart-lang/sdk/issues/39551.

Change-Id: Ic2b9b6a185c2b610f526187bf75d11ee229398f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126608
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-11-29 23:38:26 +00:00
Vyacheslav Egorov 59c41f21d6 [vm/compiler] Avoid dead global pool entries due to bailouts
We eagerly add objects into the global object pool while generating
code. However code generation can be aborted and retried at any point
due to various reasons (branch distance or speculative inlining). Such
bailouts and retries would leave dead global pool entries behind.

This CL avoids this by switching to a accumulate&commit scheme for
populating global object pool.

This solution is not entirely clean because we sometimes perform
nested code generation (i.e. to create allocation stubs) which
means that we can't always commit accumulated entries into the
global pool at the same indices as we expected them to be - meaning
that commit can fail and we have to retry compilation.

We try to minimize amount of retries by pregenerating some stubs
ahead of the main code generation.

Change-Id: I5bd3f70272cf49189b754f3a9a2c31d2e6165353
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126343
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-29 22:10:56 +00:00
Samir Jindel 63333deed6 [vm/cfe] Elaborate for-in statements during async transform
This allows us TFA to analyze the iterator calls and we generate much tighter
code in AOT.

However, due to the increased inlining opportunities, we end up emitting 0.5%
more code. Inlining of the _GrowableList iterator specifically also includes the
concurrent modification check and error handling.

Calls to get:iterator, moveNext and get:current account for 7.12% of all InstanceCall
instructions in Flutter Gallery.

Fixes https://github.com/dart-lang/sdk/issues/39516
Issue https://github.com/dart-lang/sdk/issues/39566
Issue https://github.com/dart-lang/sdk/issues/39565

Change-Id: I8dcc08b7571137e869a16ceea8cc73539eb02a5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126381
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-29 16:42:36 +00:00
Samir Jindel 078806851c [vm] Use static type of captured variables.
Also load 'this' directly rather than through the context in methods, since it cannot
be modified.

Flutter gallery code size -0.16% total.

Change-Id: I0e73fa642363f38e2abe2a5738e988df2bc12646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126100
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-29 14:50:46 +00:00
Clement Skau 27bdabe02e [SDK] Stop injecting <async gap> when async hasn't yielded yet.
Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I1637b7228f0a169a97db411afddfe089317a20e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126722
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-11-29 11:50:56 +00:00
Daco Harkes f9cedb6813 [vm/ffi] Fix source information in generated AST nodes
Fixes: https://github.com/flutter/flutter/issues/39916

Fix verified by manually generating the assembly snapshot and seeing the offending DWARF output be fixed.

Old DWARF:

```
.string "" // Empty filename in file table.
.uleb128 0
.uleb128 0
.uleb128 0
```

New DWARF:

```
.string "dart:ffi/struct.dart"
.uleb128 0
.uleb128 0
.uleb128 0
```

Change-Id: I60b6ff349deb70148c1a475b242c99e7c582d8c4
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126650
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-28 16:07:45 +00:00
Samir Jindel 4d95ec1360 [vm] Enable multiple entry-points for unoptimized calls.
This also makes the entrypoints tests less sensitive to the order in which
functions are optimized and removes flaky checks.

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

Change-Id: I5ba23c74769ddb8415e2b635caefc798c2b70500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109704
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-28 13:55:34 +00:00
Ben Konyi 507bdd583c Revert "[ VM / Service ] Add --object-id-ring-size to unblock UX studies for memory profiling"
This reverts commit 394f57ed7f.

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

Change-Id: I313f63da4a66b9fa7d202b85264590ed7c8be62e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126607
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-11-27 21:32:21 +00:00
Liam Appelbe 764c07ec38 [vm] Fix late_modifier_final_field_test in AST mode
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I53731fc2bb2ded54334e14f4c428e0d9b874005b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126606
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-11-27 20:35:21 +00:00
Liam Appelbe ba222dac23 [vm] Fix late_modifier_non_final_field_test in AST mode
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I3bc026888993a6bfb0d2b963f0f60fa61214da8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126603
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-11-27 19:10:31 +00:00
Martin Kustermann 5aa86eb123 [vm/concurrency] Run all isolate related tests with/without enabling isolate groups
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I0b7eca744bc49ab5ba09da3ce2a9286b1ed3c70f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126340
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-11-27 17:23:31 +00:00
Fizaa Luthra edf08f63ed [dartfuzz] Temporarily disabling Int32x4
Change-Id: I5faf799a5e3567f3f95bf65c279d0ac95363e193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-11-26 23:04:10 +00:00
Ben Konyi 1ecb8c7038 [ dartfuzz ] Added update_spreadsheet.py which automatically updates DartFuzzStats with latest fuzzing run results
Change-Id: I3352d27785cabd3052c8db458390277f768dd1c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126240
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Fizaa Luthra <fizaaluthra@google.com>
2019-11-26 22:16:30 +00:00
Ben Konyi c2c716d0c5 [ Observatory ] Fix issue where timeline would hang if CPU profiling was disabled.
When CPU profiling is disabled, the getCpuSamples RPC would return with
a ServerRpcException stating that the profiler was disabled. This wasn't
being caught when the RPC was invoked, but was being caught in
`ObservatoryApplication` and swallowed. This resulted in the timeline
page being stuck at the timeline loading dialog.

Also includes fixes from "[observatory] Properly wait for Catapult's iframe to load. Give
message while fetching timeline.", commit 3b99524167, which was reverted.

Change-Id: I2fe23d4dba5e20f717e111c519563866bb1a221c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-11-26 22:00:20 +00:00
Ben Konyi 3b99524167 Revert "[observatory] Properly wait for Catapult's iframe to load. Give message while fetching timeline."
This reverts commit b3cf5ef327.

Reason for revert: Breaking timeline view for users in Google3

b/141889413
b/145128403

Original change's description:
> [observatory] Properly wait for Catapult's iframe to load. Give message while fetching timeline.
> 
> Change-Id: I342c9315fc31021fb1387bc0e409645cd7a99d6a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125468
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I38b92a5a50955983369f4de7afb577d1a959e724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126360
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-11-26 15:49:53 +00:00
Clement Skau d5dbf10672 [SDK] Adds non-eager async stack frame collector.
This is done by collecting all frames on the current stack until an async/async* frame is hit
which has yielded before (i.e. is not in sync-async case).
From there on it finds the closure of the async/async* frame and starts traversing the listeners:
  while (closure != null) {
    yield_index = closure.context[Context::kAsyncJumpVarIndex]
    pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(yield_index);
    <emit pc in frame>
    closure = closure.context[Context::kAsyncCompleterVarIndex]._future._resultOrListeners.callback;
  }

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I97030d22e529bf8a74ecd30a8a2589cfe57ad330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122644
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-26 11:51:27 +00:00
Zhan Wang 7ceceda72c Fix typo in snapshot_profiling.md. heapsnaphsot -> heapsnapshot
Change-Id: I27a879ab266dd56d949c4c9bb5bb415a9ad03991
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126164
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-11-25 15:58:15 +00:00
Artem Serov d5fa596d74 [vm/compiler] ARM64: Extend usage of PushPair.
Take full advantage of PushPair (stp) in code generation
visitors; use PushRegisterPair for ThrowErrorSlowPathCode.

This change improves Flutter Gallery code size by:

Instr: -0.24%
Total: -0.15%

Change-Id: Icba42cb956b07966861b52d3a8653d21eafab3b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125971
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-11-25 11:31:34 +00:00
Teagan Strickland 709b2aa33d Adding a tool for using DWARF information to convert stack traces.
Also fixes the low and high PC information in the DWARF output of
inlining nodes.

Bug: https://github.com/dart-lang/sdk/issues/35851
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-mac-release-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I11c3577bdc5c12abdc88aa799c1aae3f505294df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123734
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-25 09:21:24 +00:00
Liam Appelbe f3102ab0cf [vm] Fix late final field edge case
If a late final field initializer is recursive, it can write multiple
values to the field. Only the first should succeed, and the rest should
throw.

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I87ffdc0b8fcd429c47f102fe76a0e6a577ae6c30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125934
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-11-22 21:37:17 +00:00
Fizaa Luthra fc47953a1e [dartfuzz] Adding library methods for TypedData types
Change-Id: I9df9a9c0b15adf281def748dc3bd15d62d6fa529
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125725
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-11-22 20:43:17 +00:00
Ryan Macnak ec81b3edf7 Revert "[vm] Avoid holding canonical hashes at rest."
This reverts commit b7de866bee.

Reason for revert: assertion failures on reload stress bots

Original change's description:
> [vm] Avoid holding canonical hashes at rest.
> 
> Canonical hashes are only stored during a round of canonicalization to avoid expontential time in cases such as those in tests/language_2/canonicalization_hasing_*. Clearing them avoids the GC spending time to visit them.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37523
> Change-Id: Icad1fad30dcb7eb95864bea8a26991aeccd7adc6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125760
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com

Change-Id: I2e6b29fd1b529d6302ab979acd4757f45bf989ef
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125935
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-21 23:58:30 +00:00
Ryan Macnak b7de866bee [vm] Avoid holding canonical hashes at rest.
Canonical hashes are only stored during a round of canonicalization to avoid expontential time in cases such as those in tests/language_2/canonicalization_hasing_*. Clearing them avoids the GC spending time to visit them.

Bug: https://github.com/dart-lang/sdk/issues/37523
Change-Id: Icad1fad30dcb7eb95864bea8a26991aeccd7adc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125760
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-21 21:29:48 +00:00
Régis Crelier af541cd0dd [VM/nnbd] Ignore nullability of type Never provided by CFE.
Although the type Never is always non-nullable, the CFE writes a nullability
byte in kernel files that was not properly skipped by the VM.

This fixes issues
https://github.com/dart-lang/sdk/issues/39466
and
https://github.com/dart-lang/sdk/issues/39461.

Change-Id: I93c44ed99173789fb19ddf9995f440d08e1c944b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125929
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-21 21:04:15 +00:00
Alexander Aprelev f6cefb35c0 [vm/gardening] Clean up no longer used ClassAndSize class.
This was made redundant by https://dart-review.googlesource.com/c/sdk/+/116064.

Change-Id: I325a6faa257a1fc635a3265bf9e1b14096fc8f25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-11-21 19:37:26 +00:00
Fizaa Luthra 4456d01a35 [dartfuzz] Fix ffi check in getMethods
Change-Id: Ib3818f7a05c5d0edc9491ef45d2162c6b8a1fa71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125921
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-11-21 19:02:26 +00:00
Artem Serov f8d42542dd [vm/compiler] ARM64: Block R22 to hold NullObject().
Block R22 to hold a cached version of NullObject();
refresh it in the same way as for BARRIER_MASK register.
Alter assembler to avoid emitting load and to use NR
register directly instead.

This change improves Flutter Gallery code size by:

Instr: -1.81%.
Total: -1.16%.

Change-Id: Ifec654e799737527eec1d8a0e87b4a197ad0298a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125662
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-11-21 14:11:55 +00:00
Clement Skau 28a029102b [SDK] Adds --support-disassembler in PRODUCT.
This CL also addes CodeSourceMap source positions to the disassembler output.

Change-Id: I49f6cb5257394badc8a005167f906e185509a3e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125663
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-21 12:28:45 +00:00
Clement Skau 45569e146e [SDK] Fixes C++ undef. behaviour in Library::Add*Metadata.
- Library::AddFieldMetadata(..)
- Library::AddFunctionMetadata(..)
- Library::AddTypeParameterMetadata((..)

Change-Id: If2ed9a52deddc64aa9780ced74b012fd82f2d1c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125668
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-21 11:42:54 +00:00
Ryan Macnak ee9a640c9d [vm] Allocate temporaries used by Dart_Invoke etc in new-space.
Allocating in new-space allows this objects to be collected quickly during the next scavenge, instead of acculumating in old-space until the next mark-sweep and potentially increasing the process's peak memory footprint.

Change-Id: Id73c4c3934f6d84ba7af9e3333a350b809946ebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125360
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-20 19:57:11 +00:00
Ryan Macnak b3cf5ef327 [observatory] Properly wait for Catapult's iframe to load. Give message while fetching timeline.
Change-Id: I342c9315fc31021fb1387bc0e409645cd7a99d6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125468
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-20 19:55:31 +00:00
Fizaa Luthra 5ec93e211f [dartfuzz] Adding fuzzer support for extension methods on core library types
Change-Id: Ie0637917db86ca89ace40bba363ee12314c3b459
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125124
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-11-18 23:25:48 +00:00
Aart Bik e12a7e0ca2 Fix for OSR assert (debug) or crash (release)
Rationale:
Rename traverses blocks in DOM order, not in execution order.
As a result, blocks that are directly entered from the entry
should introduce synthetic phis during OSR with non-empty stack
to make sure incoming stack values are merged properly.

https://github.com/dart-lang/sdk/issues/39193

Change-Id: Ic35961169aa535657333c2ab14fbd2c4e1f0783f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125489
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-11-18 22:33:05 +00:00
Ben Konyi cfd226a27f [ dart:http ] Fix issue where setting HttpClient.enableTimelineLogging wasn't actually enabling timeline logging
Change-Id: I12134eaf1cd79516376d266b9919535987f7703b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125565
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-11-18 22:17:55 +00:00
Ryan Macnak 830f291773 [vm] Use a wrapper for bootstrap natives too.
-80k (-0.33%) out/ProductX64/exe.stripped/dart
-76k (-1.59%) out/ProductX64/exe.stripped/dart_precompiled_runtime

Change-Id: Ib19aea40aa7a556ae90852ac30c8c08ce0a8b677
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125306
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-18 19:54:53 +00:00
Aart Bik 29ff784ecb [dart/compiler] Loop analysis and BCE improvements
Rationale:
Loop analysis did not take outer indices used as bounds
(triangular loops) into account to enhance analysis. This
left some obvious BCE optimizations on the table (mainly AOT).

Observed improvements (performance and code size):

About 5-15% performance on golem benchmarks:
   mainly armv7, and TypedData*Bench

Minor overall code size reduction on flutter gallery (arm32,arm64)

Comparing ./orig32.json (old) to ./new32.json (new)
Old   : 6614912 bytes.
New   : 6600336 bytes.
Change: -14576 bytes.

Comparing ./orig64.json (old) to ./new64.json (new)
Old   : 6459216 bytes.
New   : 6458736 bytes.
Change: -480 bytes.

Similar on velocity_tracker_bench (arm32,arm64)

Comparing orig32.json (old) to new32.json (new)
Old   : 804280 bytes.
New   : 794552 bytes.
Change: -9728 bytes.

Comparing orig64.json (old) to new64.json (new)
Old   : 705520 bytes.
New   : 705312 bytes.
Change: -208 bytes.

Change-Id: Ifc3b3a378ae6fd98743c48944a86a9e90ce4da5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117200
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-11-18 19:51:13 +00:00
Samir Jindel 6a8aae0095 [vm] Enable Dart VM to run in QEMU user-mode emulation for ARM.
Normally we consult /proc to determine the host architecture. However, this
reports the actual host architecture, not the QEMU-simulated one.

Also, GDB cannot debug position-independent executables in QEMU, so we disable
PIE when compiling for execution in QEMU.

Pass '--use-qemu' to 'gn.py' to build for QEMU.

Change-Id: Ib125127ceb0582b66754cfc0da22e09d224ee1e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125267
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-18 16:58:53 +00:00
Samir Jindel 16af4b7355 [vm] Set all entrypoints when reading JIT snapshots.
Fixes https://github.com/dart-lang/sdk/issues/39397

Change-Id: I328f6707e9f316decb5207cc11872886431fe5f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125410
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-18 14:47:53 +00:00
Clement Skau 369fdb7cb2 [SDK] Fixes FORCE_INCLUDE_DISASSEMBLER build in PRODUCT.
CodeObservers is not available in PRODUCT, but FORCE_INCLUDE_DISASSEMBLER will
enable code that uses (but doesn't strictly need) it.

This is related to https://dart-review.googlesource.com/c/sdk/+/125404.

Tested:
  ./tools/build.py --arch x64 --mode product dart_precompiled_runtime gen_snapshot
Change-Id: I5f0c0765a608b50704045c918b41c71398b89390
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125263
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-11-18 14:38:03 +00:00
Martin Kustermann aceeba7567 [vm/async] Encode the yield index -> token position in PcDescriptors.
Right now `Script::yield_positions()` is an array mapping function start
token positions to arrays. Those arrays contain token positions and are
indexed by yield index.
  => This `Script::yield_positions()` is not available in AOT mode.

The fast async stack implementation will need to be able to find out
where an async closure was suspended. It does so by looking at the
":await_jump_var", which contains the yield index. It then needs to
associate the yield index to token position of the yield.

This CL adds an entry into the PcDescriptors for every yield in a
async/async* function and removes `Script::yield_positions()`.
The entry will associate the yield index with the token position.

Flutter gallery total size impact for flutter-release:

  - armv7: +0.016%
  - armv8: +0.045%

Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: I0b2ce41e85d8f5d590201bf2fb091578d7379890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125408
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-18 11:50:13 +00:00
Clement Skau 706c54f763 [SDK] Adds disasm. flags for FORCE_INCLUDE_DISASSEMBLER.
This CL enables passing --disassemble to e.g. a product mode gen_snapshot
which used to not have the flag even when the disasm. was forcefully
included.

This CL also:
- Fixes numerous typos: marco -> macro.
- Reorders the _four_ types of flags in order of strictness.

Change-Id: I8e3ef75ea0a748a6af5fa48cf289a57beeb51148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125404
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-18 10:11:38 +00:00
Régis Crelier 8617da2bf0 [VM/nnbd] Pass NNBD mode to runtime functions whose semantics depend on it.
Runtime functions do not yet implement the NNBD semantics.
In a next change, generated code will pass NNBD mode to the runtime.
Declare one new VM flags: --strong-non-nullable-type-checks

Change-Id: I050a468e4a6b665ce46c345bafba04a947cf7cb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124105
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-16 02:49:48 +00:00
Ben Konyi 1c12878d05 [ dart:io ] Added timeline events for HttpClient connections and requests
Setting the `enableTimelineLogging` property of `HttpClient` to true results in
timeline events being created for HTTP connections and HTTP requests.
Timeline events contain general connection information, including:
  - Request type
  - Status code
  - Request / response headers
  - Cookies
  - Non-sensitive proxy information
  - Relevent error messages for failed connections

Change-Id: Ibe16a312ab5398c9ae886ea07bea5ca70b63e440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123540
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-11-16 00:46:46 +00:00
Ryan Macnak 545b10389d [vm, service] Compute allocation stats on demand, instead of during allocation and GC.
Removes support for accumulators, which now repeat the current live values.
Decreases performance difference between release and product modes.
Fixes inaccuracy when counters are queried before the first full GC.

Golem geomean   x64 4.687%
Golem geomean arm64 5.770%

Bug: https://github.com/dart-lang/sdk/issues/37678
Change-Id: I12b26a9834b0f0f911ddcc6e8e5ff4573272607d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116885
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-16 00:22:56 +00:00
Liam Appelbe 329d0913ca [vm] Late modifier for non-final local variables.
I also added a test for top level late variables (they already worked).

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I6720e6476a067c7f8b21a34b87b23ab14fc866a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125224
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-11-15 23:03:16 +00:00
Ryan Macnak a8b3773054 [vm, reload] Guard against field loads that no longer conform to the field's static type.
Fix incorrect type arguments when noSuchMethod forwarders allocate Invocation's typeArguments.

Change-Id: I0fd2782bc96f500f31dbbdd2aa896c8caf1f0045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123692
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-11-15 22:55:26 +00:00
Fizaa Luthra ea6c7f29fa [fuzzer] Added void functions to the API table
Change-Id: I048607903ba15f604a9d0784b75061ac0d0d397c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125305
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-11-15 19:07:54 +00:00
Martin Kustermann c5b87f2a01 [vm] Disable entire test (apparently status files can no longer disable individual multitests)
Change-Id: I9f7be990c28a76e124b8a54b7bcc0df76d64b9fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125406
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-15 16:58:48 +00:00
Alexander Markov 03c3eff5dd [vm] Support JIT exception handling in DART_PRECOMPILER mode
DART_PRECOMPILER define is used when building gen_snapshot and
run_vm_tests. Both gen_snapshot and run_vm_tests support AOT and
JIT modes, selected by FLAG_precompiled_mode.

Before this change, DART_PRECOMPILER always used AOT exception
handling (catch_entry_moves_maps). This works fine even if code is
generated in JIT mode, but it is not compatible with JIT exception
handling. run_vm_tests uses kernel service which comes from app-jit
snapshot (on x64), which is generated in JIT mode with JIT exception
handling. This causes crash if there is a Dart exception in kernel
service.

This change adjusts exception handling in DART_PRECOMPILER mode to
support both AOT and JIT implementations and select one using
FLAG_precompiled_mode.

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

Change-Id: I6c9ce05552a98bd4eeaea18c082a98e9bdbe9460
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125302
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-15 16:14:15 +00:00
Martin Kustermann 5f18b77d39 [vm/reload] Disable vm/dart/isolates/spawn_function_test/0 until full IG reloading is implemented
The test explicitly passes --enable-isolate-groups (off by-default in JIT).
It will be enabled once full hot-reload with multiple isolates in one IG is implemented.

Change-Id: I8c71a948406f6911c450161a3b5b0b0c0519b0d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125403
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-11-15 15:54:55 +00:00
Martin Kustermann 20962e656b [vm/concurrency] Split up IsolateReloadContext into IsolateReloadContext/IsolateGroupReloadContext
Similar to the split of ClassTable into ClassTable/SharedClassTable,
this CL splits up the IsolateReloadContext into:

  * IsolateGroupReloadContext: Consists of reload-related information across all
    isolates. The [Reload()] method is split up in phases that are
    performed on all isolates before the next phase is started.

    => This allows each isolate to add reasons for rolling back, if no
       reasons are found the reload will be accepted atomically.

  * IsolateReloadContext: Constists of reload-related information for a
    particular isolate (e.g. mappings of old to new classes)

The assumption is that all isolates have the same source (and therefore
the same libraries). For certain things, e.g. discovering which libraries
changed, it is necessary to examine the object store. We use the first
isolate in a group (but could use any of them) to do so, since the
isolate group does not have this information atm.

This is a preparation CL for supporting hot-reloading multiple isolates
within one isolate group. Though the support in this CL stays at having
only a single isolate in a group.

  => This CL turns off FLAG_enable_isolate_groups in JIT mode.

Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I7f4d536d4f5ab4a2a73fb0c7618ba967c9b77234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123254
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-11-15 14:08:45 +00:00
Sigmund Cherem a75ffc8956 Add non-NNBD language version marker to all sdk (non-nnbd) files
This is practically a copy of the change in
https://dart-review.googlesource.com/c/sdk/+/118040 but applied to the non-nnbd
sdk.

Even though there is no intent to run the non-nnbd sdk with the non-nullable
experiment, we need to add this annotation because of how we
intend to gradually start testing NNBD. The libraries.json under
sdk_nnbd is allowed to point to libraries under the non-nnbd sdk in order to
temporarily build without errors until all patch files are migrated and all CFE
issues are addressed.

Change-Id: I53c1123a8d86c10695832a8a0ad35adb7b4d92fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125181
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-11-15 00:22:47 +00:00
Régis Crelier ebd9af9043 [VM/precompiler] Relax assert when compacting symbols (fixes #39298).
Canonical recursive types are not guaranteed to be unique.

Change-Id: Ic659f5e563c63ec8ee56dc0c9ae9a117fce8be07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125231
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-15 00:15:32 +00:00
Fizaa Luthra 8eb13e5eda [dartfuzz] Restrict size parameter to a small integer for List<int>.filled
Change-Id: I8ebb3167a4b9d7c81d8fe9d1a45df8fd53933741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125301
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-11-14 22:54:12 +00:00
Ryan Macnak b39ab2e6ac [vm] Don't unroll initialization code based on macro lists.
-47k (-0.20%) out/ProductX64/exe.stripped/dart
 -8k (-0.17%) out/ProductX64/exe.stripped/dart_precompiled_runtime

Change-Id: Id3f6c451acf69ba7965ae51a0a3c4a8aa9ab1d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115775
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 19:11:38 +00:00
Ryan Macnak bbd88424ac [vm, gc] When evaluating idle GC, check only for enough time to start concurrent marking, instead of enough to run a full GC.
Don't trigger an interrupt when concurrent marking finishes, which could trigger cause synchronous finalization in the middle of a frame; instead wait for the next allocation failure or idle notification.

Change-Id: I969c7e8de05ee1eb70103eda2df98cb2320085b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125082
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-14 18:51:54 +00:00
Sigmund Cherem d2c63991ae Improve NNBD testing support
The goal of this change is to make it possible to start iterating on nnbd tests
for DDC. This keeps the current philosophy of keeping NNBD and non-NNBD build
configurations separate, except that NNBD builds are allowed to consume library
sources from the non-nnbd sdk.

This change addresses the first set of errors that are encountered when trying
to build a fully NNBD configuration:
  * CFE has issues with type promotion, for that reason we remove
    `--enable-experiment=non-nullable` in vm build rules, and we use a smaller
    training data when creating the dartdevc app-jit snapshot.
  * We'd hit compile-time errors with nnbd libraries with inconsistent
  patchfiles. To avoid that, the libarries.json points to the non-nnbd SDK
  sources for most dart:* libraries.

Change-Id: Ie6226b3bd8a92b4a1632dd84a5db2f04238fd4f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125080
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-11-14 18:28:20 +00:00
Samir Jindel 6c5033acac Re-land "[vm/async] Don't add an <asynchronous gap> marker along sync-async calls."
Original change is in patchset 1.

The issue was that the expected "_Closure.call" frame is not always present.

Change-Id: I91116861e785a72536dde300f4771de4f6fa9d3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124988
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 15:29:16 +00:00
Samir Jindel dd7760a07d [vm] Support disassembling snapshot code at runtime for JIT and AOT snapshots.
--code-comments should be passed both at compile/training-time and run-time to get
comments in the disassembled instructions.

The required --disassemble-* flags need only be passed at run-time. Flow-graph printing
is not yet supported because we don't save flow-graph like assembly comments.

This functionality is excluded from product builds.

Change-Id: If35fbb08cff6eae40069f916ecec9c6f589c0cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124989
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 14:09:21 +00:00
Clement Skau 7b3aa88ebe [SDK] Adds background compiler skip for annotations.
A similar abort was removed in the refactor in 5cce1e4a.

Change-Id: I9921c3f9f2bbe36c4560388471f93356c2d1f12d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125200
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 14:01:16 +00:00
Teagan Strickland dc808f3fcb [vm/compiler] Canonicalize CompressedStackMaps payloads when possible.
When we are writing a snapshot, canonicalize all entries within
CompressedStackMaps payloads. We do this by creating a global table
of stack map information (bit counts + bit payload) that we store
in the isolate object store, and then for each existing CSM, we
replace it with an alternate version that refers to the global table.
This gets back some of the canonicalization we lost when we moved from
individual StackMap objects to per-Code CompressedStackMaps objects.

Here, we also represent the global table as a CompressedStackMaps
object. This means that there are three types of CompressedStackMaps:
 * The original version that directly contains all entry information.
 * The version where each entry is just the PC offset delta and an
   offset into the global table payload.
 * A version representing the global table where the entries are like
   the original version except they don't contain a PC offset delta.

-----

The impact on AOT snapshot size when compiling the Flutter Gallery
in release mode:

   armv7: Total size -0.88% (Isolate RO: -5.05%, Isolate snapshot: +0.00%)
   armv8: Total size -1.04% (Isolate RO: -5.28%, Isolate snapshot: +0.00%)

-----

Bug: https://github.com/dart-lang/sdk/issues/35274
Change-Id: I1ce0f8b3cc58e2f11584f3c218e0fdf8984b799b
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120667
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 12:49:06 +00:00
Régis Crelier dc35290111 [VM/nnbd] Reland of 3 reverted CLs and fix for canonicalization of legacy types.
The 3 relanded CLs are:
https://dart-review.googlesource.com/c/sdk/+/124480
https://dart-review.googlesource.com/c/sdk/+/124587
https://dart-review.googlesource.com/c/sdk/+/124920

The additional fix is:
https://dart-review.googlesource.com/c/sdk/+/125128

This fixes https://buganizer.corp.google.com/issues/144304690

Change-Id: Ica5ae249d738cab0b5d1885a01ddef2757c07174
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124906
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-14 02:10:15 +00:00
Ryan Macnak 9223b9d844 [vm, gc] Change CollectAllGarbage to ensure there is no floating garbage caused by incremental marking.
Fix vm/cc/OldGC_Unsync to not change FLAG_marker_tasks while incremental marking is in progress.

Fix vm/cc/IterateReadOnly to not mark the heap as read-only while marking or sweeping are in progress.

Remove unnecessary WaitForGCTasks leftover from background finalization.

Bug: https://github.com/dart-lang/sdk/issues/39299
Change-Id: Ib3340e514b44230b9735b74b1f2012ca9b998d50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124824
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-14 02:08:35 +00:00
Fizaa Luthra e5655d5cfe [dartfuzz] Make generic types explicit when using API table
Bug: https://github.com/dart-lang/sdk/issues/39356
Change-Id: I04244bbac578dd6b399e664d381f1dab0a5852da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124910
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-11-14 01:19:15 +00:00
Ryan Macnak 9cd6c01bfd [vm, gc] Add a release barrier to prevent header initialization during promotion from being ordered after publishing stores of that object.
Compare 6354b0b97d, which did the same for direct old-space allocations.

Change-Id: Ifc047b48dfa10891ea7f1b39794f5fdbc7cf2ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-14 00:50:46 +00:00
Ryan Macnak 64329c879d [vm, docs] Describe how to run size analysis for Flutter apps.
Change-Id: I11d9ca7f3668a8705753bb9a0db261a3871fb93e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125126
Reviewed-by: Zach Anderson <zra@google.com>
2019-11-13 21:34:57 +00:00
Liam Appelbe a0bb025024 [vm] Late static final fields
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: Ic40002ab0e6ded6d525ee5e1c218a589b9406c8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125005
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-13 17:56:08 +00:00
Siva Annamalai 082c10aab7 Revert "[VM/nnbd] Pass nullability when creating Class::DeclarationType."
This reverts commit ea57b1e62c.

Reason for revert: Please see https://buganizer.corp.google.com/issues/144304690

Original change's description:
> [VM/nnbd] Pass nullability when creating Class::DeclarationType.
> 
> Passing nullability rather than forcing kLegacy helps slightly reduce the number
> of Types in the VM and in snapshots.
> This allows to remove the kludge about declaration type of Null being kNullable.
> Also pass nullability when creating a simple type may help.
> 
> Note that CFE is still producing super types and some interface types that are
> non-nullable, even with nnbd features disabled. But this should get fixed and
> further reduce the number of types in the snapshot.
> 
> Change-Id: I397f00902026ee5bc91d36328f4156427702efdb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124480
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Icae0a69cda6cc531bba4d5d12471e7267a277340
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125102
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-13 02:06:02 +00:00
Siva Annamalai b4779e8f72 Revert "[VM/nnbd] Make Nullability and NNBDMode class enums to avoid name conflicts."
This reverts commit d45c3d15cb.

Reason for revert: Please see https://buganizer.corp.google.com/issues/144304690
(This CL is dependent on https://dart-review.googlesource.com/c/sdk/+/124480 which caused the regression).

Original change's description:
> [VM/nnbd] Make Nullability and NNBDMode class enums to avoid name conflicts.
> 
> Change-Id: Ic78d3f48964bb61cbd1d90a69fcd68b4f29071e4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124587
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,regis@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I24603236f04bd2ec1ad80789d78cca89e70fb1d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125101
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-13 02:01:44 +00:00
Siva Annamalai 82aa7e79af Revert "[VM/nnbd] Force the DeclarationType of a class to have legacy nullability."
This reverts commit 3771dddf43.

Reason for revert: see https://buganizer.corp.google.com/issues/144304690
(This CL is dependent on https://dart-review.googlesource.com/c/sdk/+/124480 which caused the regression).

Original change's description:
> [VM/nnbd] Force the DeclarationType of a class to have legacy nullability.
> 
> This is a workaround to avoid caching a non-legacy type (possibly provided
> by the CFE) as the canonical type of a non-generic class and later returned as
> the runtime type of an instance of this class.
> 
> Hopefully fixes https://buganizer.corp.google.com/issues/144304690
> 
> Change-Id: Iaea364b9b743b05bde600f0aa784d5a8105728d7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124920
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com

Change-Id: If8b2671f3cf4b0d080ba9f0472738326fec701d3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125100
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-11-13 01:55:18 +00:00
asiva a7472ba4c6 Cache value of "non-nullable" flag so it can be used in the VM code without having to search through the array of experimental flags array.
Change-Id: I297dca48711ef2bdd80a102086dea1bb075ea357
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125081
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-11-13 01:40:36 +00:00
Liam Appelbe 2a9af7d953 [vm] Late modifier for non-final static fields.
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I8e6feef2c0ee8021bec2f849e9729516532ca91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124641
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-12 17:27:39 +00:00
Régis Crelier 3771dddf43 [VM/nnbd] Force the DeclarationType of a class to have legacy nullability.
This is a workaround to avoid caching a non-legacy type (possibly provided
by the CFE) as the canonical type of a non-generic class and later returned as
the runtime type of an instance of this class.

Hopefully fixes https://buganizer.corp.google.com/issues/144304690

Change-Id: Iaea364b9b743b05bde600f0aa784d5a8105728d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124920
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-12 16:26:29 +00:00
Aske Simon Christensen 5cce1e4acd Reland "[vm] Remove obsolete kernel constant expression evaluator."
Change-Id: I8a822afb99a72adf5a47643807c9bc3be5b2e811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124693
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-11-12 12:32:08 +00:00
Ryan Macnak be6e5d8717 [vm] Try to symbolize Dart frames on crash or assertion failure when there is an exit frame.
Remove disabled/broken symbolization based on heap iteration.

Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=41154
Change-Id: I5e6644e6ef72177cefec920fbe653000a4868f5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124826
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-11 23:56:00 +00:00
Alexander Markov b4ab28fef1 [vm/bytecode] Do not declare receiver variable in closures
While 'this' variable (receiver) is in scope in closures inside
instance methods, closures do not take it as a parameter and they
shouldn't declare a local variable for receiver unless it's captured.

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

Change-Id: Ic5c735fd50457a5fb39acb3ec3590964e4dddba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124825
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-11 21:51:57 +00:00
Régis Crelier b5110a59a9 Revert "[vm/async] Don't add an <asynchronous suspension> marker along sync-async calls."
This reverts commit f4d930997b.

Reason for revert: Different tests are failing on different bots.

Original change's description:
> [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
> 
> This fixes `package:stack_trace` in the sync-start case of async/async* calls.
> 
> Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com

Change-Id: Ib3e1b303613f0393dac6b1b81e8d1ffb322052b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124800
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-11 19:03:54 +00:00
Samir Jindel f4d930997b [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
This fixes `package:stack_trace` in the sync-start case of async/async* calls.

Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-11 16:36:43 +00:00
Aske Simon Christensen 6f70d7f5a3 Revert "[vm] Remove obsolete kernel constant expression evaluator."
This reverts commit e8de03915b.

Reason for revert: Hits assert in ConstantInstr

Original change's description:
> [vm] Remove obsolete kernel constant expression evaluator.
> 
> Change-Id: I16c515135468e526263db180f7252e7fdebe6414
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111643
> Commit-Queue: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,askesc@google.com

Change-Id: Iae7107b471369a86708e812fafde6bf38efcbb49
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124692
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-11-11 13:52:25 +00:00
Aske Simon Christensen e8de03915b [vm] Remove obsolete kernel constant expression evaluator.
Change-Id: I16c515135468e526263db180f7252e7fdebe6414
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111643
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-11 10:32:24 +00:00
Wink Saville bbdb7860f6 [build]: Build on Arch Linux with python 2.7-3.8
This change allow builds to succeed on Arch Linux with python 2.7, 3.7.4
and 3.8. Otherwise it fails with python 3.7.4 and 3.8.

- bin_to_assembly.py

  Using ord(byte) here is an error on python 3.x use a conditional
  expression instead.

- create_archive.py

  Using ord(byte) here is an error on python 3.x use a conditional
  expression instead.

  Use `as inst` syntax which is required by 3.x

- create_string_literal.py
- gen_library_src_paths.py

  Use `as inst` syntax which is required by 3.x

- make_version.py

  print >> sys.stderr syntax is not supported by 3.x use file=sys.stderr
  and add `from __future__ import print_function`

  vmhash.update requires a string use encode('utf-8')

  versopm+cc+text.replace requires a str so use `decode`.

Test: No added tests as there are no behavioral changes.
Change-Id: Id9b0a3187d06ad2b2dce3cf2244144393caddc9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124211
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-11-10 21:09:58 +00:00
Fizaa Luthra 1b344fc77e [dartfuzz] Add fuzzer support for extension methods for classes
Change-Id: I3843990921d93727e17dd2593177bdf7af740571
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123340
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-11-09 01:26:59 +00:00
Régis Crelier d45c3d15cb [VM/nnbd] Make Nullability and NNBDMode class enums to avoid name conflicts.
Change-Id: Ic78d3f48964bb61cbd1d90a69fcd68b4f29071e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124587
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-08 21:32:48 +00:00
Régis Crelier ea57b1e62c [VM/nnbd] Pass nullability when creating Class::DeclarationType.
Passing nullability rather than forcing kLegacy helps slightly reduce the number
of Types in the VM and in snapshots.
This allows to remove the kludge about declaration type of Null being kNullable.
Also pass nullability when creating a simple type may help.

Note that CFE is still producing super types and some interface types that are
non-nullable, even with nnbd features disabled. But this should get fixed and
further reduce the number of types in the snapshot.

Change-Id: I397f00902026ee5bc91d36328f4156427702efdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124480
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-08 18:40:59 +00:00
Alexander Markov fa43799461 [vm/bytecode] Check number of type arguments in non-generic closures
Fixes https://github.com/dart-lang/sdk/issues/39283

Change-Id: I5a5fdf158c6a7ce068be36754ea0487cb754584b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124470
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-08 17:16:37 +00:00
Liam Appelbe f4780a6450 [vm] Late modifier for non-static final fields.
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: Ib2b3189b20bd056b6378fa5d7a6166acef9a5c67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124465
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-11-07 23:50:57 +00:00
Ryan Macnak 23770fcc6c [vm, gc] Increase HeapPage size to 512k; increase max heap size to 32GB.
Change-Id: I0d5649d37a73caea39d3f703f429a4af7b4c29c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113950
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-07 22:45:47 +00:00
Samir Jindel 43329adf84 [vm/aot] Remove uses of blobs from tests and scripts.
Change-Id: I03ccdba1f45ddb1b6774557d55b8fd47f87c7dd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121842
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-07 14:06:07 +00:00
Samir Jindel e85184eb72 [vm/aot] Put all non-writable segments together to work around bug in Jelly Bean.
Fixes https://github.com/flutter/flutter/issues/43259

Change-Id: I8c9041baf34bd07bf203469d0ebfbb2e6379ee08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123733
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-07 14:01:07 +00:00
Ryan Macnak d3d19f3ca5 [vm, gc] Fix a case of dropping safepoint interrupts.
Consider the interleaving:
  Mutator: read stack limit (generated code)
  Mutator: read safepoint requested (RUNTIME_ENTRY)
    Helper: set safepoint requested
    Helper: set stack limit (ScheduleInterrupts)
  Mutator: clear stack limit  (GetAndClearInterrupts)

Bug: https://github.com/dart-lang/sdk/issues/39246
Change-Id: I5640c65eee514bb8f58779a472530cfe05d368a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124280
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-06 23:43:53 +00:00
Liam Appelbe 2ae9b6f653 [vm] Handle late fields with no initializer.
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I23526e7e8cc5928c22c53414dd201c07199b9610
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124210
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-11-06 23:39:22 +00:00
Régis Crelier 4b9638aaa1 [VM/nnbd] Use a single byte in snapshot to write flags and nullability of types.
This saves one byte per Type and per TypeParameter objects in the snapshot.

Change-Id: Ie5241c992a5c5cc6b3d7a211f20e7a0ddbd00b72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-06 22:44:33 +00:00
Liam Appelbe c154677699 [vm] Handle trivial initializers for late fields
Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I9db9d4815ad27f3f97d43a7a9f1fb74f08673528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124201
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-06 17:46:32 +00:00
Zichang Guo 46ae3e4e7a [vm] not remove port if socket was listening by other isolates
Crashes come from assertion in ReturnTokens() and new_mask() in Eventhandler.
Another issue is when multiple serversockets bind to the same address, Socket will be reused to all Dart_Ports. But Socket didn't keep track of corresponding Dart Port.
When one of isolates is killed, finalizer wakes up and close most recent Dart Port that sends data.

After this cl, Socket may not be reused by different Dart Sockets. All Dart socket will has its own Socket object. But Sockets can have same fd.
This will guarantee finalizer will close right Dart Port.

Bug: https://github.com/dart-lang/sdk/issues/36106
Change-Id: Ib4620ada5f120ffda719052297009280c73b4315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122490
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-06 16:28:12 +00:00
Martin Kustermann e31c7ff591 [vm/concurrency] Move idle timeout detection from message handler to [Isolate]
Right now a message handler is taking care of detecting idle timeouts
and notifying the isolate (or rather it's heap) that a compaction can
start.

Once we move the heap to the isolate group, we should only notify the
heap that we're idle if *all* isolates are idle. As a preparatory step
we move the idle timer functionality into it's own class and make the
isolate own it.

When the heap gets moved from isolate to isolate group, we'll also move
the idle time handler.

Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: If9b244baf0425ef343f909ee3a8a1147f966845b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116200
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-11-05 20:25:43 +00:00
Ben Konyi f908fb67ce [ VM / Service ] Fix potential race in service test helper
We attempted to delete the file with service protocol information
immediately after retrieving the URI. However, the spawned process could
potentially still have that file open which will cause the deletion to
fail on Windows. Fix is to wait until the process closes before deleting
to ensure it's not holding onto the file.

Change-Id: I85f715ad0570d121365373d498e539a667bd9d02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124165
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-11-05 20:21:43 +00:00
Liam Appelbe 1f8ef384d9 [vm] First pieces of late modifier implementation.
This implements the logic for initializing, getting, and setting
non-final instance fields that have initializers. It doesn't address
statics, finals, local variables, or the no-initializer case, and is
only implemented for bytecode.

Bug: https://github.com/dart-lang/sdk/issues/38841
Change-Id: I3b9e2772abdc04e3bfede56d2fcf06738f234cbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122489
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-05 19:48:03 +00:00
Aske Simon Christensen 8bdca37e98 [vm] Bump minimum kernel version to 29.
This paves the way for removing the old constant evaluator from the VM,
by no longer supporting versions without front-end constant evaluation.

For the front-end test that tests old kernel versions on the newest VM,
the dill files for versions before 29 are deleted.

Version 29 is from 2019-08-16: eae781c73e

Change-Id: Icb472bffc764d6e37ed1349a0cb4ff281e0e1b21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123739
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-11-05 13:31:41 +00:00
Konstantin Shcheglov 0804a6f260 Don't use deprecated analyzer elements in dartfuzz.
Change-Id: Ib6a1ddb831854c60604fa57aeac2103443ee8efe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124101
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-11-04 22:37:45 +00:00
Alexander Markov 5279b6438c [vm/bytecode] Fix raw casts in DynamicCall in the interpreter
This is the follow-up for https://dart-review.googlesource.com/c/sdk/+/123920.

RAW_CAST macro in the interpreter doesn't properly handle objects of
subclasses of a tested class (e.g. RAW_CAST(String, x) fails in debug mode
if x is OneByteString). So this CL replaces a couple of recently added
RAW_CAST with a more reliable RawCast.

Change-Id: Ifa94ce79985a5ae60c6f4d86ff7552b5124f649c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124102
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-04 20:28:37 +00:00
Martin Kustermann ab5cf0f854 [vm] Ensure create_sdk GN build has working dart2native iff AOT is supported
This CL

   * adds a GN flag "include_dart2native" off by-default (switched on explicitly for our GN build)
   * ensures every GN build of the "create_sdk" target has a working dart2native (except ia32)
   * removes not-working dart2native script from ia32 dart-sdk (no AOT support in ia32)
   * removes the "dartaotruntime" GN target, since it is the same as "dart_precompiled_runtime"

This should ensure every downstream consumer of the "create_sdk" GN target will
have a working version of dart2native.

For the particular "dart-sdk" we create on dart-sdk-{linux,windows,mac}
we will override the default AOT compiler&runtime with the product mode,
which produces smaller AOT snapshots and has smaller AOT runtime (making
the native executables significantly smaller)

Change-Id: Ib5042589297cdb055c41dc56abdff86a4612ef5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123724
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2019-11-04 12:01:56 +00:00
Alexander Markov ed1910006c [vm/bytecode] Cleanup support for bytecode format before v20
Bytecode format v20 was introduced Sep 06 2019 in
https://dart-review.googlesource.com/c/sdk/+/116120.
This change drops support for older bytecode format versions from VM.

Change-Id: I11b75ba16e6b7570e0346f9ac024265b08c0c801
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123920
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-01 20:36:32 +00:00
Ryan Macnak d96cd87896 [vm, reload] Initialize new fields in existing instances lazily.
Change-Id: I29c52feba2a404a7910888ce2bbb46e9aa8dd50f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123547
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-01 20:06:52 +00:00
Alexander Markov 8b67fcbbd1 [vm] Cleanup script tags
VM creates Script objects with kKernelTag only, so this CL cleans up
all uses of script tags and Script::kind() along with code
which is no longer reachable.

Change-Id: Ia765e7757264aa614e18eddd16d21937f855c129
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123889
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-01 19:08:42 +00:00
Alexander Markov ebc6340e36 [gardening] Skip bytecode_with_ast_in_aot_test on crossword-ast bot
Fixes https://github.com/dart-lang/sdk/issues/39199

Change-Id: I290d286d0cb2a04cf516ed1c4b5b6db03dcac1c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123887
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-01 17:17:12 +00:00
Ryan Macnak 79c7d3d8bc [vm] Always use bytecode when it is present in a kernel file. Let FLAG_use_bytecode_compiler only control whether the kernel isolate generates bytecode.
We no longer generate kernel files containing both AST and bytecode, so we don't need a flag to choose between them.

Change-Id: I1a4f7df507c649019c9fe254fa18a5826e2006aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122402
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-01 17:06:02 +00:00
Régis Crelier df678dbec0 [VM/nnbd] Introduce type Never in VM and bytecode.
Introduce enum NNBDMode for subtype test checking mode.

Change-Id: Id9c39ee8c975c664ac58e313b7dd05e6e219dfc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123557
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-01 00:43:59 +00:00
Ben Konyi 917ba19c1a [ VM / Service ] Remove flaky portion of get_flag_list_rpc_test
Change-Id: I307589d3b38d15dee5e4c05020fa8d733241c7db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123695
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-11-01 00:23:50 +00:00
Ben Konyi bc6cadfac4 [ VM / Service ] Fix get_flag_list_rpc_test for real this time
Change-Id: I41c31d06ba1a685275b1a7d66baaecd5deaf4fa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123821
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-10-31 23:40:57 +00:00
Ben Konyi 3224a6633b [ VM / dart:io ] Replace usage of SecTrustEvaluate with SecTrustEvaluateWithError on MacOS >= 10.14
SecTrustEvaluate is now deprecated as of 10.15.

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

Change-Id: Id057ef47d4c4be0ad012203dbabc0266be58ad8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123556
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-10-31 22:17:17 +00:00
Ben Konyi 0dd494bc54 [ VM / Service ] Fix get_flag_list_rpc_test failing on release builds.
Change-Id: I1976bb80463da728acc6178707a22cb4b7013c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123693
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-10-31 21:59:54 +00:00
Alexander Markov 8a09d7ab5a [vm/bytecode] Remove alignment of sections in bytecode
Previously, before switching to compact encoding of bytecode
instructions, we had to align bytecode instructions by 4.
Since that time sections of bytecode binary were aligned.

However, this alignment doesn't work well in AOT mode if dill file
contains both bytecode and AST, as other metadata (such as obfuscation
prohibitions) may precede bytecode metadata and may make the whole
bytecode binary misaligned.

This results in incorrect calculation of section offsets,
failed assertion

  assert(writer.offset - start == section.offset);

and VM may fail to load bytecode binary with error

  bytecode_reader.cc: 1368: error: unreachable code

In order to fix these problems, extra alignment of bytecode
sections is removed.

Change-Id: Iaa3b7c46999615aaa446781a7018db409261ead8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123686
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-31 21:37:44 +00:00
Filip Filmar d9b069b27d [vm] Use fuchsia.deprecatedtimezone
This sets us up for migrating away from a dedicated timezone service
into a more general `fuchsia.intl.*`.

As a first step, let's use only one of the two equivalent FIDL service sets.
In fuchsia they are implemented by exactly the same handlers, so are equivalent
to the best of my knowledge.

Fixes #39174.

Change-Id: I229670bb96816af808a0cb14e6d2cba283f9ef62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123487
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-31 21:34:49 +00:00
Ben Konyi 60c34ac420 [ VM / Service ] Allow for the profiler to be enabled/disabled via SetFlags RPC
Disabling the profiler will **not** release the sample buffer on Linux,
MacOS, and other platforms which utilize signals for profiling as
there's no way to ensure all signals have been receieved after the
thread interrupter has been shutdown.

Change-Id: Ifb3230fdb95e9bc9147cbd4b85d1a84e976ce119
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123554
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-10-31 21:18:38 +00:00
Ryan Macnak b164a892e2 [vm] Fix spurious MSAN failures when accessing arguments to runtime calls.
Compare existing logic for arguments to native calls.

Change-Id: I89479ac913a10d92ddb871beb2da838c82a53f23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123488
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-30 21:55:25 +00:00
Jason Simmons 262fadc6cf Change the type of RetainingPathItem.parentField to String in the observatory
This matches a change in the type of parentField within the VM service
(see https://dart-review.googlesource.com/c/sdk/+/108560)

Change-Id: Ib0d20c79bb26a3674cef1c52bf9509fb316bb52c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123472
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2019-10-30 17:36:14 +00:00
Martin Kustermann 4ea512b4c1 [llvm_codegen] Use exclusively SExpression support from VM and nothing else.
The LLVM code generator should only consume the serialized IR and not use any other VM functionality.
This CL adds a custom zone which can be used for the deserialized IR nodes and removes any
Dart_SetVMFlags/Dart_Initialize/ApiZone/... calls.

This works with the existing example:

    % ninja -C out/ReleaseX64 codegen
    % out/ReleaseX64/codegen runtime/llvm_codegen/test/codegen/Inputs/hello.sex
    ...
    define void @"hello.dart::main"() {

    B1:
      %0 = call i8* @llvm.stacksave()
      %1 = ptrtoint i8* %0 to i64
      %2 = load i64, i64 addrspace(256)* inttoptr (i64 72 to i64 addrspace(256)*)
      %3 = icmp ult i64 %1, %2
      br i1 %3, label %4, label %5
      ...
      ret void
    }
    ...
Change-Id: I1d07ba6bc122d100c73f97cfa961d36240489666
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120792
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Teagan Strickland <sstrickl@google.com>
2019-10-30 16:27:04 +00:00
Maxim cb2f45ea6b Fixed Dart->C++ mapping of IPPROTO_IPV6 socket option
Fixes mapping of Dart `RawSocketOption` in `RawSocketOption_GetOptionValue` function.

Closes #39165
https://github.com/dart-lang/sdk/pull/39165

GitOrigin-RevId: 696478de091bfb2221edc565ff55d4e69b1b2e1f
Change-Id: Ibcd67a25ab2f85d30696a6050bf844a5b09aa819
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123440
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-10-30 14:53:54 +00:00
Régis Crelier eb4ab61349 [VM/nnbd] Duplicate workaround to force nullability of Null type.
This is a follow up to https://dart-review.googlesource.com/c/sdk/+/121414.
This duplicates a workaround used when reading bytecode and applies it also when
reading binary kernel.

Change-Id: I9522da185a76c4a4aa8b98aaf60c6e2f923660ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123474
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-10-30 01:32:05 +00:00
Régis Crelier efb4511916 [VM/nnbd] Propagate nullability info on types from kernel to VM and bytecode.
Change-Id: I2f2b5819a58d55b60aaf82418e0d2feaad4aaa32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121414
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-10-29 23:39:36 +00:00
Alexander Markov ae5a86d790 [vm] Fix Script::GetTokenLineUsingLineStarts to work on scripts without line numbers
Scripts loaded from kernel AST always have non-null line_starts
(line_starts could be zero-length if there are no line numbers).
Scripts loaded from bytecode can have null line_starts if line
numbers are not present, so Script::GetTokenLineUsingLineStarts is
fixed to handle this correctly.

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

Change-Id: I84b5e7ef804b07b3d35420eba5c17246264d8baa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123482
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-29 21:29:56 +00:00
Ryan Macnak b34f11adbd [vm, gc] Remove expensive, low-value GC verification flags.
--verify_gc_contains is roughly O(heap^2) and gives false errors in some cases involving remembered cards
--verify_on_transition takes over 30 minutes for even hello world

Change-Id: Idee7e535bb96b11f0fa620532debbd21ca9d7135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123329
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-29 19:25:16 +00:00
Alexander Markov 0b96f9f9ae [vm] Fix dropping values from the middle of the stack when there is a temporary variable
Fixes https://github.com/dart-lang/sdk/issues/39152

Change-Id: I62e7f1286f5b629ab4ff649aa15ce2b26872b7b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123342
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-29 01:39:55 +00:00
Martin Kustermann 5fba90b2f8 [vm/metrics] Ensure the metrics exposed by VM also include on-the-fly metrics
The lower-case "value()" metrics getter can only be used to obtain
metrics which are explicitly set by the VM.

The metrics we expose also include ones which are computed on-the-fly.
Those have to be accessed via "Value()".

Change-Id: I283c3c7c660d47c383b880b4bff6357a4dba9c01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123252
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-10-28 19:58:53 +00:00
Ivan Inozemtsev 5b69b31fc2 Remove unnecesary backslash after comment
Change-Id: Ia3e85ff0959daf67a9a14c0c5fdc1f6f8b800df1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123244
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2019-10-28 12:52:16 +00:00
Samir Jindel c885bdde1d [vm] DBC is obsolete. Remove dead code.
Change-Id: Ica33af158cca53c8e951e4b2582de83660e8a60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121851
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-27 18:18:29 +00:00
Ryan Macnak 6354b0b97d [vm, gc] Add a release barrier to prevent header initialization of an old object from being ordered after publishing stores of that object.
Compare f4f0831c69, which implicitly removed a barrier from PageSpace::AllocateBlack.

Bug: https://github.com/dart-lang/sdk/issues/39090
Change-Id: I3a9274b90875a6860cb102a238b6f95a6a7b2ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123004
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-25 22:16:05 +00:00
Aart Bik 74433e70da [vm/compiler] fix assertion bug in SSA builder
Rationale:
Our "front-end" may leave CreateArray on stack
in control-flow-collection (viz. BuildMapLiteral()
and BuildListLiteral()).

https://github.com/dart-lang/sdk/issues/39071

Change-Id: I423a431aa9fac985996fb09df6a98c46aed3d696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122960
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-25 20:11:17 +00:00
Alexander Markov 1cf7c40d32 [vm] Fix crash when AST constant references a not yet loaded bytecode class
Classes declared in bytecode are loaded lazily. So, in case there is
a mix of bytecode and AST kernel files, it's OK if AST constant
references a class which is not loaded yet, if that class is declared in
bytecode.

Change-Id: I6e28da7c6a97d19d88e16d6cd8abd0e9b61df388
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122847
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-10-25 19:55:09 +00:00
Ryan Macnak c873220e43 [vm, arm64] Adjust CSP during the invocation stub instead of each function prologue.
Since 6e2c4636cd, we have more reliable information about the stack limit.

This saves 8 bytes from each function.

Flutter Gallery:
Instructions(CodeSize): 6491472 ->  6375472 (-1.79%)
Total(CodeSize):       10375882 -> 10258802 (-1.13%)

Bug: https://github.com/dart-lang/sdk/issues/26472
Bug: https://github.com/dart-lang/sdk/issues/39083
Change-Id: I1d8e4c4bfd858eca1d0e4e5640faae15f4dbbe8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122845
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-25 19:21:56 +00:00
Dmitry Stefantsov 9910fa8454 [cfe] Implement the first part of NNBD-aware isSubtypeOf
This CL is a squashing of the following smaller CLs:

* https://dart-review.googlesource.com/c/sdk/+/120669/
* https://dart-review.googlesource.com/c/sdk/+/120670/
* https://dart-review.googlesource.com/c/sdk/+/121331/
* https://dart-review.googlesource.com/c/sdk/+/121381/
* https://dart-review.googlesource.com/c/sdk/+/121383/
* https://dart-review.googlesource.com/c/sdk/+/121620/
* https://dart-review.googlesource.com/c/sdk/+/121707/
* https://dart-review.googlesource.com/c/sdk/+/122144/
* https://dart-review.googlesource.com/c/sdk/+/122360/
* https://dart-review.googlesource.com/c/sdk/+/122381/
* https://dart-review.googlesource.com/c/sdk/+/122783/
* https://dart-review.googlesource.com/c/sdk/+/122787/

Change-Id: I9d850f531f0fce07055ff9b5cd39abb605752005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122868
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-10-25 16:37:39 +00:00
Alexander Thomas e62c7ae3bb [infra] Add legacy AST mode builder to the test-matrix.json
This also removes the now redundant bytecode testing from the dartkb
builders.

Replace the useKernelBytecode boolean option with a more flexible
genKernelOptions string list option.

See also See also https://dart-review.googlesource.com/c/sdk/+/122321/ for the
corresponding Luci config updates.

Change-Id: Iabb207bc02637b758c42c00ae9175bd52f46559f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122320
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-25 15:11:00 +00:00
Samir Jindel 36cd2e22d4 [vm/aot] Expose static symbols in directly-generated ELF snapshots.
Also use the function labels for Dwarf in Assembly snapshots to avoid creating
duplicate labels.

Fixes https://github.com/dart-lang/sdk/issues/38978
Issue https://github.com/dart-lang/sdk/issues/38526

Change-Id: Icafd3d3a86381990ec8097397a21b16ad4a7a766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122150
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-10-25 11:53:14 +00:00
Fizaa Luthra b42c2af535 [vm/compiler] Refactoring binary operation and unary operation evaluation logic
Rationale:
1) Centralize constant expression evaluation logic.
2) Avoid code duplication with constant folding in unoptimized code.

Bug:
https://github.com/dart-lang/sdk/issues/36409


Change-Id: I0ee4916e9e731df3dd8eb30dd5f182bc40e1dfa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122172
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Fizaa Luthra <fizaaluthra@google.com>
2019-10-24 22:30:57 +00:00
Clement Skau 17b5ddeeb8 [SDK] Adds tests for async stacktraces.
Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Id29704d086dbae066c8b34e347b75cd374b1ce2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121986
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-24 13:38:34 +00:00
Samir Jindel 79e5a3f1f7 [vm] Regression test for free-list protection.
Change-Id: Iea1a81ced0f53db1b2419f0b7a01be0a48c576a5
Fixed: 2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122645
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-24 12:13:53 +00:00
Teagan Strickland 772f961840 [vm/compiler] Use JSONWriter instead of manually creating JSON.
Change-Id: I9c05a2f88db3591b72015ac8d55f16f63af1c944
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122764
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-10-24 11:07:49 +00:00
Teagan Strickland 081c01e89a [vm/compiler] Fix remaining mismatches in late round trip.
Bug: https://github.com/dart-lang/sdk/issues/36882
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Change-Id: I20c5a8298f0f6444a326a63fe86ad106c3940317
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117543
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-24 09:48:06 +00:00
Ryan Macnak 86af66a3ee Revert "[vm, arm64] Adjust CSP during the invocation stub instead of each function prologue."
This reverts commit b5b322962a.

Reason for revert: low frequency of crashes in service tests

Original change's description:
> [vm, arm64] Adjust CSP during the invocation stub instead of each function prologue.
> 
> Since 6e2c4636cd, we have more reliable information about the stack limit.
> 
> This saves 8 bytes from each function.
> 
> Flutter Gallery:
> Instructions(CodeSize): 6491472 ->  6375472 (-1.79%)
> Total(CodeSize):       10375882 -> 10258802 (-1.13%)
> 
> Bug: http://dartbug.com/26472
> Change-Id: Ief1ddd25eecd32a8314c71fdb470dd73046e5dc0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122408
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,ajcbik@google.com

Change-Id: I0b45e1c81c1534e123dd85d27b7af27217e08795
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: http://dartbug.com/26472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122725
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-24 04:12:16 +00:00
Ryan Macnak b5b322962a [vm, arm64] Adjust CSP during the invocation stub instead of each function prologue.
Since 6e2c4636cd, we have more reliable information about the stack limit.

This saves 8 bytes from each function.

Flutter Gallery:
Instructions(CodeSize): 6491472 ->  6375472 (-1.79%)
Total(CodeSize):       10375882 -> 10258802 (-1.13%)

Bug: http://dartbug.com/26472
Change-Id: Ief1ddd25eecd32a8314c71fdb470dd73046e5dc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122408
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-24 02:40:43 +00:00
Aart Bik 434dc832c6 Revert "[vm] Avoid allocating monitors globally - embedders in certain situations will run into reported leakes due to them"
This reverts commit d9a306fc59.

Reason for revert:

=================================================================
==176913==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 13 byte(s) in 1 object(s) allocated from:
    #0 0x55d94882d540 in __interceptor_strdup /b/s/w/ir/kitchen-workdir/llvm-project/compiler-rt/lib/asan/asan_interceptors.cc:447:3
    #1 0x55d9491abcd7 in dart::KernelIsolate::AddExperimentalFlag(char const*) ../../out/DebugX64/../../runtime/vm/kernel_isolate.cc:382:28
    #2 0x55d9490af7d2 in dart::Flags::SetFlagFromString(dart::Flag*, char const*) ../../out/DebugX64/../../runtime/vm/flags.cc:338:7
    #3 0x55d9490b0221 in dart::Flags::Parse(char const*) ../../out/DebugX64/../../runtime/vm/flags.cc:399:12
    #4 0x55d9490b0538 in dart::Flags::ProcessCommandLineFlags(int, char const**) ../../out/DebugX64/../../runtime/vm/flags.cc:438:5
    #5 0x55d9488885df in dart::bin::main(int, char**) ../../out/DebugX64/../../runtime/bin/main.cc:1149:11
    #6 0x55d94888ad9a in main ../../out/DebugX64/../../runtime/bin/main.cc:1245:3
    #7 0x7f5ccc4a452a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2352a)

SUMMARY: AddressSanitizer: 13 byte(s) leaked in 1 allocation(s).


Original change's description:
> [vm] Avoid allocating monitors globally - embedders in certain situations will run into reported leakes due to them
> 
> Change-Id: Ied0446aebfdd8fb7e15c510cdf4160ff9ad013a6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122148
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I2c98bf7e0e565c6f8c016b4832d5587868c65a83
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122680
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-23 19:34:28 +00:00
Alexander Markov 10d237dffb [vm] Minor cleanup of KernelLoader
Removed a couple of unused KernelLoader members; several members
changed from public to private.

Change-Id: I3950a260e8476229ca7de2ee795cac581d307b29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122492
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-23 19:09:56 +00:00
Alexander Markov 9b3b52501f [vm,bytecode] Update vm/cc/IRTest_InitializingStores for bytecode
Fixes https://github.com/dart-lang/sdk/issues/38946

Change-Id: I798761d2476b30cde5a7fefaad609ffa4e80a85d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122484
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-10-23 19:09:47 +00:00
Daco Harkes 1a747c6546 [vm/ffi] Enable spilling floats in slow paths
Closes: https://github.com/dart-lang/sdk/issues/39068
Change-Id: I00d6fd82b7b5a56592bc4ab32bdc8b66fed67201
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try,flutter-engine-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122646
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-10-23 18:09:05 +00:00