Adds shared libraries for embedding Dart VM and new API (runtime/engine/include/dart_engine.h).
TEST=tests/standalone/embedder_samples_test.dart
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-aot-win-product-x64-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-appjit-linux-product-x64-try,vm-appjit-linux-release-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-product-arm-try,vm-ffi-android-product-arm64c-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-gcc-linux-try,vm-linux-debug-ia32-try,vm-linux-debug-simriscv32-try,vm-linux-debug-simriscv64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-arm64-try,vm-linux-release-ia32-try,vm-linux-release-simarm-try,vm-linux-release-x64-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-msvc-windows-try,vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try,vm-win-release-x64-try
Change-Id: Ia4e4d1b871ddef515cfb2f4639bdaa9fe3676936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402860
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Removes frames in stack traces for private platform members
(any `dart:...` entry with a private name, any `dart:_...` entry),
removes line/column number from any remaining `dart:` functions,
and removes the stack frame number (which depends on the number of
removed frames).
Should not affect what is actually being tested, but avoids the test failing
any time a line number in the platform libraries change.
Change-Id: I7255a3ae5fb6ff2cbca0830ce61ddcdb7d0f43a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406003
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This removes unnecessary code from SourceFactoryBuilder previous inherited from SourceFunctionBuilderImpl.
Redirecting factory specific is moved fully inside SourceFactoryBuilder and most method are made private.
This is in preparation for creating factory builders using fragments.
Change-Id: I273b3c360fb51a7c1533f14d267c7f6aae949d19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406001
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The optimized builders run with binaryen which by default strips static symbols
(in all -Ox modes). So we'll pass `--no-strip-wasm` to `dart compile
wasm` in order to keep the static symbols.
This makes stack traces have the symbols in them which will make tests
that rely on that more likely to work.
Change-Id: I9e0eab8c4ec50ef3a7208551d04a80e9ffa009e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406241
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Calls to the implicit setters for fields are replaced with field assignments (HFieldSet). This is inhibited when the setter needs to check its argument, which happens when the field type is covariant and the checks not 'trusted', i.e. at optimizations level `-O2` and lower (aka 'spec' mode).
This optimization detects when the check is unnecessary due to invariance. If the receiver of a setter instance call to the the implicit setter has `this` as a receiver and the setter does not have an explicit `covariant` declaration, then the check will always pass, so the setter call can be replaced with HFieldSet.
This optimization works well for Iterators for generic collections at the assignment to the `_current` field, with some iteration-heavy benchmarks improved by 20-50% at `-O2`.
Change-Id: I4f3ffd08b45ba28de721535afc3c7a6d1e486a3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405448
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Change core library '_throwNew' helpers to return Never.
Since https://dart-review.googlesource.com/c/sdk/+/405604 flow graph
builder automatically appends Stop and closes fragment after appending
a call with return type Never. So additional 'throw' after calling
'_throwNew' are no longer needed and can be removed.
Also, cleanup unused FlowGraphBuilder::ThrowTypeError() and
replace 'throw' with shorter Stop at the end of 'case'.
TEST=ci
Change-Id: I0a5109fd693c0463c53e70e5dd261f8080bf1132
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
It is safe for multiple isolates to set their values concurrently. Only growth of the field tables needs to be excluded by the write lock.
A storm of such setters are invoked as part of core library initialization during isolate spawning.
TEST=ci, tsan
Change-Id: I4677e33ee80bb06d261ada2ae9d6b71c94fde611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This moves the existing `debugPrintCommunication` flag out of `test/lsp` into `test/` and passes it to the `MockServerChannel` to simplify printing protocol messages for LSP-over-Legacy tests (similar to what MockLspServerChannel already does).
Change-Id: Ic5fa6309e8de01ce0c624584ad6eb653ced90698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406021
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
The async state machine uses a single state in the heap to store the current exception and stacktrace when within a catch block in case they need to be rethrown. When catch blocks are nested this state can be overwritten.
With this new change, before entering a new catch we store the current value of the exception/stacktrace in a local that we can restore after exiting the associated catch blocks. A wasm catch can represent multiple Dart catch blocks so we only need to store the state per wasm catch.
Fixes: https://github.com/dart-lang/sdk/issues/59981
Change-Id: I738084fdecdf5aceac65c5d3698e40b791175171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Convert range boundaries with symbolic references to other instructions
into constant boundaries to avoid serializing extra references.
Specially handle serialization of arguments descriptors which are
cached in the VM isolate.
TEST=ci
Change-Id: Ifab3bb4d9b037aaefd81d38dd93d47cd4b42cf1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405571
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Say you have a class method like this:
```
class Bar {
/*offset a*/ void /*offset b*/ qux() {
/*offset c*/ print("hello");
}
}
```
Lets also say that this method is run.
This will mark offset a and offset c as hits.
Offset b does not exist in coverage terms.
Now say you have an extension mehod like this:
```
extension Foo on Bar {
/*offset a*/ void /*offset b*/ baz() {
/*offset c*/ print("hello");
}
}
```
Lets also say that this method is also executed.
This will mark offset a and offset c as hits.
Offset b does not exist in coverage terms for this method.
Because extension methods are special though we create a special tearoff for
it. Lets say we didn't execute that one.
The tearoff method - before this CL - had offset b on positions that caused
the position to exist in coverage terms, and as the method wasn't executed
this would make it a miss.
This CL fixes the issue by setting the offsets on the tearoff that before
introduced offset b to offset a instead.
Change-Id: I3a5339135f3d76327624b35f04cc14afccaf487a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404563
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This class had a few methods which only pertain to the resource provider
and can just be extensions on ResourceProvider. They also have the
exact same impl! So one can redirect to the other.
Change-Id: I3a0433304adba1b71f69d0a4afc8a44515a23d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405600
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Field types, getter types, method return types, and method parameter
types are changed to `Impl` types in the following classes:
- `BodyInferenceContext`
- `BinaryExpressionResolver`
- `ForResolver`
- `ListPatternResolver`
- `PrefixExpressionResolver`
- `StaticTypeAnalyzer`
- `TypeConstraintGatherer`
- `TypeSystemOperations`
- `YieldStatementResolver`
Additionally, the type `DartType` is changed so that it no longer
implements `SharedTypeStructure`. Instead, the private class
`TypeImpl` implements `SharedTypeStructure`.
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: Idbf09e25a26249a16e65a59274e66b477480d697
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405802
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Field types, getter types, method return types, and method parameter
types are changed to `Impl` types in the following classes:
- `AssignmentExpressionResolver`
- `DartPatternImpl` and its subtypes
- `ExpressionImpl` and some of its subtypes
- `PropertyElementResolver`
- `RecordLiteralResolver`
- `TypeParameterElementImpl2`
- `TypeSystemImpl`
- `_InferenceLogWriterImpl`
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: I2cc0dcf0a8e0d97053bf6da4975c729500bb1131
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405840
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
When running in an iframe without specific flags, DDC may not have access to `localStorage`. In this context, even trying to access `window.localStorage` can cause an exception in the iframe.
Wrapping the check in a try/catch allows us to safely check for access before using it.
Change-Id: I0c5d3d0ac34a550444c12b52f6519a9446ebfe9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405608
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Field types, getter types, method return types, and method parameter
types are changed to `Impl` types in the following classes and
extensions:
- `CompoundAssignmentExpressionImpl`
- `ExecutableElementExtensionQuestion`
- `ExtensionElementImpl`
- `ExtensionResolutionError`
- `FunctionReferenceResolver`
- `InstanceElementImpl2`
- `InstantiatedExtensionWithMember`
- `InstantiatedExtensionWithMember2`
- `InterfaceElementImpl`
- `InvocationInferrer`
- `LexicalLookupResult`
- `LocalVariableTypeProvider`
- `PostfixExpressionResolver`
- `PropertyElementResolverResult`
- `RecordTypeExtension`
- `ResolutionResult`
- `ResolverVisitor`
- `SimpleResolutionResult`
- `TypePropertyResolver`
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: I5d0d432301df38c7a5ccc7c65767cf73ce7b5d7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405801
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>