Commit Graph

15260 Commits

Author SHA1 Message Date
Teagan Strickland d7054690ab [vm/compiler] Partially revert "Replace LoadClassId for known cids."
We still need to check for concrete types in
ConstantPropagator::VisitLoadClassId to avoid benchmark regressions.

Change-Id: Ie3a7e3aaa3b261c34760308f3cb1d328ce2d8493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103520
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-05-24 09:56:59 +00:00
Samir Jindel 225a301637 [vm/ffi] Re-land "[vm/ffi] FFI callbacks on X64."
There are minor fixes for dartkb and windows.
The original revision is in patchset 1.

Change-Id: I9ab6e5fdb33fb4e84ea520c283fe94323616a8ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103129
Commit-Queue: Samir Jindel <sjindel@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-05-24 02:39:13 +00:00
Aart Bik aa785d938b [dart/vm] Fix erroneous claim on "temp" Q7
Rationale:
Q7 is a scratch register, it cannot hold input/outputs.

https://github.com/flutter/flutter/issues/32708

Change-Id: I0ad23d2d3e363be14cf83b085b94ce9ff3a22261
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103551
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-05-23 23:50:38 +00:00
Alexander Markov 49262365dc [vm] Do expensive kernel metadata verification only once per kernel
In DEBUG mode during AOT compilation MetadataHelper::SetMetadataMappings
may spend considerable time verifying that node offsets are sorted
in kernel metadata. The problem is that there are a lot of MetadataHelpers
created (several per each compiled function).

This change moves verification of kernel metadata mappings to
the kernel loader, so it is performed only once per kernel program.

AOT gen_snapshot time on a small test:
Before: 11.680s
After: 9.041s

Change-Id: I1c0a676b0ed28fc5cfa756ca60159f914190fac0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103486
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-05-23 23:40:22 +00:00
Martin Kustermann db367542b3 [vm/kernel] Fix uninitialized variables in kernel_translation_helper.h
My recent change in b316210d94 revealed this use of uninitialized variables.

Change-Id: If4d3e55febe468bb6e9e8d7af3dbc4cec1738afa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103533
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-05-23 21:05:56 +00:00
Liam Appelbe 6e1f628f19 Outline the StackZone's Zone
Bug: https://github.com/dart-lang/sdk/issues/36100
Change-Id: I17cdf438c19fcc66ceb09c23348654eb752dd3cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103560
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-05-23 19:10:46 +00:00
Ryan Macnak d4e2d78a94 [vm] Partially disable 5393ce7d35.
Avoid flakily failures setting the thread signal mask.

Bug: https://github.com/dart-lang/sdk/issues/36908
Change-Id: I3d66214189f3276365b4c1cc333847cb4f65c94f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-23 17:42:37 +00:00
Daco Harkes 338b74a52c [vm/ffi] Align stack frame when entering and exiting safe point
Closes: https://github.com/dart-lang/sdk/issues/36993

Change-Id: Idc3b2f26142a5c1a358ebf5f71cd226978181b73
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try, vm-kernel-win-debug-x64-try, vm-kernel-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103136
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-05-23 17:31:57 +00:00
Stevie Strickland cbd4391747 [vm/compiler] Forward the ByteData constructor length argument.
In addition, if a _ByteDataView came from a use of the ByteData
constructor, its offset is always 0.

Also add appropriate canonicalization for the following instructions for
typed data views coming from a known factory call:

* LoadField getting type arguments
* GuardFieldLength

This closes https://github.com/dart-lang/sdk/issues/36570.

Change-Id: I1c045edb2d928c3bb3340d9d12009c2afa66febb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102362
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-05-23 13:19:46 +00:00
Martin Kustermann b316210d94 [vm/compiler] Speed up the compiler part which deals with kernel reading up in DEBUG mode
This reduces our AOT compiler's time - gen_snapshot -  by half in DEBUG mode.

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

Change-Id: I235afc40acba32036d4127c31c93f3b22f522314
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103441
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-05-22 22:16:30 +00:00
Alexander Markov ec4d48e241 [vm/bytecode] Add starting and ending source positions for closures
Issue: https://github.com/dart-lang/sdk/issues/36427
Change-Id: Ib2f55504f9238036a9700f1e2672b4641536ab7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103480
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-22 19:02:40 +00:00
Martin Kustermann 345af8d9ed [vm/compiler/dbc] Make LoadIndexedInstr load unboxed values and StoreIndexedInstr take unboxed values
Closes https://github.com/dart-lang/sdk/issues/37046

Change-Id: I5de2d55b6d5aa2e4707d7dfca00d7a9774590e10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103301
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-22 18:37:20 +00:00
Alexander Markov 7cb48804ee [vm/compiler] Merge cid ranges when generating receiver check
This change adds merging of cid ranges into Cids::Create if there are
gaps with the same target function. Previously, this optimization was
performed only when calculating targets via CallTargets::CreateAndExpand.
However, Cids::Create is widely used to check receiver type if there is
only one targets (e.g. in CallSpecializer::AddReceiverCheck /
CallSpecializer::AddChecksForArgNr).

This optimization is needed to shrink huge code for CheckClass instructions
in Flutter RenderObject.layout() method in JIT mode.

Issue: https://github.com/dart-lang/sdk/issues/36428
Change-Id: I97051b4213066b252ac3238df55ab4ed5c98f412
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103402
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-05-22 16:34:36 +00:00
Alexander Markov e3edfd36b2 [vm/snapshots] Finalize and sort all classes in snapshots with compilation trace
This ensures that core-jit snapshots used in Fuchsia (built according
to the compilation trace) would have properly sorted cids without any
gaps with non-finalized classes. This enables merging of cid ranges in
more cases and more efficient cid checks.

Issue: https://github.com/dart-lang/sdk/issues/36428
Change-Id: I7b696ccb7d5ffa80f190bcfc9e1b7229937f16b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103403
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-22 16:01:07 +00:00
Teagan Strickland a17b52c2c1 Revert "[vm, compiler] Unoptimized megamorphic calls."
This reverts commit fde6a5917e.

Reason for revert: This commit looks to be causing new test failures on dart2js. While there are some odd results on some builders that look like infra failures, some builders (for example, dart2js-minified-strong-linux-x64-d8) show the new failing tests clearly.

Original change's description:
> [vm, compiler] Unoptimized megamorphic calls.
> 
> When an instance call in unoptimized code creates more than FLAG_max_polymorphic_checks cases, switch the call to use a MegamorphicCache instead of ICData. The prevents unbounded collection of type feedback, and gives improvements on microbenchmarks in the 3-8% range for unoptimized code.
> 
> It also leads to a loss of target frequency information for the optimizer, leading to different ordering for range checks in polymorphic inlining. This leads to changes on megamorphic microbenchmarks from -31% to +60%, weighted toward the negative end.
> 
> In practice the frequency information seems unimportant, as dart2js has 4.01% geomean improvement.
> 
> This is a step toward direct monomorphic calls in unoptimized code, which will also make use of the patching and type feedback extraction added here.
> 
> Bug: https://github.com/dart-lang/sdk/issues/26780
> Bug: https://github.com/dart-lang/sdk/issues/36409
> Bug: https://github.com/dart-lang/sdk/issues/36731
> Change-Id: I29f53f23b6794c5f5f0db8b8184788cee16fd9c5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99270
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

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

Change-Id: Icad46b93cdf8541a00563f49da6b4ac0a4df1ba1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/26780, https://github.com/dart-lang/sdk/issues/36409, https://github.com/dart-lang/sdk/issues/36731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103440
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-05-22 13:20:49 +00:00
Martin Kustermann 978dc6b372 [vm/compiler] Remove left-over free in unit_test.cc (we attach a finalizer now to the ExternalTypedData)
A follow-up change to https://dart-review.googlesource.com/c/sdk/+/103130

Change-Id: Ib3f39bc8233e0c475af27c581fa03824c2577a68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103420
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
2019-05-22 04:03:27 +00:00
Martin Kustermann ab6aeaa106 [vm/kernel] Use GC-tracked ExternalTypedData/TypedDataView for kernel buffers
Until now we often leaked kernel buffers (e.g. hot reload buffers) because various
objects were referencing ExternalTypedData objects pointing into the middle of
c-allocated memory. This made it impossible for the GC to determine when the last
reference is gone.

This CL ensures that the actual buffers are *always* made available via
ExternalTypedData and any inner pointers into it are created via TypedDataViews.

The embedder guarantees to the free kernel buffers it has provided to:
    - Dart_CreateIsolateFromKernel
    - Dart_LoadScriptFromKernel
    - Dart_LoadLibraryFromKernel
    - Dart_SetDartLibrarySourcesKernel
on isolate shutdown.

All other kernel buffers will get a finalizer attached, which ensures the
kernel buffers get freed by the GC once they are no longer referenced:
    - Kernel blobs for expression evaluation
    - Kernel blobs for Hot-Reload
    - Kernel blobs for cc tests

Fixes https://github.com/dart-lang/sdk/issues/33973
Fixes https://github.com/dart-lang/sdk/issues/36857
Issue https://github.com/dart-lang/sdk/issues/37030

Change-Id: I1cc410c94c0f4b229413e793728a261afcb10aaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103130
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-05-22 01:23:46 +00:00
Ryan Macnak fde6a5917e [vm, compiler] Unoptimized megamorphic calls.
When an instance call in unoptimized code creates more than FLAG_max_polymorphic_checks cases, switch the call to use a MegamorphicCache instead of ICData. The prevents unbounded collection of type feedback, and gives improvements on microbenchmarks in the 3-8% range for unoptimized code.

It also leads to a loss of target frequency information for the optimizer, leading to different ordering for range checks in polymorphic inlining. This leads to changes on megamorphic microbenchmarks from -31% to +60%, weighted toward the negative end.

In practice the frequency information seems unimportant, as dart2js has 4.01% geomean improvement.

This is a step toward direct monomorphic calls in unoptimized code, which will also make use of the patching and type feedback extraction added here.

Bug: https://github.com/dart-lang/sdk/issues/26780
Bug: https://github.com/dart-lang/sdk/issues/36409
Bug: https://github.com/dart-lang/sdk/issues/36731
Change-Id: I29f53f23b6794c5f5f0db8b8184788cee16fd9c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99270
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-21 19:44:27 +00:00
Aart Bik 9b017a1ced [dart/vm] Peephole optimizer (window size one) on stack code
Rationale:
A basic peephole optimizer with window size one that avoids
redundant push-pop sequences already results is substantial
savings in code size and runtime, without any noticeable impact
on compile time (the peephole is very, very fast).

Performance:
Golem unoptimized code (which typically runs -90% compared to
optimized code, sees 5-60% improvements

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

Change-Id: I08db4b3dbc92377d89340a4969db6e664e54bceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102980
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-21 18:29:06 +00:00
Ryan Macnak 21f32e7383 Fix sources to source_set
Recent changes to GN require only buildable files to be included in
sources. See crbug.com/gn/77 for additional details.

Change-Id: Ic8fd059e85ba86a63c5d6483e8ec64ddbd1612ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103022
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-05-21 17:01:48 +00:00
Ryan Macnak e4c71e830f [vm, compiler] Fix Code checked entry offsets.
Function entry points have been subject to block scheduling since 06f9a9e354. Block scheduling in AOT never reorders the entries.

Bug: https://github.com/dart-lang/sdk/issues/36409
Bug: https://github.com/dart-lang/sdk/issues/36731
Change-Id: Id6725fed4d9bbd381631fa88c5397435a35acc9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102463
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-21 01:19:28 +00:00
Alexander Markov 433bc1b350 [vm/compiler] Avoid adding unused Redefinition instructions
Type propagator adds Redefinition instructions to provide more accurate
type information only for dominated uses (for example, to mark receiver
as non-nullable after instance calls). However, adding Redefinition
instructions may interfere with branch simplification, which looks only
at empty join blocks. This change avoids adding unused Redefinition
instructions (if there are no dominated uses).

This particular situation happens in Flutter in RenderObject.layout() where
constraints.isTight is inlined with multiple polymorphic targets, including
SliverConstraints.isTight which returns false.
Branch simplification was not happening due to Redefinition instruction
for 'constraints'. That Redefinition instruction is not used.

Change-Id: I15082bacd7cc6ea1445a4dadc8ef97853142ba74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103023
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-20 17:38:14 +00:00
Ryan Macnak b48c8b1d1c [vm] Re-order ICData entries to allow CID and count to be accessed with a load-pair.
Bug: https://github.com/dart-lang/sdk/issues/36731
Change-Id: Ia91ddb7e8991a5ab227ab8758173a99141c259be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103004
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-20 17:30:04 +00:00
Zichang Guo f9402d635a [vm] Get script of closure from owner as parent function may contain wrong script
When a mixin class is created, there might be anonymous closures copied over to the other script.
Previously the script of closure function is the script of its parent function, which is not true in that case.
The solution is to create a patch class as the owner if parent function has a different script object. Return script of owner when query for script of closure function.

Bug: https://github.com/dart-lang/sdk/issues/34841
Change-Id: I53065cbf13f2d0dc8da320993fd3cd425e5c9714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102226
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-05-20 15:50:54 +00:00
Samir Jindel ed169c4bb0 Revert "[vm/ffi] FFI callbacks on X64."
This reverts commit be209f7846.

Reason for revert: failures on dartkb and windows bots

Original change's description:
> [vm/ffi] FFI callbacks on X64.
> 
> For context on the design, see go/dart-ffi-callbacks
> 
> Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

TBR=sjindel@google.com,ajcbik@google.com,dacoharkes@google.com

Change-Id: I4cb3d93675d68a51ac9e125ad1d572c47e8b5903
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102983
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-05-18 15:29:19 +00:00
Samir Jindel be209f7846 [vm/ffi] FFI callbacks on X64.
For context on the design, see go/dart-ffi-callbacks

Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-05-18 06:15:46 +00:00
Samir Jindel 9e30fbaea4 [vm] Unify function prologue generation across all backends.
Previously we would generate the prologue in FunctionEntryInstr or OsrEntryInstr
on X64/ARM, and in CompileGraph on ARM64/IA32/DBC. This caused a confusing asymmetry
in the code.

Now we generate it in FunctionEntryInstr/OsrEntryInstr on all backends.

Partially addresses dartbug.com/34162.

This also fixes a regression on a protobuf benchmark due to ICDatas not being saved.

Change-Id: Ie270d759234b197141025dde07a27546d221f6c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101297
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-18 01:10:06 +00:00
Zichang Guo c6f6713de1 [vm,exception] notify debugger to stop for ReThrow
Rethrow should behave the same as throwing from debugger point of view. Thus, notify debugger for possibly pausing on exceptions.

Bug: https://github.com/dart-lang/sdk/issues/36907
Change-Id: I84886fd8f3e1c579f60802aadb9fdaa4e076b6c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102681
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-05-17 21:29:51 +00:00
Ben Konyi b1f9f2182d [ VM / Service ] Remove root frame from traceEvents in _getCpuProfileTimeline response
This frame is already filtered from the trie, so this will make behavior
consistent.

Change-Id: I9283a6ef170b725f739d91795fbb81cf7d902470
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102103
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-05-17 18:41:51 +00:00
Liam Appelbe b2a3d1c31b Give Field::is_nullable the same consistency check as guarded_cid
Fixes: https://github.com/dart-lang/sdk/issues/36717
Bug: https://github.com/dart-lang/sdk/issues/36717
Change-Id: Ic58b9a004a0bbab91d330c24212ff2d8634c084f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100273
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-05-17 17:17:40 +00:00
Ryan Macnak 0e8656e045 [vm, compiler] Shorter invocation counter check.
Remove the optimization function stub and self function from the constant pool of every unoptimized function.

Remove one PP move from unoptimized frame entry.

Bug: https://github.com/dart-lang/sdk/issues/36409
Change-Id: Idbe37ce36b57dc316a131e6c83742ee2b3df4a0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102660
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-05-16 23:04:22 +00:00
Ryan Macnak cc2d5adec9 [dart:io] Don't leak /dev/urandom fd on fork.
Change-Id: I90ff8585408078e12bf732f6669cf3f9d149495a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102205
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-05-15 21:27:19 +00:00
Aart Bik 57c970d87a [dart/vm] Fix inconsistencies in intermediate representation
Rationale:
Stricter graph checking found some dangling pointers
and missing updates. This CL fixes the omissions
and removes some bail-outs in the graph checker itself,
making the checker stricter and more consistent. Also
adds flag to control verification (avoid excessive runtimes
for large programs in general, but allows testing even
these through command line option).

https://github.com/dart-lang/sdk/issues/36893
https://github.com/dart-lang/sdk/issues/36894
https://github.com/dart-lang/sdk/issues/36895
https://github.com/dart-lang/sdk/issues/36899

Change-Id: If4357cb897484ddfdb60722525092198771ec90a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102420
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-05-15 19:13:49 +00:00
Dan Field 034fce1e39 [dart:io] unbreak build
Change-Id: Ia8965e62f4b89a80aeb6db1489ca45c6db321adc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102640
Reviewed-by: Régis Crelier <regis@google.com>
Auto-Submit: Dan Field <dnfield@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-05-15 19:13:29 +00:00
Dan Field 7f323feefe [dart:io] Fix iOS https leaks
Add move constructor and equality operators to
ScopedCFType, add specialized destructor for arrays.

Add release to ScopedCFType.

Use ScopedCFType for SecCertificateRef.

Bug: https://github.com/dart-lang/sdk/issues/36935
Change-Id: I7b40f23fb8f0d7ab0835587e040362f883f86bd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102560
Reviewed-by: Zach Anderson <zra@google.com>
Auto-Submit: Dan Field <dnfield@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-05-15 17:53:49 +00:00
Ben Konyi ea9b0cd0f5 [ VM / FFI ] Fixed imports in ffi.h which were invalid for Flutter iOS build
Change-Id: I7c910ce4cd54b083bfb2125711cc91646b703f7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102582
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-05-15 15:51:19 +00:00
Matthew Dempsky 6d5f763952 [vm] Eliminate Mutex/Monitor indirection where possible
In many cases, the Mutexes and Monitors have to be marked "mutable"
because they're used to synchronize const accessor methods.

Small text segment improvement for Product builds:

$ size dart.{arm,x64}.{before,after}
   text	   data	    bss	    dec	    hex	filename
19726069	 409960	 392332	20528361	1393ce9	dart.arm.before
19725525	 409960	 392332	20527817	1393ac9	dart.arm.after
22576021	 600376	1782824	24959221	17cd8f5	dart.x64.before
22574821	 600376	1782824	24958021	17cd445	dart.x64.after

Change-Id: I68f5cd5ad452044df8bfebd160910496036a3e6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101745
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-05-13 21:17:51 +00:00
Aart Bik b0727bd661 [dart/vm] enhanced graph checker
Rationale:
Refactored existing verify uses (with some overlap and some
additional checks) into the graph checker. Also added more
verification code and repaired some inconsistencies in IR
found by new checker. However, some checks are disabled with
a TODO, since the IR does not currently meet all the stricter
assumptions. Fixes will follow.

https://github.com/dart-lang/sdk/issues/36893
https://github.com/dart-lang/sdk/issues/36894
https://github.com/dart-lang/sdk/issues/36895
https://github.com/dart-lang/sdk/issues/36899

Change-Id: Ic0395208da38ecb6fc8ca2551efe819e6458a731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101922
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-13 17:47:11 +00:00
Kevin Moore eba45291fb [observatory] Cleanup unused imports, fix warning about SDK version
Change-Id: I80f1861b8dd1d1fa5eea93cc305fa0ee2475580d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101884
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2019-05-13 16:27:41 +00:00
Matthew Dempsky 54a541706d [vm] Simplify IsolateSpawnState
Move SpawnCount logic into SpawnIsolateTask, where it logically makes
more sense. This eliminates some code and also prevents
IsolateSpawnState from having lingering pointers to the parent
Isolate's fields after it might have been reclaimed.

Change-Id: If8d827f299ee90dd54faf896609a7acdfbb87608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101628
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
2019-05-11 00:12:08 +00:00
Ryan Macnak b0b6a289ec [vm, compiler] Make IA32 megamorphic calls match the other architectures.
Bug: https://github.com/dart-lang/sdk/issues/26780
Bug: https://github.com/dart-lang/sdk/issues/36409
Change-Id: I7865e6fb033ad2a4b1fd185d38c1b5a4c96dd6e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101921
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-05-10 19:26:38 +00:00
Matthew Dempsky b1f6c1d092 [vm] Fix -O0 build after CL 101222
const objects that are declared in .h files are supposed to have
out-of-line definitions in their corresponding .cc file. It seems like
CL 101222 happened to expose this for Message::kIllegalPort.

Change-Id: I9656037581eb6406eaf3289dfcf705db90862a26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102122
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-05-10 18:47:28 +00:00
Adam Barth 8a3a9dc588 [fuchsia] Migrate to zx_clock_get_new
Change-Id: Ibf9210e3965e77ff56d244cfd67dbccfb1eef3f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102104
Auto-Submit: Adam Barth <abarth@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-05-10 18:22:28 +00:00
Aart Bik 7e0b680851 [dart/vm] minor test refactoring
Rationale:
Combining test and declaration. Also reorder
test for efficiency.

Change-Id: I6422c0c3fdf31fccd7b2a58f885bca2daa1e996c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-05-10 15:50:40 +00:00
Stevie Strickland 2a32cdda6d [vm/compiler] Replace LoadClassId for known cids.
Change-Id: I4c5b31cd83882892657d0cfff1e75aab494fd20b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101661
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-05-10 09:31:19 +00:00
Alexander Markov c532458e09 [vm/compiler] Fix for flaky crash in CallSpecializer::ReplaceWithInstanceOf
There were rare crashes

../../runtime/vm/compiler/call_specializer.cc: 1393: error: expected: call->MatchesCoreName(Symbols::_simpleInstanceOf())
version=2.3.0-edge.796ebc6069bde3a59475a9b45075f49e50b0cc34 (Thu May 9 09:38:28 2019 -0700) on "linux_x64"
thread=82540, isolate=vm-service(0x558748c5d200)
  pc 0x000055874635dd6c fp 0x00007fa94dd3bf30 dart::Profiler::DumpStackTrace(void*)
  pc 0x0000558745f90332 fp 0x00007fa94dd3c010 dart::Assert::Fail(char const*, ...)
  pc 0x000055874653909b fp 0x00007fa94dd3c0a0 dart::CallSpecializer::ReplaceWithInstanceOf(dart::InstanceCallInstr*)
  pc 0x0000558746496ed6 fp 0x00007fa94dd3c0f0 dart::FlowGraphVisitor::VisitBlocks()

when running

tools/test.py --repeat 5000 -n dartkb-mixed-linux-debug-x64 language_2/null_test

at the rate ~1-3 crashes per 30,000 test cases.

The problem is that in function

bool InstanceCallInstr::MatchesCoreName(const String& name) {
  return function_name().raw() == Library::PrivateCoreLibName(name).raw();
}

'function_name().raw()' is evaluated before PrivateCoreLibName(name) is called
and saved in a temporary (register). PrivateCoreLibName may trigger GC and
relocate objects. In such case, 'PrivateCoreLibName(name).raw()' results in a
moved object, which is compared to a stale object address.

This CL fixes InstanceCallInstr::MatchesCoreName and other similar places
by introducing Library::IsPrivateCoreLibName, which is also a little bit more
efficient as it avoids extra symbol table lookup.

Change-Id: I4dc91c586b0c595a3e85d6da13b98fc2248fb8fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102120
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-05-09 23:16:38 +00:00
asiva 2736dab879 [VM/tests] Use appropriate type when invoking Isolate.spawn
Fixes https://github.com/dart-lang/sdk/issues/36917

Change-Id: I83ae6ad6afefb62da4228d168bbec805aa74cf92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102101
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-05-09 23:04:28 +00:00
Aart Bik 869cb683d8 [dart/fuzzer] rename exception parameter
Rationale:
catch (e) had a very interesting shadowing
with math's constant e, which unintentionally
allowed exeption text to enter the divergence
mechanism; here we were fuzzing the fuzzing
really :-)

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

Change-Id: Ie5cd61755ea61921b903684532d404f4dc734edd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102062
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-05-09 20:47:21 +00:00
Alexander Markov 0069beb7ed [vm/interpreter] Cleanup stack slot in Interpreter::InterfaceCall
The stack slot in question may contain a stale value, but it could
be scanned by GC, so the fix is to clean it up even if it looks
unused.

While debugging I saw bytecode PCs in that stack slot.
So it is likely that compact bytecode instructions (68de477535)
increased the probability of these crashes, as with compact bytecodes
PCs could be unaligned and treated as Dart objects by GC, while
previously PCs were always aligned and treated as Smis by GC,
effectively masking the failure.

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

Change-Id: I82ccaa2bd87aca4ca4b44c9db69b0efd18dad955
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102061
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-05-09 20:20:51 +00:00
Daco Harkes b2949d3436 fix Flutter build for "[vm/ffi] DBC support on x64 Linux/MacOS hosts"
Change-Id: I119776682e53f70f621107f2159670cb3e75b310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101982
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-05-09 12:19:21 +00:00