Commit graph

14949 commits

Author SHA1 Message Date
Liam Appelbe
9622562482 Make _cancelWakeup a no-op if _sendPort is null
This seems to fix the issue, but it's a flaky crash so it's hard to 100% verify.

Bug: https://github.com/dart-lang/sdk/issues/33838
Bug: https://github.com/flutter/devtools/issues/337
Change-Id: Ic037a94cfb9fe7da319d7d4b20e3a3efd0c7289f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97541
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-03-21 18:15:27 +00:00
Alexander Markov
8f827aef4f [vm/bytecode] Recognize identical() in bytecode flow graph builder
This optimization is performed in AST-based flow graph builder and
it is needed for optimizer to constant fold certain things
(e.g. testing endianness in typed data getters).

Replicating it in bytecode flow graph builder to keep parity with
AST-based flow graph builder.

Bug: FL-203.
Change-Id: Id28bcccc75c5d5184801574dbe10b74b86711d50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97400
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-03-21 18:07:47 +00:00
Martin Kustermann
cabaa78cc5 [VM] Generalize generic bounds check elimination
When eliminating bounds checks using loop information the length of
GenericBoundsCheckInstr is directly compared to the loop bound.

Instead we should compare the original definitions, ignoring any
boxing/unboxing. This allows the elimination of more bounds checks.

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

Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try, vm-dartkb-linux-debug-x64-try, vm-dartkb-linux-release-x64-try, vm-kernel-asan-linux-release-x64-try, vm-kernel-checked-linux-release-x64-try, vm-kernel-linux-debug-ia32-try, vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-debug-x64-try, vm-kernel-linux-product-x64-try, vm-kernel-linux-release-ia32-try, vm-kernel-linux-release-simarm-try, vm-kernel-linux-release-simarm64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-linux-release-x64-try, vm-kernel-optcounter-threshold-linux-release-ia32-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-android-release-arm-try, vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-product-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-obfuscate-linux-release-x64-try, vm-kernel-precomp-win-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-reload-linux-debug-x64-try, vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try, vm-kernel-reload-rollback-linux-release-x64-try, vm-kernel-win-debug-ia32-try, vm-kernel-win-debug-x64-try, vm-kernel-win-product-x64-try, vm-kernel-win-release-ia32-try, vm-kernel-win-release-x64-try
Change-Id: Ie10880f833f3b55d0804a03c4be9bd9d1ad52f66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97331
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-21 14:29:08 +00:00
Martin Kustermann
16eefa4b75 [VM] Infer ranges for truncating divisions with positive divisor & Fix missing deopt env bug
The truncating division can deopt if divisor is 0, so we have to inform
the compiler that we need a deoptimization environment.

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

Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try, vm-dartkb-linux-debug-x64-try, vm-dartkb-linux-release-x64-try, vm-kernel-asan-linux-release-x64-try, vm-kernel-checked-linux-release-x64-try, vm-kernel-linux-debug-ia32-try, vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-debug-x64-try, vm-kernel-linux-product-x64-try, vm-kernel-linux-release-ia32-try, vm-kernel-linux-release-simarm-try, vm-kernel-linux-release-simarm64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-linux-release-x64-try, vm-kernel-optcounter-threshold-linux-release-ia32-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-android-release-arm-try, vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-product-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-obfuscate-linux-release-x64-try, vm-kernel-precomp-win-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-reload-linux-debug-x64-try, vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try, vm-kernel-reload-rollback-linux-release-x64-try, vm-kernel-win-debug-ia32-try, vm-kernel-win-debug-x64-try, vm-kernel-win-product-x64-try, vm-kernel-win-release-ia32-try, vm-kernel-win-release-x64-try
Change-Id: I10d52ca68198f20362008d4c1ad4a2736ac2d425
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97330
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-03-21 14:13:44 +00:00
Jens Johansen
a7ab99dd84 [vm/kernel] Index all source and line starts before using them
By indexing all sources in a concatenated dill file and then using that
index to find the sources and line starts we can fix missing information
(leading to crashes when collecting coverage) in for instance circular
instances.

Change-Id: I454cff57f84f21de72f6486e1cecf15d1389a498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96901
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-21 12:05:15 +00:00
Alexander Aprelev
34af8b95e5 Revert "[vm] Free readonly header bit so it can be used for other uses."
This reverts commit 59931e3340 as it
breaks jitk and optcounter bots.

Change-Id: If87ce52ac3d4015608436bfd7ee661ea1414dc7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97480
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-03-21 06:23:50 +00:00
Alexander Aprelev
59931e3340 [vm] Free readonly header bit so it can be used for other uses.
Rely on vm_isolate()->heap()->Contains() instead of header bit check.

Change-Id: Ibf66b9910aea5003dd3dee539704deeb72c61ada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97340
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-21 00:02:56 +00:00
Aart Bik
e3d6fc974f [dart/vm] fix off-by-a-lot error in DAG test
Rationale:
The constant evaluator deals with two sorts of
offsets, the true offset into the kernel data,
and the offset of a constant relative to the
start of the constant table (compensated for a
variable-size int prefix at the true base).
The DAG test was comparing the latter against
the former (which was always true, since the
true offsets are much larger). This fixes
this omission.

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

Change-Id: I71f37bfb2bd3432e52d5086e89a62115f0cacacd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97421
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-03-20 23:15:46 +00:00
Alexander Markov
973a4d0b2e [vm] Drop 'testonly = true' from gen_kernel_bytecode_dill GN rule
Since https://dart-review.googlesource.com/c/sdk/+/96540
dart_kernel_platform_cc depends on gen_kernel_bytecode_dill, so
gen_kernel_bytecode_dill is no longer "testonly".

When trying to use latest Dart SDK in Fuchsia, fx set complains:

ERROR at //third_party/dart/runtime/bin/BUILD.gn:647:1: Test-only dependency not allowed.
source_set("dart_kernel_platform_cc") {
^--------------------------------------
//third_party/dart/runtime/bin:dart_kernel_platform_cc
which is NOT marked testonly can't depend on
//third_party/dart/runtime/bin:gen_kernel_bytecode_dill
which is marked testonly. Only targets with "testonly = true"
can depend on other test-only targets.

Change-Id: Ibbf44f1edee690a8c4ccba714f55aa11a7020b43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97440
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-03-20 22:30:45 +00:00
Zichang Guo
b10ac42527 [VM] Parentenvironment for Macos and Android
Follwed by https://dart-review.googlesource.com/c/sdk/+/96147. Macos and andriod
also have the same problem.

Bug: https://github.com/dart-lang/sdk/issues/36132
Change-Id: I455e806c082b6eeb7abb25b99fe20e9d11b1a486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97403
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-03-20 21:29:03 +00:00
Zichang Guo
9f00d1b384 [VM] Ensure Top level class is finalized for loadedscripts in library
The breakpoints sent from IDE will be checked with existing scripts.
Because the loadedscripts() doesn't contain the scripts info for part/part of.
Then the breakpoint will be considerred as a latent breakpoint and didn't get
resolved later. The solution is to finalize the toplevel class before loadedscripts()
uses Dictionary iterator.

Bug: https://github.com/dart-lang/sdk/issues/35859
Change-Id: I90b67ee9e9e6afe2556ca806cdd87eb5661304a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97402
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2019-03-20 20:52:53 +00:00
Régis Crelier
137171af71 [VM runtime] Disable dual mapping code in AOT runtime (fixes #36260).
Change-Id: I16058ab405536d94aafc169e6494c0a841fce3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97347
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-20 19:23:38 +00:00
Samir Jindel
d14dfc5d8a [vm] Support FFI on ARM64 and Android.
Change-Id: I33f3fb1dbf5a4aee4eaea08d0ca51b60114c8680
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97109
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-03-20 17:45:23 +00:00
Samir Jindel
b032f1b284 [vm] Support FFI on 32-bit Intel.
Change-Id: I08acf6ef00e899f95dbaf2de36f1aea5e6e7ea3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97108
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-03-20 17:45:23 +00:00
Ryan Macnak
a2d7227a76 [vm] Never give DBC instructions executable permissions.
Bug: https://github.com/flutter/flutter/issues/29022
Change-Id: I8f264ffca79d7684643d74033e2cd79f2b2f35a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97275
Reviewed-by: Régis Crelier <regis@google.com>
2019-03-20 16:13:55 +00:00
Samir Jindel
5e9df35a57 [vm/ffi] Correctly sign- or zero-extend arguments and return values from native code.
Bugs fixed: dartbug.com/36122

Change-Id: Id64429b8e808356ab19b96ef6faf48577ae962db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96946
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-03-20 13:27:25 +00:00
Martin Kustermann
def9671d32 [VM/SIMDBC] Add simdbc64 bytecodes to allow LoadIndexed/StoreIndexed to work on untagged arrays
Issue https://github.com/dart-lang/sdk/issues/35154

Change-Id: I86db977ce6c618fbbff6186cd75c8dc84546f6f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97302
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-20 11:23:35 +00:00
Jens Johansen
58882ffdd4 VM reads import uri if kernel binary version >= 22
This CL also includes a service test for setting
a breakpoint in a part file from a package.

Fixes #35859.

Change-Id: I0199006a87746dc1c27721ba0d51e502e76cb107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97104
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-03-20 09:39:33 +00:00
Jens Johansen
e9e0daee5c Add importUri and fileUri to Source.
This will enable the VM to map URIs to package-URIs to solve problems
such as https://github.com/dart-lang/sdk/issues/35859

Change-Id: I15520325a5b81a99a7e3f56c2e35fd775d9da946
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96905
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-03-20 08:44:33 +00:00
Ryan Macnak
565e56dba6 [vm] Reduce cost of allocation tracing.
Remove separate table for predefined classes. The original allocation stats CL had this separate to allow directly embedding the table address into code, but we no longer embed addresses to support AppAOT and AppJIT.

Change-Id: Ida3d0764ac8ff179c0541ee73a3283c9c50affab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97286
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-19 22:46:59 +00:00
Liam Appelbe
89f00ab25f Add a build rule for bytecode version of kernel_service.dill
Bug: https://github.com/dart-lang/sdk/issues/36047
Change-Id: Ifc95ff270c33cce13699bda23c1b7c8fb6139e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96835
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-19 21:29:29 +00:00
Ryan Macnak
fadf9b5fb3 [vm] Account for direct code calls from unoptimized code for --reused_instructions.
For example, constructors directly reference an allocation stub.

Change-Id: I5779c476c7721d2cc4b6ceb9348a1ffeaa5e082d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97272
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-19 21:28:19 +00:00
Liam Appelbe
21810c2aa1 Include gen_kernel_bytecode in create_sdk so that it can be uploaded by the builders
Bug: https://github.com/dart-lang/sdk/issues/36047
Change-Id: Ibe599c00345ea7ed2007f3d16b4d417c9ee8d3f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96540
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-19 19:36:59 +00:00
Ryan Macnak
2c001aacc0 [vm] Address various quirks observed in Fuchsia profiling samples.
- Don't waste time scrubbing or qualifying function metadata names.
 - Don't waste time scrubbing or lib qualifying function names for timeline events.
 - Give intrinsic functions a grace usage counter.
 - Fix wrong flag guarding stack overflow name-based slow paths.

Change-Id: Ib78e7e4f8de51208266190fff2d1f7eb8d80c329
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97174
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-03-19 17:46:08 +00:00
Stevie Strickland
af5fc2d4d2 [VM] Partial support for named regexp captures.
See https://github.com/tc39/proposal-regexp-named-groups
for a high-level description of the feature and examples.  This is one of the
features requested in https://github.com/dart-lang/sdk/issues/34935.

This is a partial implementation because while there is a way to retrieve
groups via Dart by name, it requires casting the returned Match to the
new RegExpMatch interface to avoid changing the RegExp interface.
Changing the RegExp interface will happen in a future update, since there
are other planned changes to the RegExp interface coming soon and that way
we only change it once. See https://github.com/dart-lang/sdk/issues/36171
for more details on the planned changes.

Also, since only BMP regular expressions are supported, not full
Unicode ones (i.e., those with the /u flag in ECMAscript), \k<NAME>
will only be parsed as a named back reference if there are named
captures in the string. Otherwise, the \k will be parsed as the identity
escape for backwards compatibility. The new tests illustrate this
difference.

Change-Id: Ieeb0374813db78924c9aa8ac3e652dfb6d4a5934
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95461
Commit-Queue: Stevie Strickland <sstrickl@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-03-19 10:40:15 +00:00
Stephen Adams
eda9ccb744 Early exit on VM String.replaceAll
Change-Id: I2578200444935d221fab7f9fb4d515a9b2e75937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97145
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-03-18 22:04:10 +00:00
Alexander Markov
fc7d25e0e3 Revert "[vm] Add data field to TypedData"
This reverts commit d1085e80be.

Reason for revert: performance regressions.

Original change's description:
> [vm] Add data field to TypedData
> 
> This is the first step towards unification of TypedData and
> ExternalTypedData.
> 
> Issue: https://github.com/dart-lang/sdk/issues/34796
> Change-Id: I8aec72030e251f9cd9f00fc5073f8e42b83a8d17
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/79430
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

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

Issue: https://github.com/dart-lang/sdk/issues/34796
Change-Id: Ia11d8c3af0af29d49c3dbf36a3fe7041fbf9aae3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97166
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-03-18 18:53:36 +00:00
Liam Appelbe
724d956fd4 Move use_abi_version from vm directory to bin
I need to access the flag in bin/main.cc, so it can't be in the vm directory

Bug: https://github.com/dart-lang/sdk/issues/36047
Change-Id: Ib19a1b4d89295449b25f7753b2a39f6232c004e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97122
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-15 22:35:25 +00:00
Martin Kustermann
d445d29fa3 [VM] Define layout of _*ArrayView/_ByteDataView in C+++
This removes the 3 fields from the classes in Dart and instead describes
the layout in C++ via a RawTypedDataView class (as already do with
normal RawTypedData). The existing "semi" TypedDataView handle class is
changed to be a real handle class.

This decreases performance of some microbenchmarks due to field guards
not being used anymore (before the JIT could add a field guard to view classes
guarding that only normal typed data is used as backing store (and not e.g. external
typed data)

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

Change-Id: I7a0022b843a4c0fa69f53dedcc4c7bd2117cdc37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96806
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-15 21:24:15 +00:00
Alexander Markov
d1085e80be [vm] Add data field to TypedData
This is the first step towards unification of TypedData and
ExternalTypedData.

Issue: https://github.com/dart-lang/sdk/issues/34796
Change-Id: I8aec72030e251f9cd9f00fc5073f8e42b83a8d17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/79430
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-15 19:47:45 +00:00
Alexander Markov
d53311866f [vm/bytecode] Support native methods in BytecodeFlowGraphBuilder
Change-Id: I7cd08a36a738c9c74a5c44854b60160484cb9f2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96989
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-03-15 19:17:48 +00:00
Aart Bik
0a42e8e062 [dart/vm] fix potential buffer overrun in unicode utils
Rationale:
Found by libFuzzer, calling into Utf16::Encode should
ensure sufficient output buffer is available since
it accesses two uint16_t words.

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

Change-Id: I14733b0b059f9d710e022b02d143e42c8b5f91e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97042
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-03-15 18:18:15 +00:00
Samir Jindel
025825dc0f [vm] Update ffi status files and fix function_stress_test on Windows.
Issues fixed: dartbug.com/35933, dartbug.com/35935 and datbug.com/36138.

Change-Id: I4a057951abf9a022a3fc7a63e85a32e8fae22a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97105
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-03-15 15:11:20 +00:00
Daco Harkes
638f13ff3d Revert "[ VM / dart:isolate ] Added ability to set names for spawned isolates."
This reverts commit 59525264e8.

Reason for revert: causes Flutter test observatory and protocol to deadlock.
Issue: https://github.com/dart-lang/sdk/issues/36232

Original change's description:
> [ VM / dart:isolate ] Added ability to set names for spawned isolates.
> 
> Fixes issue #34059
> 
> Change-Id: I315498b02edc184e9e408c93eddb78aa1a5a8a1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/90341
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I5f2115a2ac394a8d4c7c175bc97f2b88b65fcb49
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97107
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-03-15 14:40:37 +00:00
Samir Jindel
85f8d3c047 [vm] Build FFI trampolines with IL.
Bugs fixed: dartbug.com/36033, dartbug.com/36034, dartbug.com/36155.

Change-Id: Ic463dd2d299018e03f840ecedc8b7dfa350c6b95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94860
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-15 12:38:54 +00:00
Samir Jindel
4e68a04f3e [vm] Minor improvements to FFI function tests.
Most importantly, we move resolution of symbols in function_test to the toplevel
so the same function object is re-used on each invocation. This makes it possible to
tests repeated invocations with the optimization counter enabled.

Also added some comments and new tests.

Change-Id: I3772a1f15d1ad9924c8583112ddf3b1349fb6c09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96083
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-03-15 12:38:54 +00:00
Ben Konyi
59525264e8 [ VM / dart:isolate ] Added ability to set names for spawned isolates.
Fixes issue #34059

Change-Id: I315498b02edc184e9e408c93eddb78aa1a5a8a1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/90341
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-14 22:23:09 +00:00
Ben Konyi
1efe7e2518 [ VM / Service ] Added getMemoryUsage RPC and MemoryUsage object to service protocol
Change-Id: If15e49d7aab93382c15529a738b492552faf5376
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95489
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-14 21:53:49 +00:00
Régis Crelier
00a478ca80 [VM runtime] Do not leak file descriptors of dual mappings to child processes.
This applies to linux only and is a suggested precaution.

Change-Id: I81cc345eb2c316530de1fd779cdf392804a68490
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96982
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-03-14 20:47:14 +00:00
Ryan Macnak
f7a36792b2 [vm] Fix memory leaks in --load_compilation_trace and --load_type_feedback.
Bug: https://github.com/dart-lang/sdk/issues/36208
Change-Id: I08142c1840a57fcd1023e7cd8bb26ab4039cfa9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96963
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-14 19:26:13 +00:00
Régis Crelier
e2a86d9081 [VM runtime] Use memfd_create instead of shm_open for dual mapping of code.
Detect both at compile time and runtime for memfd_create support and disable
dual code mapping if not available.

Change-Id: I6908e6c116a60218bb5002378470011dfe76a257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96845
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-14 16:56:34 +00:00
Stevie Strickland
f31b7928ae [VM] Adding regexp lookbehind assertion support.
See https://github.com/tc39/proposal-regexp-lookbehind
for a high-level description of the feature and examples.  This is one of the
features requested in https://github.com/dart-lang/sdk/issues/34935.

This work takes the feature as present in the v8 engine and appropriately
merges it into our irregexp fork. Notable changes to the irregexp codebase to
introduce this feature:

-----

We can no longer assume that all matching proceeds forwards, since lookbehind
matching proceeds backwards. Similarly, we cannot assume that we can only be
at the start of a string if we started matching from that point. The direction
of matching must also be taken into consideration when doing bounds checking,
which previously assumed the engine would never attempt to look before the
start of a string.

-----

We may now parse backreferences to captures before the capture they
reference, since we parse regular expressions left to right, but lookbehinds
perform captures as they evaluate the string from right to left.  Since
RegExpBackReference objects contain a pointer to their corresponding capture,
this means that we may need to create RegExpCapture objects prior to the
parsing of the corresponding captured subexpression.

Thus, RegExpCapture objects are now only initialized with their index, and the
body is set later when the subexpression is encountered and parsed. This means
any method that operates on the body of a RegExpCapture can no longer be const,
which also affects the rest of the RegExpTree class hierarchy. This also means
that we don't have a valid max_match length for backreferences based off the
capture body, and must assume they can end up being any length.

-----


Change-Id: Iffe0e71b17b1a0c6fea77235e8aee5c093005811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94540
Commit-Queue: Stevie Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-14 14:26:47 +00:00
Ryan Macnak
ac4eca7eb9 [vm, gc] Take advantage of object alignment and non-overlap when copying objects during a scavenge.
Change-Id: Ic58b391f4bf5141da61fd45e2c8358ef1bd285be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/72072
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-03-14 01:17:56 +00:00
Alexander Markov
b1a3629547 [vm] Move receiver variable to ParsedFunction, add ParameterVariable()
This refactoring moves receiver variable (previously known as this_variable)
from ScopeBuildingResult into ParsedFunction, like other special variables.
This is done as ScopeBuildingResult is AST-specific and not available
in bytecode, but certain flow graph builders use receiver variable
(for example to load instantiator type arguments for type arguments
checks).

This CL also introduces convenience ParsedFunction::ParameterVariable()
method to reduce repetitive incantations

  parsed_function->node_sequence()->scope()->VariableAt(..)

to a more readable

  parsed_function->ParameterVariable(..)

Change-Id: I427536abfa412de9916b79cf2e56e06f2f2f1d71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96842
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-03-14 00:25:56 +00:00
Daniel Nicoara
d1a943281b Change path order when trying to open tracing
/sys/kernel/debug/tracing is the old path[1] and only present for
backwards compatibility. Check the new path first otherwise accessing
/sys/kernel/debug/tracing will cause debugfs to be mounted. If
permissions are not set correctly after the mount, the user process may
not have a way to access the trace_marker.

[1] https://www.kernel.org/doc/Documentation/trace/ftrace.txt

Bug: None
Change-Id: Ifbd967c0f7298c8877c23bd4908d172b94f9e2d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96832
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-13 23:44:11 +00:00
Aart Bik
6483f5238f [dart/vm] be more flexible with precomputed constants
Rationale:
The problem was that we were evaluating field
initializers while still loading the constant
table. This hit two asserts (1) having pending
potential_natives() when entering codegen and
(2) not being able to evaluate constants
since the table has not been loaded yet. The
solution is to simply postpone enum field
initialization (forced to avoid hot reload
issues) while loading the constant table
until right after the table is ready.

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

Change-Id: I5060476e5b3b49e555cfc507fb398ef0144b44d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96844
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-03-13 23:38:26 +00:00
Ryan Macnak
580e5731d6 [vm] Test compilation traces, type feedback, reused instructions.
Improve error for failure to reuse instructions.

Change-Id: I38b30a0da508f686d73dffebbf5893d6c939f19a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95940
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-13 23:36:06 +00:00
Ryan Macnak
217a027456 [vm, interpreter] Support unboxed fields.
Bug: FL-208
Change-Id: Ia6d6b913ccfc3b279ae89666bfb6f494a098b102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96523
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-03-13 23:29:56 +00:00
Zach Anderson
e711486873 [vm,dart:io,fuchsia] Be happy with any open fd for Stdio handles if fstat fails
Change-Id: Iabb1d25d1649b60805f6c16550520596a01d20df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96843
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-03-13 20:20:01 +00:00
Alexander Markov
ee529e3451 [vm] Fix typo forwader => forwarder
Change-Id: I67906e25ddaf2fb6650f61dad7c12c96b6367222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96821
Commit-Queue: Samir Jindel <sjindel@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-03-13 16:39:02 +00:00