Commit graph

18988 commits

Author SHA1 Message Date
Clement Skau 22652a3b49 [vm/ffi] Privatizes dart:nativewrappers' getNativeField(..)
TEST=Updated dart_api_impl_test.

Change-Id: Ib72667b2a20adc342f724a6eff7d326e2e106257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214401
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-24 13:13:55 +00:00
Johnni Winther 5b7968346d [kernel] Add Field.fieldReference
This adds a third reference to Field declaration, so that we know have
three references, one for each use case:

1) fieldReference used for initialization; in FieldInitializer and as
   the key in the InstanceConstant.fieldValues map.
2) getterReference used for reading; in InstanceGet, StaticGet and
   SuperPropertyGet
3) setterReference used for writing; in InstanceSet, StaticSet and
   SuperPropertySet

TEST=existing

Change-Id: I223f130e808e7f19a831c1fe5e3a4725d1bcdc3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203770
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-24 12:01:08 +00:00
Alexander Thomas 637fb323d9 [vm] Use UTF-8 to read files in *_layering_check.py
Some files in runtime/ are UTF-8 encoded, e.g.:
runtime/vm/unicode_test.cc

Change-Id: Ie71fd46fb66fe793742dbf8a6645b8402956ab77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-24 09:50:27 +00:00
Bruno Leroux 2481cf76f5 [ VM / Service ] Fix 'dart:' scripts lookup
Bug: VM service `addBreakpointWithScriptUri` and `addBreakpoint` don't add valid breakpoints for code in `dart:` libraries. See #47204

This PR contains :
- a new test : 'service/break_on_dart_colon_test.dart', that checks several URIs to register breakpoints in `dart:` libs.
- a fix in `Debugger::SetBreakpointAtLineCol` to make it calls `Library::LookupScript'` with the right value for `useResolvedUri` parameter.

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

TEST=runtime/observatory/tests/service/break_on_dart_colon_test.dart

Change-Id: Id3d6722c278e3238202a9d84a0d34612b957035c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213766
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-24 01:20:38 +00:00
Alexander Markov e7ce24744b [vm] Take number of base type parameters into account when checking equivalence of function type parameters
When checking if type parameters are equivalent for subtyping,
check both base and index of the type parameter to avoid matching
type parameters from different levels. For example, consider
the following function types:

  void Function<S>(S val) Function<T>(T val)
  void Function<S>(T val) Function<T>(T val)

Also, when instantiating a signature of a closure, correct
base/index of type parameters even if they are not instantiated.

TEST=language/function_subtype/nested_function_type_test
TEST=language/closure/nested_generic_closure_test

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

Change-Id: I6f75a4ee70435f42afeb772e7ecc680ab75a7520
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214136
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-23 18:47:58 +00:00
Chloe Stefantsova 65184a9ff4 [cfe] Don't serialize an empty show/hide clause
TEST=existing

Change-Id: Ie63444c4dbeaa45b38fd195e554780f14fed878e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213767
Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 14:01:54 +00:00
asiva b7de66efd3 [Runtime/VM - Enable SUPPORT_TIMELINE even in product mode for Android
Please see https://github.com/dart-lang/sdk/issues/47264

The Flutter team would like to turn this on in product mode for being
able to systrace release applications.
This change could have potential size and performance regressions and
will be monitored as it rolls into Flutter. If the impact is not within
acceptable ranges it can be rolled back.

TEST=ci

Change-Id: Iad6f9b831eaf60d15f03e368702fb25bc9ebc76c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214241
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Dan Field <dnfield@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-09-22 22:35:32 +00:00
Ryan Macnak 9854a04210 [vm] Remove dead Thread::pending_functions_.
Cf. c9f5c3a79e.

TEST=build
Change-Id: I9edff8afaf277b03c4dfdcdbea9ba244dde577ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213740
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-22 17:16:36 +00:00
Ryan Macnak 306718fe1e [vm, compiler] Fix FFI callbacks on ARM64C.
HEAP_BITS must be initialized before any variant of LoadCompressed is used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47259
Change-Id: I01ebb4e6c2eee1e61e15c1d8cc2913d0db27c2bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-22 17:11:36 +00:00
Lasse R.H. Nielsen 18f37dd8f3 Add extension name getter on Enum.
We use an extension getter instead of an instance getter because
it doesn't conflict with any potential existing or future enums
which want an element named `name`.
Keeping the namespace for enum elements open is a priority.
We currently only reserve `index` and `values`.

BUG: https://github.com/dart-lang/language/issues/1511

Fixes language issue #1511, which is a long-standing request,
and should replace a number of alternative implementations
which are based on parsing the `toString()`.


This version has two fields on the shared superclass, the index
and private name, and has a separate `toString` for each `enum` class
which hard-codes that enum's class name.

An earlier version had both `"name"` and `"ClassName.name"` as fields
to be able to reuse the same `toString` method on all enum classes,
but that cost too much for JS compiled code.
Even having just `ClassName.` as a field and then combining inside
`toString` requires more code to create the enum instances.
Instead this version hardcodes the `ClassName.` string once
in the `toString` method, which means each enum class has its own
toString (which can *potentially* be tree-shaken then.)

This still tree-shakes slightly worse than the previous implementation
where every enum class had its own `index` and `_name` fields
independent of each other, which could then be tree-shaken independently.
However, the `index` was already made an interface member with the
addition of the `Enum` interface, so code which accesses `.index`
on something of the `Enum` supertype could prevent tree-shaking of
all enum classes' `index` fields.
Likewise any general access to the "name" of an enum would necessarily
do the same for the name.
This CL makes up for some of that by sharing more implementation
between enum classes.

DartVM AOT CodeSize impact: ~0.15% regression on gallery (little less on big g3 app)

TEST= New tests added to enum_test.dart

Change-Id: Id25334e6c987f470f558de3c141d0e3ff542b020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210480
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-22 14:20:16 +00:00
Ryan Macnak 2d207f49cc [vm, compiler] Adjust the write barrier stub to no longer assume there is no race when setting the remembered bit.
Failure to check for losing the race can result in the same object being added to the remembered set twice, and processing the remembered set is not idempotent.

Previously there could be no such race, but the combination of lazy initialized const maps/sets and isolate groups means that now more than one Dart thread can be writing to the same object.

TEST=cfe and fuzzer bots, flaky
Bug: https://github.com/dart-lang/sdk/issues/47233
Change-Id: I7684ea6ba90941bb174c35ae040372aa331ac4c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214077
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-09-22 00:16:58 +00:00
Siva Annamalai a433fc3e13 Revert "[ VM ] Properly shutdown non-core system isolates when cleaning up the"
This reverts commit 58c58af3e8.

Reason for revert: The code can cause a deadlock, see https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8835779319093894049/+/u/vm_tests_shard_2/task_stdout_stderr:_vm_tests_shard_2

Original change's description:
> [ VM ] Properly shutdown non-core system isolates when cleaning up the
> VM
>
> Speculative fix for https://github.com/dart-lang/sdk/issues/45771
>
> TEST=CQ + vm/cc tests
>
> Change-Id: I3f05d78666ee78afca5af6047df96d7841cd1e02
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213561
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

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

Change-Id: I606d805e173b59dcb6651658a194a58d63afcc48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214065
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-09-21 18:52:58 +00:00
Alexander Aprelev d46f474d79 [dartfuzz] Fix time units in 'Isolate busy' message
Change-Id: I3d14763a2607ef47a51883a2acaf7545e63358ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213964
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-20 22:04:15 +00:00
Ben Konyi 58c58af3e8 [ VM ] Properly shutdown non-core system isolates when cleaning up the
VM

Speculative fix for https://github.com/dart-lang/sdk/issues/45771

TEST=CQ + vm/cc tests

Change-Id: I3f05d78666ee78afca5af6047df96d7841cd1e02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213561
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-17 13:45:49 +00:00
Ryan Macnak 78b9f54957 [vm] Fix initialization of Contexts in object graph copy's fast-path bailout.
Cf. 179c96cd60.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47235
Change-Id: I9f6aef564286f6b239d697072ed5405085269add
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213681
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-16 22:17:24 +00:00
Ben Konyi 123950ffa9 [ CLI / VM ] Add support for disabling DDS
Allows for tooling (e.g., DAP) to spawn their own DDS instance without
having to disable the CLI.

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

TEST=pkg/dartdev/test/commands/run_test.dart

Change-Id: Ie9a4832d424edae67f32560399d3b0a6ca9f1dc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213660
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-16 20:31:45 +00:00
Ryan Macnak d30a43d464 [vm] Allow for long jumps during reusable handle scopes.
Such long jumps may occur due to Out Of Memory exceptions.

TEST=run test harness with low heap limit
Change-Id: Ifc8d062d4325ea3cdb4ea1f1ad1877f2dc83229e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213534
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-16 19:40:05 +00:00
Ryan Macnak e7201752dc [vm, gc] Fix double-free when we hit Out Of Memory.
TryReleaseReservation could insert an element into the freelist before the concurrent sweeper visited that page it was on.

TEST=run test harness with low heap limit
Change-Id: I482c820756ea3dbfe6d16c8bdef998e843c576dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213536
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-16 18:27:35 +00:00
Alexander Markov 7cd65a7a0c [gardening] Skip vm/dart_2/v8_snapshot_profile_writer_test on tsan bot
This test was flaky and started timing out consistently on
vm-kernel-precomp-tsan-linux-release-x64 bot.
It times out even if marked 'Pass, Slow' in status file.

Change-Id: Id3af3fafd0939e61b5efd3adcedc966548ac8bb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213623
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-16 18:09:35 +00:00
Ryan Macnak 790d0b601c [vm] Account for Out Of Memory during isolate message deserialization.
TEST=run test harness with low heap limit
Change-Id: I75d3b2e8461bcf99cc41eb3ad76173bc1976bbd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213538
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-16 17:18:37 +00:00
Ryan Macnak 5110d828d0 [vm] Fix error notification when unable to print the stacktrace.
TEST=run test harness with low heap limit
Change-Id: I8084c50c3aab1c0cbfa32bbcc5df100abe4211bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213537
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-16 17:13:35 +00:00
Ben Konyi be58178acf [ VM ] Skip breakpoint_on_simple_conditions_test on AOT configurations
TEST=N/A

Change-Id: I326d4373d19549c88cb4e257a9d2638d062c7593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213562
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-09-16 17:00:27 +00:00
Ben Konyi c51f885613 [ Debugger ] Allow for setting breakpoints on conditional statements
with simple boolean conditions

Fixes https://github.com/flutter/devtools/issues/3289

TEST=runtime/observatory/tests/service/breakpoint_on_simple_conditions_test.dart

Change-Id: I5ed0b78b4e462615d0d0c7dff1581b38dcf00aee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213421
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-16 16:12:17 +00:00
Alexander Markov 15b499b8b2 [vm] Allow Symbol constants _foo without a library
Since Symbol constructor started accepting arbitrary string as argument
(https://github.com/dart-lang/sdk/issues/46207), front-end can generate
Symbol constants with names starting with '_' but without a library.

TEST=language/vm/symbols_test
TEST=corelib/symbol_test

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

Change-Id: Ic416122785444a59bf6b469d2b42491f62810258
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213535
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-16 15:56:24 +00:00
Ben Konyi 4759cd95da [ Profiler ] Add safepoint checks in profiler code to improve sample
streaming performance

TEST=CI

Change-Id: Iae536901a41f4b34207e022ec1e6321cfc2d74b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213380
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-09-16 13:58:45 +00:00
Ryan Macnak d89e42bef5 [vm] Rename clustered_snapshot.h/cc to app_snapshot.h/cc.
Since bbefc05748, both serialization formats in the VM are based on clustering. The distinguishing feature of the older clustered serializer is that it represents apps/programs rather than messages.

TEST=ci
Change-Id: If3185c21c6aadeec61a940b12ba23d17f2752761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211501
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-09-16 00:13:34 +00:00
Ryan Macnak 179c96cd60 [vm] Switch Context to compressed pointers.
TEST=ci
Change-Id: I2511dcc9234dbe29dcbc3abf3db7a8a080dc5436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213112
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-15 22:32:04 +00:00
Alexander Markov 2765b7c911 [vm/compiler] Cleanup passing of try_index
FlowGraphCompiler::CurrentTryIndex() always returns correct try_index,
even when generating slow path code. So we can cleanup passing of
try_index for slow paths.

Also, removed unnecessary arguments from EmitMegamorphicInstanceCall as
it is no longer called on slow paths.

TEST=ci

Change-Id: I2fc29914c0c45068c1732eac27f3da3fd4da6823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213411
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-15 16:51:17 +00:00
Clement Skau cd7c9922eb [vm/ffi] Adds FFI transform for Handle -> Pointer.
This will automatically desugar FfiNative calls passing
NativeFieldWrapperClass1 handles to use Pointer when
the underlying native function expects a pointer.
E.g.:

```
class ClassWithNativeField extends NativeFieldWrapperClass1 {}

@FfiNative<IntPtr Function(Pointer<Void>)>('PassAsPointer')
external int passAsPointer(ClassWithNativeField obj);

passAsPointer(ClassWithNativeField());
// Becomes roughly:
// #t0 = PointerClassWithNativeField();
// passAsPointer(Pointer.fromAddress(getNativeField(#t0)));
// reachabilityFence(#t0);
```

TEST=Adds new tests in tests/ffi/ffi_native_test.dart.
Change-Id: I4460f9249803054f12be5d5ff34dbdf7c96567fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213260
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-15 12:47:35 +00:00
Ahmed Ashour d6975c1905 master branch to main
Fixes #47190

TEST=None, only markdown files where edited.

Change-Id: Ife204f9c792b6bce30d0cd7bf2260ced11c8f2b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213049
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-09-15 06:22:23 +00:00
Ryan Macnak 5c79501a64 [vm] Remove Dart_GetImportsOfScheme.
Dead since bda70c8489.

TEST=build
Change-Id: I0aed3d9d30a2b01f57f5d6a6bd02105fa89e3095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213405
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-14 21:18:37 +00:00
Alexander Markov d90b297166 [vm/compiler] Refactor Precompiler::AddCalleesOfHelper to use switch
This is a follow-up to review comment
https://dart-review.googlesource.com/c/sdk/+/213288/1/runtime/vm/compiler/aot/precompiler.cc#998

TEST=ci

Change-Id: I59b7b03eb1a9b90bd107fc07906c333d3d63283d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213292
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-14 18:52:47 +00:00
Ben Konyi b1491fc43e [ Service ] Test constructor tearoffs through VM service
Fixes #46240

TEST=runtime/observatory/tests/service/constructor_tear_off_test.dart

Change-Id: I335b16106db89dfede10d2ba3b73676465b306bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212627
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-14 17:14:31 +00:00
Ryan Macnak b32bde155d [vm] Label virtual memory allocations on Android.
TEST=examine /proc/pid/smaps and Observatory's "process memory" page
Change-Id: I03922c9c604ceef8901a8946481d0ccc31110b72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213289
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-09-14 16:10:10 +00:00
Alexander Markov 4744f66f6f [vm/compiler] Minor improvements for AOT compilation time
* When testing for pragmas in the inliner, call function.has_pragma()
  early to avoid more expensive Library::FindPragma query.

* When scanning through object pool entries in
  Precompiler::AddCalleesOfHelper, skip over OneByteString and null
  objects quickly. They are leaf and there could be a huge number of
  those objects.

AOT gen_snapshot time of a large Flutter application built in
flutter/release mode for arm64 (best of 5 runs):
Before: 81.589s
After:  74.415s (-8.79%)

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/43299
Change-Id: I960451c73b42dab9845f0e0eafacaa9bb23720e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213288
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-13 21:25:30 +00:00
Ryan Macnak 700969604a [vm] Require C11 thread_local support.
Thus requiring iOS 9+.

TEST=build
Change-Id: I40062753ae030231d4e4ae428c9145f4370cb9a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213283
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
2021-09-13 19:30:30 +00:00
Alexander Markov 125482c0c6 [vm/compiler] Skip AOT unit test vm/cc/TypePropagator_NonNullableLoadStaticField on ia32
TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/47183

Change-Id: I775f4a60debef5856e273f284b9a0f236b03f24d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213103
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-13 17:59:29 +00:00
Alexander Markov 30abce99f3 [vm] Treat static final fields with trivial initializers as const
When loading a value of a static final field with trivial initializer
generate a Constant instruction instead of LoadStaticField.

Initializer of a static field is considered trivial if it is null, int,
double, String or bool literal.

TEST=vm/cc/StreamingFlowGraphBuilder_StaticGetFinalFieldWithTrivialInitializer
Fixes https://github.com/dart-lang/sdk/issues/47120

Change-Id: Id2bfc3da8c14376f7f1ef829265cca29a018bad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212873
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-13 16:51:59 +00:00
Chloe Stefantsova 2048ab37f1 [cfe] Add shown and hidden elements to Extension Kernel node
TEST=existing

Change-Id: I8271cb7f4731dea289c855b0c5384f8e181530c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212761
Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-13 13:18:19 +00:00
Clement Skau 7d467e8933 [vm] Adds args_n to FFI resolver.
This makes it more closely mirror the Dart_NativeEntryResolver,
and acts as an extra sanity check that signatures (roughly)
align between the FfiNative decl. and the native function.

TEST=Updated runtime/vm/dart_api_impl_test.cc

Change-Id: I40799dc583ec14db14dc453afed4e2d1eb06fced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212566
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-09-13 07:57:00 +00:00
Ryan Macnak f51fe8fca4 [vm] Reimplement BaseDirectChainedHashMap to use less memory.
gen_snapshot dart2js.dill ...
Maximum resident set size (kbytes): 432920 -> 412908 (-4.6%)

gen_snapshot dart2js.dill --write-v8-snapshot-profile-to=...
Maximum resident set size (kbytes): 904756 -> 662024 (-26.8%)

Also shrinks the VM's binary size by ~100k.

TEST=ci
Bug: b/196510517
Change-Id: I73ea0f87b75e3c1dacb5f31a687effe293e5a350
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212920
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-09-10 22:21:36 +00:00
asiva c8040131c6 [VM/Runtime] - Switch DartInitializationState to use atomic operations instead of mutex/condition variables
TEST=ci

Change-Id: Ifbcbfdba4874930e83e17de4882b535dc3e76a7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212865
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-09-10 22:18:20 +00:00
Ryan Macnak 802dfdfd62 [vm, compiler] Restore the performance of LoadUniqueObject.
The purpose of LoadUniqueObject (77c206f231) is to avoid the cost searching for matching object pool entries. Pass kPatchable to AddObject to skip the work of inserting / rehashing. This also fixes incorrect use of DirectChainedHashMap::Insert with an already-present key.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/23249
Bug: https://github.com/dart-lang/sdk/issues/38018
Change-Id: I30cc3212720d3ddfc9bc515b092a4cd6f6879b8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213027
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-09-10 21:53:26 +00:00
Martin Kustermann 260eac5f80 [gardening] Give vm/dart{,_2}/use_strip_flag_test more time in TSAN mode
Issue https://github.com/dart-lang/sdk/issues/42986

TEST=Updating status file

Change-Id: I30a6cbb2926145e393287fbc684615fa00911bb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213045
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-10 13:34:29 +00:00
Jens Johansen 48d8225b17 [VM] [CFE]: Expression compilation inside extension method
This CL handles expression compilation inside extension methods better.
It is now possible to evaluate "this" and other methods defined in the
extension.

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

TEST=service tests added.

Change-Id: I3c71eb23117e26b01961f32103f4046f0b537976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212286
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-10 12:02:57 +00:00
Ryan Macnak 9ab7c09356 [vm, compiler] Fix incorrect merging of doubles that are equal but not identical.
TEST=implicit_double_context_test (flaky)
Change-Id: I1c4d285897fb4dd3aae15323ab4e671bec88c564
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212870
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-09-09 20:26:35 +00:00
Alexander Markov d69828ee2f [vm/compiler] Fix nullability of LoadStaticField
TEST=vm/cc/TypePropagator_NonNullableLoadStaticField
Fixes https://github.com/dart-lang/sdk/issues/47119

Change-Id: I67b62895cbd8e79a19405b441ecca1f3ca4c9047
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212661
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-09 17:44:31 +00:00
Alexander Markov be06aef0f9 [vm] Fix VM unit tests for sound null safety
This change fixes vm/cc/** unit tests for sound null safety.

Also, type propagation is slightly improved for int operations to
help AOT unit tests which don't run TFA and don't have type feedback.

TEST=tested with sound null safety enabled

Change-Id: I6c42b377d4fa8035c99e5fabf1de2ae52272b994
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212862
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-09 17:22:01 +00:00
Alexander Markov c547e3e104 [vm/compiler] Improve elimination of dead CatchBlockEntry Parameters
This change improves elimination of dead ParameterInstr instructions
by skiping over Unbox instructions when tracing for real uses.

Previously, ParameterInstr were removed if they we used only by other
dead Parameters or as inputs to dead phis. Now, Unbox instructions
are also allowed as long as they are also dead.

TEST=vm/cc/TryCatchOptimizer_DeadParameterElimination_Cyclic1
(with sound null safety)

Change-Id: Iba807ce43d10ff6e400abd614cc749d60f2454e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212900
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-09-09 17:20:11 +00:00
asiva 2785fe9996 [VM/Runtime] Check for valid values specified for old_gen_heap_size and
new_gen_semi_max_size

TEST=new unit test

Change-Id: I3dd985baf28c1e876c128252c15b8566d22b170d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212267
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-09-09 02:39:03 +00:00