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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>