Commit Graph

15405 Commits

Author SHA1 Message Date
Alexander Markov a0516965b4 [vm] Load top-level functions and variables lazily
LoadKernel part of startup: 409ms -> 196-210ms.
FinishTopLevelClassLoading: 15ms

Change-Id: If47f06fe235a70ed08e6a3d75e8f871edae5e45c
Reviewed-on: https://dart-review.googlesource.com/c/92155
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-02-07 18:12:34 +00:00
Ben Konyi fea5413d5a [ VM ] Fix hang of Flutter engine tests caused by global RuntimeEntry objects being destroyed when exit() is called when the VM hasn't finished shutting down.
This is due to how Windows destroys objects as destroyed objects have
their vtables reset to the vtable of the base class. If this happens
when an isolate hasn't finished shutting down and a virtual function
which is overriding a pure virtual function from the base class is
called, _purecall() is invoked and attempts to call exit() again which
leads to a deadlock.

See issue #35855 for more details.

Change-Id: I93a0e00549e7ee87a717a6cde01bf0848050384d
Reviewed-on: https://dart-review.googlesource.com/c/92000
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-02-06 22:37:24 +00:00
Aart Bik a5570bd995 [vm/compiler] Add optimization flag
Rationale:
See min-design doc.
Change-Id: Ic949a01ea2dcc873cf9e6d4d862e159be91da6f9
Reviewed-on: https://dart-review.googlesource.com/c/92161
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-02-06 22:16:12 +00:00
Samir Jindel d972c2b7b7 [vm] Update raw_object_fields.cc after 7e81f56a.
Change-Id: I5b738c31a0bd056c7720e0b0d66ec0c69cbae950
Reviewed-on: https://dart-review.googlesource.com/c/92129
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-02-06 12:20:22 +00:00
Zichang Guo 7e81f56ad7 Save Initializer for field and pass into debugger to enable breakpoint setting.
Change-Id: I9f7afcdd057f161873d3c6e47cb0ce171806f301
Reviewed-on: https://dart-review.googlesource.com/c/91120
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-02-06 03:20:35 +00:00
Alexander Markov e83b309354 [vm] Remove single-stepping from PRODUCT
Change-Id: I2884cc1feff563d05ca7d31f6154fbfda7922544
Reviewed-on: https://dart-review.googlesource.com/c/92025
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-02-05 21:51:55 +00:00
Alexander Markov 336969538c [vm/bytecode] Revise representation of types, constants and calls in bytecode
* Type arguments are moved to global object table (and de-duplicated).
* Finalize non-recursive generic types at bytecode generation time.
* Constants are moved to global object table (and de-duplicated).
* ICData creation is avoided for direct calls.
* Interface calls reference target member instead of selector name.

Size of a dilp files: 17868K => 15896K (-11%).

Change-Id: I0c9bf338137a0fae6ed90ab6b125ed2b24a1a8ad
Reviewed-on: https://dart-review.googlesource.com/c/91108
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-02-05 20:13:45 +00:00
Alexander Markov 9afb65d7f1 [vm] Fixes for recursive class loading
In --compile-all mode with CL [1] when NoSuchMethodError was finalized
the following happened:

ClassFinalizer::FinalizeClass calls KernelLoader::FinishLoading,
which calls KernelLoader::LoadProcedure to load precedures,
which calls Library::GetMetadata, which runs Dart code and triggers
background compilation; BackgroundCompiler::Start calls finalization of
NoSuchMethodError class recursively.

FinalizeClass calls FinishLoading for the second time, but this time
background compilation is not invoked, FinishLoading completes
and all members are finalized. After returning from recursive finalization,
the first FinishLoading proceeds and overwrites already finalized
functions with freshly loaded non-finalized functions.
As class is already marked as finalized, functions are not finalized
for the second time, causing crash later.

This CL fixes 2 problems related to recursive class loading:

* When fields are loaded, they should replace previous fields
  rather than appending them. This ensures that recursive loading
  won't add several duplicate fields (potential problem).

* IsLoaded flag is added to a class and checked after loading each
  procedure. If class happens to be loaded already, then FinishLoading
  should return immediately, discarding its loaded functions.
  This prevents overwriting finalized functions with freshly loaded.

Also, this change adds guard against repeated class loading (may happen
during recursive attempts of class finalization).

[1] https://dart-review.googlesource.com/c/sdk/+/91108

Change-Id: I5279a73f56fde26a8d9068912b3e08829ceaa4a8
Reviewed-on: https://dart-review.googlesource.com/c/91981
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-02-05 18:43:05 +00:00
Ryan Macnak d6caaeeebb [vm] Have Dart_TimelineEvent respect SUPPORT_TIMELINE instead of PRODUCT.
Remove unused Dart_GlobalTimelineGetTrace and Dart_SetEmbedderTimelineCallbacks, leftover from the days of Mojo.

Change-Id: Id9ea56734155c9c0ef4f23956e0043dddd5070c0
Reviewed-on: https://dart-review.googlesource.com/c/91768
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-05 18:26:05 +00:00
Martin Kustermann 7213306aad [VM/Compiler] Do not use unboxed doubles if target CPU does not support VFP
The optimizing compiler should never emit IL instructions which need FPU
registers/instructions if FlowGraphCompiler::SupportsUnboxedDoubles() is false.

Issue https://github.com/flutter/flutter/issues/26773

Change-Id: Ia72d239f448ee3ec7d156e70bfde3ba9501deccd
Reviewed-on: https://dart-review.googlesource.com/c/91830
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-02-05 09:57:52 +00:00
Samir Jindel 4b28312282 [vm] Remove reference to vm/flag_list.h in runtime/bin/main.cc.
Change-Id: I3a18487a0ef7ed9d50d54f539b9a815eb334c6b9
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/91923
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
2019-02-05 03:54:41 +00:00
Alexander Markov b59d5a2be9 [vm] Relax assertion about duplicated direct implementors
When mixin application is transformed, mixin is added to the end of
interfaces list. This may cause assertion failure if the same class
is used as mixin and mentioned among implemented interfaces.
This CL relaxes that assertion for mixins as this duplication is very
rare and seems harmless.

Note that it would not be valid to remove duplicated interface/mixin
from the list of interfaces, as it would break dart:mirrors in this case:
dart:mirrors needs to reflect duplicated interface/mixin both in
ClassMirror.superinterfaces (which is populated from the
list of interfaces without last element) and ClassMirror.mixin (the last
element in the list of interfaces).

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

Change-Id: I9b986f7759a76cb6f963ebd837e9ea26f6242f8e
Reviewed-on: https://dart-review.googlesource.com/c/91961
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-02-05 00:35:02 +00:00
Aart Bik 5823be65af [vm/compiler] Continued graph checker development (reland)
Rationale:
More assumption verified. Found some true issues.

Relands:
https://dart-review.googlesource.com/c/sdk/+/91702
with some fixes

https://github.com/dart-lang/sdk/issues/35803
https://github.com/dart-lang/sdk/issues/35819
https://github.com/dart-lang/sdk/issues/35848
https://github.com/dart-lang/sdk/issues/35849

Change-Id: I26101f8af3bd3fcdd5868d0882f8f096ab02b512
Reviewed-on: https://dart-review.googlesource.com/c/91945
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-02-04 23:18:42 +00:00
Ryan Macnak db7f848632 [vm] Remove dead BigInt code.
Change-Id: I2b7169c2cd0ea62849e67e8f34808bf566cde2fe
Reviewed-on: https://dart-review.googlesource.com/c/91944
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-04 22:40:42 +00:00
Alexander Markov 569ee07f91 [vm] Cleanup class finalization checks
Change-Id: If262b5fd271ce8fa0aaa49959f808792f66578cd
Reviewed-on: https://dart-review.googlesource.com/c/90580
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-02-04 21:00:49 +00:00
Alexander Markov bd51d6f120 [vm] Build scopes for implicit getters of static const fields
Usually implicit getters are not used for static const fields.
However, coverage can force their compilation. In order to compile
implicit getter of a static const field, its initializer is
evaluated in a constant evaluator. Initializer may have Let
expressions and can declare local variables.

Before this fix scope builder was not visiting initializer body for
implicit getters, which caused crashes in constant evaluator.

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

Change-Id: I807aeaa90886d84169c27275abdd0cfd0f3ff777
Reviewed-on: https://dart-review.googlesource.com/c/91705
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-02-04 19:03:39 +00:00
Aart Bik b876d12f03 Revert "[vm/compiler] Continued graph checker development"
This reverts commit b01697ba5a.

Reason for revert: we have two check fails on bleeding edge
                    reverting this until we found the underlying issue

Original change's description:
> [vm/compiler] Continued graph checker development
> 
> Rationale:
> More assumption verified. Found some true issues.
> 
> Bug:
> https://github.com/dart-lang/sdk/issues/35803
> https://github.com/dart-lang/sdk/issues/35819
> 
> Change-Id: I5526f203925fb320aa504b4e142fcf987579300a
> Reviewed-on: https://dart-review.googlesource.com/c/91702
> Commit-Queue: Aart Bik <ajcbik@google.com>
> Reviewed-by: Aart Bik <ajcbik@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=kustermann@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com

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

Change-Id: Ifd7ee46c42d82312f762cac7021e6a55deac83fd
Reviewed-on: https://dart-review.googlesource.com/c/91943
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-02-04 18:11:52 +00:00
Aart Bik b01697ba5a [vm/compiler] Continued graph checker development
Rationale:
More assumption verified. Found some true issues.

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

Change-Id: I5526f203925fb320aa504b4e142fcf987579300a
Reviewed-on: https://dart-review.googlesource.com/c/91702
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-02-01 19:14:27 +00:00
Jens Johansen eb956a2516 Add synthetic bit to Library flags
Fasta can generate synthetic libraries.
Previously we didn't include them when serializing, but that leaves
references in the binary to libraries that doesn't exist which isn't
ideal.

This change includes them, and adds a flag to kernel Libraries such that
we know they are synthetic.

Change-Id: Ied25a21cd1f384d318347021bc7ec18dae3a4e05
Reviewed-on: https://dart-review.googlesource.com/c/91722
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-01 11:00:26 +00:00
Alexander Aprelev 5737b452b8 [vm/gc] Update initial TLAB size calculation.
First TLAB size is adjusted to account for the new space survivors.

Change-Id: I6eb4305a14c00173626069b66b01906f8ba49612
Reviewed-on: https://dart-review.googlesource.com/c/91703
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-02-01 01:44:22 +00:00
Aart Bik 598515f031 [vm/compiler] Fix another missing incremental DOM update
Rationale:
Very similar to what was recently fixed for true branch,
but this time along the false branch. Also resets the
DOM relation in the call block, since this only dominates
true and false afterwards.

Note:
This fix unblocks the improvements to the graph checker.

https://github.com/dart-lang/sdk/issues/35803
https://github.com/dart-lang/sdk/issues/35819

Change-Id: I594bc42cfb1032b71d2f06f2d23a9ac3f8cf346b
Reviewed-on: https://dart-review.googlesource.com/c/91689
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-02-01 00:29:32 +00:00
Ryan Macnak 2c25cf016d [vm, gc] Use work stealing for the slices of the root set.
On Fuchsia/astro, sometimes the second worker thread takes several milliseconds longer to start than the first. With this change, the first worker can complete both root slices and allow the main thread to exit the safepoint without waiting for the second worker.

Change-Id: Ie48e0ded80c9544b52295ca0e1803e574e463ba1
Reviewed-on: https://dart-review.googlesource.com/c/91164
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-31 21:12:08 +00:00
Matthew Dempsky 9308cac681 [vm] Simplify VirtualMemory::Truncate
Callers always want to try to unmap the trailing pages, and the
OS-specific FreeSubSegment helper routine can never fail. Simplify
code accordingly.

Change-Id: I32e4bc72f626e15032d73326bee76a4a2ef71025
Reviewed-on: https://dart-review.googlesource.com/c/91146
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-31 21:01:48 +00:00
Ryan Macnak e717ecdc92 [vm] Maintain view-ness of bytecode instructions in snapshots.
Change-Id: Ieb032d55e5b8bab08e7eb3445a356068384dca28
Reviewed-on: https://dart-review.googlesource.com/c/91682
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-01-31 20:10:58 +00:00
Jason Simmons aaf97448b0 Extract EnumListParameter values before checking for matches
Previously EnumListParameter would find a match if the parameter starts with
any of the values in the enum.  This would misfire if an enum value is a prefix
of another enum value.

Change-Id: I3dc45359afbf7483d9c16a76c0114b5c42daed83
Reviewed-on: https://dart-review.googlesource.com/c/91620
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-31 18:30:28 +00:00
Jens Johansen 14b2255584 Status update after c3c5250
app_jitk also fails.

Change-Id: I7252d2a7b6e05151337dfff1cc7470ea34f8484a
Reviewed-on: https://dart-review.googlesource.com/c/91740
Auto-Submit: Jens Johansen <jensj@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-01-31 12:36:34 +00:00
Jens Johansen c3c525079b Demonstrate bug for the VMs way of doing initializers in face of mixins
See http://dartbug.com/34841#issuecomment-458917175
and test in this CL for explanation.

Change-Id: Ie1d15078a9c5f71aa6edacd792b440520a3eb877
Reviewed-on: https://dart-review.googlesource.com/c/91660
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-31 10:08:15 +00:00
Aart Bik 40fca03d07 [vm/compiler] fix assert failure on minint64
Rationale:
The new modulo optimization assert fails when doing
the power-of-two-of-abs test on minint64 (since abs
of minint64 is minint64). Note that we could actually
optimize this case by masking with maxint64 pattern
but since it bails for non-smi masks right now, this
fix does the same.

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

Change-Id: Ic592dad89ff6ffcd84dba9e17d4bccd79dc01f18
Reviewed-on: https://dart-review.googlesource.com/c/91704
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-31 00:55:01 +00:00
Aart Bik 689b17d69b [vm/compiler] Fix missing incremental DOM update
Rationale:
Pending improvements to the new graph checker discovered
missing DOM relation on inlined blocks, which was traced
to this missing update.

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

Change-Id: I3b3c796228d130d765c6e10ca819a072731c8bd5
Reviewed-on: https://dart-review.googlesource.com/c/91585
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-01-30 01:37:54 +00:00
Ryan Macnak 1e92b5ebd0 [vm] Note the flow graph builder when checking type feedback compatibility.
Change-Id: Ic4d9447d6a48e4afbe231888003f2fe41be53d5b
Reviewed-on: https://dart-review.googlesource.com/c/91422
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-29 23:29:43 +00:00
Ryan Macnak 7ee0e00f0b [vm, gc] Reset growth policy after finishing kernel loading.
Objects allocated during loading are expected to live forever. Cf. reset after loading a full snapshot.

Change-Id: I224a8bbc6a69b2d3ed667fff887b90bb2d4492d6
Reviewed-on: https://dart-review.googlesource.com/c/91107
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-29 23:27:54 +00:00
Ben Konyi b625926038 [ VM / dart:io ] Updated Link implementation for Windows to use actual symbolic links.
Change-Id: I22a598e7c1f249d9150cc5ceee96daa0291e753e
Reviewed-on: https://dart-review.googlesource.com/c/90362
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-01-29 19:26:47 +00:00
Samir Jindel 267e91a0ea Re-land "[vm] Prevent access to non-annotated members through native API."
Two fixes:

  - Make entrypoints_verification_test work on configurations where CFE compilation
    is separate from execution.
  - Add missing entry-point annotation for Windows.

The original revision is in patchset 1.

Change-Id: I6c4b52b1bae7bc730546dad6a3e31d8625f850b1
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/90942
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-29 15:10:34 +00:00
Martin Kustermann d5a558d6c4 [VM/AOT] Make DartTemplateCall::Selector() work even if there is no ICData
Closes https://github.com/dart-lang/sdk/issues/35703

Change-Id: I59713cb2baac695786cceeb54f6d8a7a3ed4a722
Reviewed-on: https://dart-review.googlesource.com/c/91226
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-01-29 08:21:52 +00:00
Alexander Markov 601094e3f2 [vm/bytecode] Fix max used block id when compiling from bytecode
Fixes https://github.com/dart-lang/sdk/issues/35789

Change-Id: I061d8d5b709fa5469824c8f5d7490aa2038746a3
Reviewed-on: https://dart-review.googlesource.com/c/91440
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-01-28 22:29:17 +00:00
Ryan Macnak ff2e8eb681 [vm, gc] Fix backwards write-barrier logic used by Object::Clone.
Change-Id: Ib614c0e85a96604252a47ad81ad6a8e70509a671
Reviewed-on: https://dart-review.googlesource.com/c/91242
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-28 22:28:37 +00:00
Aart Bik fc417a73ed [vm/compiler] Disable max block id check (for now)
https://github.com/dart-lang/sdk/issues/35789

Change-Id: Id37ca8191eb78431bb9bfaf23dd982b4cc5b44df
Reviewed-on: https://dart-review.googlesource.com/c/91421
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-01-28 20:21:07 +00:00
Aart Bik e02399da33 [vm/compiler] Introduce graph checker
Rationale:
This is a start with a graph checker that verifies
the consistency of the flow graph after each compiler
pass with the goal of detecting errors as early as
possible. The checks add overhead, so are only run
in debug mode. The objective is that all written
and unwritten assumptions on the flow graph that
are relatively easy to check will be converted
into actual code.
Change-Id: Iad9927d5b0fd87a43dc6a7369174d52761d89c9e
Reviewed-on: https://dart-review.googlesource.com/c/91143
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-28 18:16:47 +00:00
Aart Bik 2881a92c4e [vm/compiler] Fix missing incremental DOM update
Rationale:
Found by the new graph checker! Dominance relation was
not complete after incremental update (note that most
passes get around this by just recomputing the full
relation). Graph checkers are very useful to find
such omissions.
Change-Id: I4f2c8bfaee54b7a092aaaec04886635c86b451fa
Reviewed-on: https://dart-review.googlesource.com/c/91244
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-28 18:08:47 +00:00
Alexander Aprelev df34f65d90 Restore TLABs.
This reverts commit 324718fadd as it fixes performance issue found on Flutter benchmark.

The fix is to make TLAB smaller than new heap semi-space. Original implementation had TLAB occupy whole semi-space.

Change-Id: I4b5b5a3027b2d352ccb80538079a042406b5cf54
Reviewed-on: https://dart-review.googlesource.com/c/91171
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-01-26 06:24:18 +00:00
Vyacheslav Egorov 759234b05a [vm] Fix disassembler test after f496e538f4
Allocate comment strings in old space.

TBR=kustermann@google.com

Change-Id: Ie670b87791d01848b9c1b12931bd932331818839
Reviewed-on: https://dart-review.googlesource.com/c/91224
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
2019-01-25 19:37:24 +00:00
Ryan Macnak 169331abb1 [vm] Misc timeline tweaks.
- Move compiler pass events to a new CompilerVerbose stream
 - Remove serialization phase events
 - Add class name to class finalization event (lost along with finalization events in recent cleanups of finalization)
 - Add event for kernel loading

Change-Id: Ie72bced978400ea174c1551c961baa55c691b019
Reviewed-on: https://dart-review.googlesource.com/c/90883
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-25 18:37:05 +00:00
Ryan Macnak 9043e5be44 [vm, gc] Remove --gc_at_alloc.
Change-Id: Ied987c5fb0389432474a6ef8ee62ed7089c9e672
Reviewed-on: https://dart-review.googlesource.com/c/91142
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-25 18:03:30 +00:00
Vyacheslav Egorov 27760001f5 [vm] Fix build after f496e538f4
* Introduce forward declaration for RawObject;
* Move compiler::target::ClassTable::ClassOffsetFor under ifdef PRODUCT

Change-Id: Iacf5cbdaec0c2999aae7c8e0683a58e392f3e960
Reviewed-on: https://dart-review.googlesource.com/c/91220
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-25 18:01:50 +00:00
Vyacheslav Egorov f496e538f4 [vm] Decouple assemblers from runtime.
This is the next step towards preventing compiler from directly peeking
into runtime and instead interact with runtime through a well defined
surface. The goal of the refactoring to locate all places where compiler
accesses some runtime information and partion those accesses into two
categories:

- creating objects in the host runtime (e.g. allocating strings, numbers, etc)
during compilation;
- accessing properties of the target runtime (e.g. offsets of fields) to
embed those into the generated code;

This change introduces dart::compiler and dart::compiler::target namespaces.

All code in the compiler will gradually be moved into dart::compiler namespace.
One of the motivations for this change is to be able to prevent access to
globally defined host constants like kWordSize by shadowing them in the
dart::compiler namespace.

The nested namespace dart::compiler::target hosts all information about
target runtime that compiler could access, e.g. compiler::target::kWordSize
defines word size of the target which will eventually be made different
from the host kWordSize (defined by dart::kWordSize).

The API for compiler to runtime interaction is placed into compiler_api.h.

Note that we still permit runtime to access compiler internals directly -
this is not going to be decoupled as part of this work.

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

Change-Id: If4396d295879391becfa6c38d4802bbff81f5b20
Reviewed-on: https://dart-review.googlesource.com/c/90242
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-25 16:45:13 +00:00
Martin Kustermann dfeee239c4 [VM] Fix use-after-free: move free after use
Change-Id: Idcedbd8bdbd94f126846c5390c6cb8d00a21de57
Reviewed-on: https://dart-review.googlesource.com/c/91180
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-01-25 13:14:19 +00:00
Martin Kustermann 51bc367806 [VM/AOT] Ensure we set flags from snapshot very early in the VM initialization
There are uses of flags before the VM snapshot gets read, so we need to
move the "snapshot sniffing" code to the very beginning of Dart::Init().

Due to the fact that FullSnapshotReader/Deserializer assume there is a
[Thread] available - and we don't have a [Thread] yet when we should
process the flags - this CL moves version/feature logic into a new
[SnapshotHeaderReader] class which does not depend on Thread/...

Change-Id: I38a45041f0696b96e44fc2b294e3442a5fba1a81
Reviewed-on: https://dart-review.googlesource.com/c/90941
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-01-25 10:31:48 +00:00
Martin Kustermann 8c439c7e84 [VM/AOT] Turn bare instructions on by default
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: I44850d5906143a53d6b1872eb729364c3a509f9a
Reviewed-on: https://dart-review.googlesource.com/c/91060
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-25 10:25:18 +00:00
Matthew Dempsky adf48e4d4b [vm] Fix header includes
In https://dart-review.googlesource.com/c/sdk/+/91104, I meant to
delete #include <endian.h>, and accidentally removed #include
<errno.h> instead.

Change-Id: I52e55350d2817c3e6543a8bf806492f1b1dcf3db
Reviewed-on: https://dart-review.googlesource.com/c/91109
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-01-25 02:03:51 +00:00
Matthew Dempsky b11f2d8e69 [vm] Implement VirtualMemory::Allocate using AllocateAligned
Instead of implementing separate aligned and unaligned memory
allocation primitives for each OS, just change the unaligned allocator
into a wrapper around the aligned primitive.

While here, we can optimize the AllocateAligned logic slightly: if we
want an N-page-aligned allocation, we only need to increase the
allocation size by N-1 pages instead of N.

Notably, this means 1-page-aligned allocations don't require any extra
alignment pages, so the new logic behaves identically as before on
Android, Fuchsia, Linux, and macOS.

On Windows, it behaves slightly differently only in that unaligned
requests used to be handled as a single VirtualAlloc call with
MEM_RESERVE | MEM_COMMIT, but now they're handled as two separate
calls (reserve *then* commit). Naively, I don't expect this matters in
practice, but if it does, we can always add a fast path for
alignment==page_size_ without affecting the OS-independent API.

Change-Id: I42b2cf5dfc6e137546d8acfb6cc8939a01687948
Reviewed-on: https://dart-review.googlesource.com/c/91081
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-01-25 01:22:20 +00:00