Adds a @pragma("vm:recognized", <kind>) to all recognized methods, where
<kind> is one of "intrinsic", "graph" or "other", corresponding to the
kind of recognized method.
When running in debug mode, it is checked that all recognized methods
are marked with the correct kind of pragma, and that all methods marked
with the pragma are in fact recognized.
This enables kernel-level analyses and optimizations to query whether
a method is recognized by the VM.
TEST=Asserts that check the correspondence both ways, covered by test
suite, in particular the various CompileAll tests that compile all code.
Change-Id: I12f3305c72a93ecb1aefae2d66e3d9a7dae23b44
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168951
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
- Define private symbols load without reloading the module
and knowing module format
- Remove libraryName->moduleName map from ExpressionCompiler's
compileExpressionToJs API as a result of above
- Make ddc tolerate null locations on kernel loaded from dill
during assert insertions for nullability
- Disable asserts in expression compilation worker
due to ddc reading source for assert statement compilation
- Remove unused test configuration for expression compiler worker
- Add and update expression compiler tests
Part of: https://github.com/dart-lang/webdev/issues/1174
Change-Id: Idf8f508308915a5487fa0e9810b5674140393fed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170028
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Simple calls to `List.generate` are expanded into a list allocation
and a loop. This generates better code for several reasons:
- There is no overhead for the function argument (closure allocation,
closure type, closure class)
- Global type inference is more precise since each List.generate list
is tracked separately, and the assignments in the loop give better
inference to the collection's element type.
To get precise element type inference, there are two new JSArray
constructors. Global type inference starts with the element type being
bottom for these elements, avoiding spurious nulls in the inferred
type.
Change-Id: I5efb90651ae3f9eb2e81af556704960cdf0b75c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168770
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This CL:
- Fixes https://github.com/dart-lang/sdk/issues/43987 (an exception in custom formatting code)
- Restores (most of) debugger_test.dart to passing (which tests above)
- Fixes a type caching error also exposed by the above test
Note, this skips the golden file comparison. That appears to be very broken
(see comment).
Change-Id: I283b66a710f17765faed47aa099b0b8570e6cac1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170022
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
Bug: https://github.com/dart-lang/sdk/issues/42536
Bug: https://github.com/dart-lang/sdk/issues/42535
Since ddc would require a potentially breaking change to emit these
checks in unsound mode without opt-in and it's currently not possible
to emit these checks only in opt-in with dart2js, both are changed
to only emit checks in sound mode. In ddc, calling convention is
changed conditionally on sound mode as well to avoid emitting
unnecessary code in unsound mode.
Change-Id: I42f7bb5a53550f4ee5412fbbbfb6ca533c393e96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169247
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This reverts commit 9dade7fd21.
With changes further in the relation chain, specifically around
making native null assertions tied to sound null-safety only,
the failure which caused the original revert should no longer occur.
Change-Id: I5a6074304d08e6e8f168bea678439b1ab3e90d0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168998
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Bug: https://github.com/dart-lang/sdk/issues/37896
dart2js disallows JS interop classes from extending Dart classes,
and ddc does not work as expected. Dart classes that extends JS
interop classes can't be declared in ddc and throw an error on
usage in dart2js. This CL adds static errors for both cases.
Change-Id: I72001d2e8bec046c0e1ab4c06fed8fcf84ade259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164840
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
The covariance optimization assumed that private members only occur
in the library in which they are private. This is not the case. The
CFE injects member signatures, forwarding stubs and noSuchMethod
forwarders for private members into other libraries.
This change takes that into account by only removing covariant bits
on members private to the enclosing library.
This hopefully a fix for https://github.com/flutter/flutter/issues/66122
Change-Id: I5070cee9eea8e785622cef33fdc7138a0a90f53a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168950
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
- Fixes broken benchmarks in ddc because the benchmarks run in
d8 with the ddc module system can handle conflicting library
names more gracefully than es6.
- In the future we need to update the source of truth for
dart_library.js so we can keep the file in sync.
- Removes the ability for ddb to run with any precompiled sdk.js
from a dart installation. Now you must run a build first and
the sdk.js files from that build will be used. This means the
`--debug` flag no longer changes which sdk.js files are used.
Change-Id: Icaf78956f93ff643d23e68001354ec08c9c28b12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166926
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: I1801d4d8f3f25c76885f3482ae1553d32e6ee15b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168828
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Modifies ddc and dart2js logic to only include null-checks on native
members inside the web libraries. Modifies tests to account for this
change.
Change-Id: If9c164fb90b761d3c4611d87ffeb02c2fa884457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168585
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.
For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.
Closes#43879
Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
- make sure nested blocks scopes are visited
- make sure variable definitions do not leak beyond block scopes
- properly collect scopes for loops, if statements, constructors
- add calculation of fileEndOffsets for blocks
- save block file offsets to dill
- update binary format version
- change kernel readers and writers to read and write block offsets
- change vm readers to read and block offsets for new version
- add missing fileOffsets and fileEndOffsets on functions for
late fields
- add missing fileOffsets and fileEndOffsets on functions for
extensions
- add errors on failures to find scope
- find libraries for private fields correctly
- add more expression compilation tests
- add test to verify fileOffsets and fileEndOffsets are set for
SDK summary (will add full dill tests later)
Closes: https://github.com/dart-lang/sdk/issues/40278
Related: https://github.com/dart-lang/sdk/issues/34942
Change-Id: I5bc1bb645543045b689d8d61069ee77dc4ee9025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167541
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Avoids breaks that appear when enabling the `nnbd` experiment
by default as seen in:
https://dart-review.googlesource.com/c/sdk/+/166790
Some of these synthetic files are created as packages but the
expression compiler wasn't designed to handle that information.
In the future we should support language versioning better in the
expression compiler or setup similar tests for opted in code since
in reality the language versioning might be handled by the dev
build system.
Fixes: https://github.com/dart-lang/sdk/issues/43843
Change-Id: Icfac40d1c9b47e75fb92d7672700e066ac372267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168441
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This reverts commit e02085bec3.
Reason for revert: This seems to break an internal test
(http://b/171029249).
Original change's description:
> [ddc] Move native null-checks to definitions
>
> Bug: https://github.com/dart-lang/sdk/issues/42535
>
> Native null-checks are moved to member definitions, and native
> member accesses are changed to use this indirection in the case
> where the member type can be checked.
>
> Change-Id: I499bb3a4f6a66021dd0ab7930a55e7233c1ce020
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166785
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
TBR=sigmund@google.com,nshahan@google.com,srujzs@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: https://github.com/dart-lang/sdk/issues/42535
Change-Id: I145ff11a18374d0d63e2042956ad53ea0939baf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168345
Commit-Queue: Michal Terepeta <michalt@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
Reviewed-by: Michal Terepeta <michalt@google.com>
Connect the type hierarchy with the missing (compared to the
dart2js versions) of the JSMutableIndexable class.
Avoids an extra copying of all data to a temporary list during
the construction just to get access to the index operator.
Change-Id: I8a9f8ba4d956ac49d6fb635709d11a6e7c018270
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166782
Reviewed-by: Mark Zhou <markzipan@google.com>
Avoid redundant element casts and checks if the list is growable.
Change-Id: Ib915ccf2ec65fbe7d32ecaabe23899f2530617c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166781
Reviewed-by: Mark Zhou <markzipan@google.com>
Use the non-nullablity of local variables and method arguments
to help guide the nullable inference when running with sound
null safety.
Change-Id: I00484dc908502b600de058103381af6588c4a958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155301
Reviewed-by: Mark Zhou <markzipan@google.com>
Bug: https://github.com/dart-lang/sdk/issues/42535
Native null-checks are moved to member definitions, and native
member accesses are changed to use this indirection in the case
where the member type can be checked.
Change-Id: I499bb3a4f6a66021dd0ab7930a55e7233c1ce020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166785
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
dartlang.org -> dart.dev
Remove references to dev-compiler group that has been deleted
Change-Id: I8d994b5f2dba19aab3c3b0fc16c5c340fbce80fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167442
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Change-Id: Ic5e3156ed5e8be131cbd2498017da6f336038761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167420
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
- use parameter types passed to IncrementalCompiler.compileExpression
for compilation of the synthetic function containing the expression
- updated expression compiler tests
Note: some expressions that previously compiled wouldn't now
Example:
** package:test/library.dart **
class TestLibraryClass {
final int field;
final int _field;
TestLibraryClass(this.field, this._field);
}
** main.dart **
import 'package:test/library.dart';
void main() {
var instance = TestLibraryClass(1, 2);
print('$instance'); // Breakpoint here
}
Expression:
`instance._field`
Previously, the incremental compiler would compile the expression
to kernel due to the type of instance being Dynamic. That compilation
result made it impossible for dartdevc to generate correct code due
to missing type information.
Now, the compilation will fail with "Getter isn't defined"
error. To properly evaluate private fields now, we would need
the CFE to support a special mode for expression compilation
where private fields from other libraries are allowed.
Closes: https://github.com/dart-lang/sdk/issues/43469
Change-Id: Id8015c5e334115a82049fb2d1725db54dd3ea3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166925
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
JS templates should always use their own source information. DDC
was incorrectly caching and reusing templates with the same source
information in various parts of the program. This lead to incorrect
source maps and in some cases compiler crashes when the source map
in a user application pointed to source location in the SDK.
Change-Id: I11607e6f02b894ead1d350e9b3071173ba36a048
Fixes: https://github.com/dart-lang/sdk/issues/43589
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166122
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This reverts commit 53895b2270.
Reason for revert: Replacing this change with a new strategy for better module reordering.
Original change's description:
> [dartdevc] Fixing issue related to dual exports of multiple entrypoints in a cyclic import loop.
>
> See: https://github.com/flutter/flutter/issues/64011
> Change-Id: I8a11e9d3f19428a516cf7a60ee45c3bacf26545d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162383
> Commit-Queue: Mark Zhou <markzipan@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Iee91d33d1696ffa7406b724466144ab06af80394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165873
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
- add handling a 'Shutdown' message to expression compiler worker
so the parent program can terminate it before exiting itself
Closes: https://github.com/dart-lang/sdk/issues/43513
Change-Id: I18a4cbd9214a5e72c90d725039c2936e6e67a231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163960
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
These nodes are no longer used.
Change-Id: I40c8df7376f0c40a4122c22d934fb3c6f6fd520d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165902
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This reverts commit 17dba76fb5.
Reason for revert: Replacing this change with a new strategy for better module reordering.
Original change's description:
> [dartdevc] Conserving virtual mixin superclass hierarchies even when marked as deferred
>
> Fixes https://github.com/flutter/flutter/issues/66859
>
> Change-Id: I9ca3ae7a312d48192659508f2fa0617c7f85efd9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165149
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>
TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I02561ab7e4678392ee96a6132b96c7f0a1499a34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165872
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Bug: https://github.com/dart-lang/sdk/issues/42535
Adds a runtime flag to ddc to enable runtime checks on native APIs.
In the case where an API is typed non-nullable but returns a null
value, throws a null assertion error.
Change-Id: I4d5d7529ba28d9308687dad5d51f1b9c71274455
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162461
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
- Emit module before expression compilation to JavaScript so the
ProgramCompiler has all types available.
- Add logging with ticker to expression compilation in expression
compilation worker in DDC and in frontend server.
- Remove excessively verbose logging
Related:
https://github.com/dart-lang/webdev/issues/1006https://github.com/dart-lang/webdev/issues/1106
Change-Id: Ia3a985f2d12d27f0bcc2c5d3923db137070e9cdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162624
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Collect all forwarding stubs from anonymous mixin classes and insert
them in the target class if no override exists.
Change-Id: Id62f20b644ce7bbabe114d0d1648664392748a2d
Fixes: https://github.com/dart-lang/sdk/issues/43027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161760
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Avoids a compiler crash if invalid characters in the type names leak
from the CFE.
Change-Id: I3c9a9fcfd2ac6ef4f7ef5593a53d6f936653955e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162260
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
- Move expression evaluation to ddc in preparation for google3
- Added server to ddc to handle update and compileExpression requests
- Added tests
- Added 'experimental-output-compiled-kernel' option to ddc to generate
full kernel files only for compiled libraries, and store with
'.full.dill' extension
- Added AssetFileSystem to communicate to the asset server in the
debugger
- Made expression_compiler_worker work with full kernel files,
so removed invalidation of current file to improve performance
- Made expression_compiler_worker reuse already loaded imports
to avoid reading them from source in the incremental compiler
- Updated tests to work with DDC (for simulating webdev)
- Disabled tests that work with bazel kernel worker for now
as it does not generate full dill files yet
- Addressed code review comments from the prototype version:
https://dart-review.googlesource.com/c/sdk/+/157005
Details:
Currently, in flutter tools, expression evaluation is supported via
expression compilation, which is done by the incremental compiler in
the frontend server. The same incremental compiler is used for initial
application compilation, incremental code compilation for hot reload,
and any number of expression compilation requests.
In google3, the apps are typically too large to be compiled as a whole
in memory by the frontend server. Build in google3 is currently done by
blaze, as a distributed build using a task dependency graph. Build tasks
output kernel outline files as an interface between components produced
by individual tasks.
We are proposing an implementation of the expression compilation in
google3 that is taking advantage of full kernel files produced by the
build (supporting build changes to follow). This change introduces a
small server based on dev_compiler, which can handle following requests:
- update: load full kernel for given modules (done on app start)
- compileExpression: compile expression in a given library and module
(done when paused on a breakpoint)
Expression compilation uses previously loaded kernel files for the
application component and its dependencies to compile an expression.
Change-Id: Icf73868069faf3a2eb6d43ba78e459f8457e9e35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160944
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
This adds support lowering the encoding of top-level/static fields
with initializers as if they were marked as late fields. This ensures
that LateInitialization is thrown if final fields are written to during
initialization.
Closes#42956
Change-Id: I488fdddd87ebd935a0cdaf82a724e9b87d5f91ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160724
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Future CLs will hook up the static typing rules for method calls
(`clamp` and `remainder`) and will implement the rules for contexts.
Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: Iccfb1fa1ac9aff6c0832d65e4835b5b9bd51a804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
- Wait for the file writes to complete before exiting.
- Only accept the arguments that are actually used.
- Consistently read the arguments that are passed.
Change-Id: I913b8bd35135495cb5e94e4f88555997aea42e54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159181
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Fixes the case where libraries got renamed when created and
they are exported. Previously ddc was emitting broken code that
incorrectly used the original name in the export.
This bug was breaking some benchmarks at runtime.
Change-Id: Id8b27d645766db41fb5ccb5c74d8655dd4a5d4ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157000
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Fixes the JS interop tests/benchmarks that expect the global
window.self to exist when running in d8 or node.
Change-Id: Id3eed6cdffb97560d61781e11d97d63edf74232d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156782
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Some benchmarks are located in directories named with characters
that are invalid in js identifiers. To generate bootstrapping that
loads these modules import the module builder and use the same
naming method that ddc uses.
These names are directly tied to the version of ddc that produces
them. This solidifies the fact that we really can't rely on using
the ddb script to run ddc from a different commit/build.
Change-Id: I92349d70134886de63686d88f5eab9da12b4021f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156820
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This brings ddc to parity with dart2js when running benchmarks
and fixes a crash in the migrated Utf8Decode benchmarks.
In the future we might reject programs based on the signature
of the main method or introduce runtime errors but that is
still under discussion
https://github.com/dart-lang/language/issues/1120.
Change-Id: I594f60e887ce05ef7074c72cbbe379c0d526707e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156361
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
All of the backends (dart2js, DDC, VM) were checking if the invocation
name was tagged with "set:" and appending "=" to the name if so.
Instead, we can simply have the CFE perform this logic at the callsite.
Note that the name of the setter itself is still unchanged. Backends may
still need to generate the correct name themselves when handling NSMs
via code paths other than instantiateInvocation.
Change-Id: Iae42c849d3557be3e3b77c3af6f3993347ba0b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156142
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Types that are represented by primitives in JS were dropping the
nullable portion when used in `is` type tests.
Add regression test expectations for all built in dart types and
a version of the tests that can run with sound null safety.
Change-Id: I155a673ac23132eb06749d890bce272db3248b33
Fixes: https://github.com/dart-lang/sdk/issues/42851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156060
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Compiled output for sound null safety mode no longer needs to check
non-nullable arguments for null.
They can't be null since we no longer allow mixed opt-in/out libraries
when running with sound null safety.
Cleanup a repeated string in the SDK.
Change-Id: Ib7ae86f04660857957b4a7590bc5a7efd2c3fa04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154848
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Eliminated several links to content that no longer exists
Change-Id: Icd7bf5796a061882ba384e39d78d5f8ff429696d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154362
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Now that the sound null safety mode is a compile time flag
instead of a runtime flag there is no need to set the value in
the bootstrapping code before running main(). The sound and weak
versions of the sdk now have it already set.
Add compileTimeFlag() method that will inline the constant value
directly into the generated output.
Change-Id: I5b9243c47cffc421067ac820ef49342b9d0efff9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154100
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
* Setting the nonNullAsserts flag in the bootstrapping logic will
enable/disable failing when a null value is passed to a non-nullable
method parameter when running with weak null safety.
* Move the --null-assertions from VM options to the shared options in
the test and use it to set the flag in DDC the entry point.
* Configure other backends to ignore the flag.
Change-Id: Ia2670514bed7fa981564e99b85d74f6bae6dd9fc
Fixes: https://github.com/dart-lang/sdk/issues/42404
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151306
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
* Start using --sound-null-safety in ddb script To be more consistent
with the finalized naming.
Legacy mode: No flags
Weak mode: --enable-experiment=non-nullable
Sound mode: --enable-experiment=non-nullable --sound-null-safety
* Remove --kernel flag. It's been ignored since analyzer based DDC
was removed.
Change-Id: I1349f7852927e65b1574637a96f68123f1f9741a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153387
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
The blank line clobbers the output if ddb is used in non-verbose mode
to execute a program where the stdout ordinarily belongs to the program
in question whose output might be machine parsed.
Change-Id: Ie929d19deabebb7b1f3d24f99035aec2d9844a64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153208
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
Avoids an assertion failure in the front end.
Change-Id: I7994fa611f82011857750cc60af64a2c89c96bf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152923
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This is a reland of https://dart-review.googlesource.com/c/sdk/+/151163.
The reported problem is a mismatch between actual behavior and
description. The original cl tried to fix the bahavior but it broke many
external users. Given the fact that the old behavior has been widely
accepted and used, updating comments might be the correct thing to do.
This cl will update the description of toString() to be sync with its
behavior.
Bug: https://github.com/dart-lang/sdk/issues/41737
Change-Id: I899a346647c268c2dd4e582f9a9f44a3d2286720
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152060
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This is the first step to removing all of the the sdks precompiled
to JS modules from the sdk download.
Enables build_runner to produce a JS file on demand from a .dill
file bundled in the sdk download. At this time, only the SDK can
be compiled from a .dill file.
Update build targets to run bin/dartdevc.dart instead of
tool/compile_dartdevc_sdk.dart.
Will delete tool/compile_dartdevc_sdk.dart after we cleanup all
of the uses outside of the SDK.
Change-Id: Id6002675419e8e502912cb3f5b626a0d13461df5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151025
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
This reverts commit 038e981f89.
Reason for revert: Breaks some tests; visible changes to some web UIs.
Original change's description:
> Fix duration.toString() to conform the description
>
> Duration.toString() should return in a format of "HH:MM:SS.mmmmmm".
> But when `hours` is less than 10, toString() doesn't have the leading
> zero, which is "H:MM:SS.mmmmmm".
>
> The corresponding co19 issue: https://github.com/dart-lang/co19/issues/733
>
> Bug: https://github.com/dart-lang/sdk/issues/41737
> Change-Id: I2264171b2b37e89056695f7f821125a5f78d87fb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151163
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
TBR=lrn@google.com,zichangguo@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: https://github.com/dart-lang/sdk/issues/41737
Change-Id: I4d7ef5de9807e8e2b2a77c2171d1693b7527f671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151848
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
- created class representing module metadata, added metadata to JsCode
class
- added module information to metadata, such as module name, load
function name
- added import and file uris for libraries
- added experimental-emit-debug-metadata flag to frontend_server
- added frontend server tests to check for saved metadata
Related: https://github.com/dart-lang/sdk/issues/41852
Closes: https://github.com/dart-lang/sdk/issues/40774
Change-Id: Iecbbf1e4eea1919e01f002f45363d30707cb1590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150181
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Move the nnbd core libraries from sdk_nnbd to sdk, and updates
references in build files and elsewhere accordingly.
Change-Id: I09760fe1e006657aacdfe80f3b22fdf6f7e30a9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151121
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This CL adds a Node.toText method together with an AstPrinter. These
facility and better toString implementation on AST nodes while allowing
for toString independent printing of AST to use in testing. This also
add support for an integrated toString of custom/internal nodes.
Some work is still needed in bringing the toString implementation on
all nodes to the old quality, and not all internal nodes have
customized textual representations yet. This work is left for future
CLs.
Change-Id: Ib0bf8a0bc02f489dfacdc8aa5f96da9c52f26058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150923
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
* Adjust `exit()` documentation to mention `finally` and to further
emphasize that calling `exit()` does not pass Go and does not
collect $200.
* Adjust `DateTime.difference` documentation to clarify the sign of
the returned `Duration`. Fixes https://github.com/dart-lang/sdk/issues/36347.
* Adjust `String.lastIndexOf` documentation to clarify what is
returned. Fixes https://github.com/dart-lang/sdk/issues/41893.
Change-Id: I6ed91e8c79a647928ced7e8f0268a62ed92fbd4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149494
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
Attempt at fixing https://github.com/dart-lang/sdk/issues/39740 to allow the flutter web engine to use @JS
interop to avoid the overhead of the SDK available js interop.
Bug: 39740
Change-Id: I7ba9c8981e639cd267bee3086ba900b89bfc0d6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150501
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Harry Terkelsen <het@google.com>
There should be no way this could cause an unexpected failure
or break soundness but there is no reason to be marking the type
parameter as a legacy type in the check.
Change-Id: Ib4cf22cacd78d6cb9b55dd6ed594c75aa81ceead
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149887
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
When running ddb with `--debug` pull the SDK .dill and .js files from
ReleaseX64/gen/utils/dartdevc and require.js from third_party/require.
Change-Id: Ibcfd5e1d32c39cca3583cfef14fe8393e0846d69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149886
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This CL embeds the sdk_nnbd/lib/_internal/allowed_experiments.json
into the CFE and uses this to allow experiments enabled on a
per library basis. The file is embedded through generated code to
avoid reliance on access to the file itself.
A presubmit check is also added to ensure that the json file and
the generated code are in sync.
This work is in preparation for https://github.com/dart-lang/sdk/issues/41538
Change-Id: Ic03c0fc69684d124c685f2fe6e80423a7e751530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149064
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
https://dart-review.googlesource.com/c/sdk/+/149080 is required to
get errors if you try use weak .dill files when passing the
--sound-null-safety flag.
Added a new build target to copy the sound SDK outline .dill to
dart-sdk/lib/_internal. This is only part of dartdevc_test right
now. We will decide in the future if we are going to include this
in the released SDK or if we will have the build systems create
them as needed. For now in testing scenarios it appears to be part
of the SDK.
Change-Id: I3b31a894841f59b437658104e7ee9443ee67db93
Fixes: https://github.com/dart-lang/sdk/issues/41694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146962
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Apply the same naming used in the ddc module format to amd modules.
Change-Id: Ib766c20cb35c3c6e11a345e45cba5c49f3a34b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
During expression compilation, if the compiled expression is using
a type that was not used in the current function, the incremental
compiler and DDC produce code that refers to undefined types.
To fix that, discharge types created during expression compilation
and add their definitions at the beginning of the generated
function.
Added tests to validate the behavior.
Fixes: https://github.com/dart-lang/sdk/issues/41443
Change-Id: If3fdce85a50ab2590d107f3b9e8c19b4768fd482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148468
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Default setting will hide the warnings.
Allow infra to decide if warnings in the browser console will be
shown for null safety errors in weak mode.
Always show warnings when running with weak null safety with our
ddb script and the SDK test_runner.
Change-Id: I7c800b087069390ff374cbc4111334c2df947d86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148238
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
These are used to provide a testable textual representation
of types and constants that do not rely upon Node.toString.
Change-Id: Iff77ebb44e8299b262f4f263666b2e1d4dd5794b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147909
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
For some types it makes sense to distinguish between nullability as a
property of including null and the declared nullability, such as for
type-parameter types and FutureOr types. This CL introduces the
separation between the two concepts. The plan is to use that when
implementing FutureOrType.
Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: I90b45bea768e89c213d021d360a481d38377c682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147903
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
That platform out directory isn't use now that we have unforked.
Change-Id: I8baba2ab25ae4f0d38b2b58ab06d52b90288d280
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148009
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Currently hidden behind a flag marked experimental. We need to
define a clear API or process to introduce breaking changes before
we start landing dependencies in packages outside the SDK.
Change-Id: I27ed48c78fc3bad46be92c21c35ae91f4c036784
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144243
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
- Flips the flag from --nnbd to --no-nnbd so that by default it builds
the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
directory which has the 'Legacy' suffix added to it
(e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
in during execution so that CFE runs in that mode. This is different
from the 'null_safety' flag
Change-Id: I729630a7bd36ea7ae38134f9285b44e93c283c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138902
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Make the NNBD sdk libraries compatible with the change making the
default type of the error variable in a catch clause Object.
Change-Id: Ic0419980b067fdb1702c0ac9ca2cbc73b27d41b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146521
Auto-Submit: Leaf Petersen <leafp@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
D8 breakpoints used in sourcemap testing should only be set for
test files and not, accidentally, in sdk source files. This
was hit in a dart2js step debugging test where, after unforking,
the line number in the test file accidentally matched those of
print.dart from the sdk.
Change-Id: I6a9c6f5bfd28b8821e9cee9b10cc6c67e4fc689b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146781
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
- Expose the internal runtime flag for the Null Safety mode.
- Add a guard to protect against accidental configurations
that set the mode multiple times.
Change-Id: I8d16a3c7bd8590ea6f2fee9b6f8c09009898a64b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144991
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This reverts commit cab69e7706.
Reason for revert: It was a temporary submit
Original change's description:
> [BUILD] - Initial CL to unfork the NNBD Dart SDK
> NOTE: This is a trial submit and will be reverted immediately.
>
> - Flips the flag from --nnbd to --no-nnbd so that by default it builds
> the NNBD version
> - using the --no-nnbd flag results in the SDK being built in a
> directory which has the 'Legacy' suffix added to it
> (e.g: out/DebugX64Legacy)
> - the '--enable-experiment=non-nullable' flag still needs to be passed
> in during execution so that CFE runs in that mode. This is different
> from the 'null_safety' flag
>
> Change-Id: I7d25d9710818af5919c0bb83abe51153172f5886
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144880
> Reviewed-by: Siva Annamalai <asiva@google.com>
TBR=asiva@google.com
Change-Id: Ib0f99fc1a42c9c7a8b21f8542f4a35dba9105d5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144900
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
NOTE: This is a trial submit and will be reverted immediately.
- Flips the flag from --nnbd to --no-nnbd so that by default it builds
the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
directory which has the 'Legacy' suffix added to it
(e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
in during execution so that CFE runs in that mode. This is different
from the 'null_safety' flag
Change-Id: I7d25d9710818af5919c0bb83abe51153172f5886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144880
Reviewed-by: Siva Annamalai <asiva@google.com>
This copies the logic from dart2js and brings the two patches closer
together. There is no need to pass the error handler to the helper
function shared between `parse()` and `tryParse()`.
Update JS foreign function types in parseDouble to match the NNBD
version.
Fixes: https://github.com/dart-lang/sdk/issues/41613
Change-Id: I85d39f8ba6bd76459cf6263099983b8b96d3a669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144304
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This reverts commit 393468dc89.
Reason for revert: This was a trial submit and so reverting it.
Original change's description:
> This is a trial submit of the unfork CL, it will be reverted immediately.
> This commit is being done so we can roll it into Flutter and run some device lab testing to see the effect this CL will have on Flutter.
>
> [BUILD] - Initial CL to unfork the NNBD Dart SDK
>
> - Flips the flag from --nnbd to --no-nnbd so that by default it builds
> the NNBD version
> - using the --no-nnbd flag results in the SDK being built in a
> directory which has the 'Legacy' suffix added to it
> (e.g: out/DebugX64Legacy)
> - the '--enable-experiment=non-nullable' flag still needs to be passed
> in during execution so that CFE runs in that mode. This is different
> from the 'null_safety' flag
>
> Change-Id: I83c813aee2a5b61ad876d8a7b0988705bb24c839
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144082
> Reviewed-by: Siva Annamalai <asiva@google.com>
TBR=asiva@google.com,liama@google.com
Change-Id: I7b50fae71764eceb17893338d1981e40ea2de520
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144083
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is being done so we can roll it into Flutter and run some device lab testing to see the effect this CL will have on Flutter.
[BUILD] - Initial CL to unfork the NNBD Dart SDK
- Flips the flag from --nnbd to --no-nnbd so that by default it builds
the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
directory which has the 'Legacy' suffix added to it
(e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
in during execution so that CFE runs in that mode. This is different
from the 'null_safety' flag
Change-Id: I83c813aee2a5b61ad876d8a7b0988705bb24c839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144082
Reviewed-by: Siva Annamalai <asiva@google.com>
For the cases of implicit bounds like `<T>` the default value
should be `dynamic` when instantiating and no type parameter is
provided. This change fixes this cases.
For explicit bounds like `<T extends Object?>` or
`<T extends Object*>` the default values should be `Object?` or
`Object*`. This change breaks these cases by defaulting to
`dynamic`.
Filed: https://github.com/dart-lang/sdk/issues/41539
I believe this is the correct trade off right now because the
implicit bounds like `<T>` are more likely to appear compared to
`<T extends Object?>` or `<T extends Object*>`.
Fixes: https://github.com/dart-lang/sdk/issues/41301
Change-Id: I53a22cf9de2d200f628f3ac0f6b0a6b1ab9ba3fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
As a possible performance improvement types are hoisted to top
level variables where they can be used from anywhere in
the program.
Change-Id: I93cee0b6e582e9218dae5b15b2b8816e7c64153b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142905
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Treats the SDK and all application code as a legacy library when
running without enabling the null safety experiment.
- Copy all changes from the SDK fork and applies them to the existing
SDK (except the null safety syntax used in the library itself.
- Start emitting legacy types.
- Add a work around to avoid ever creating legacy or nullable versions
of types in the dart:_runtime library or in JS contexts. This should
be safely removed once the SDK is opted in to null safety.
Fixes: #40266
Change-Id: I6a029b676c3e35980a6bab876a348c35590df92d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142904
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Preparation to unfork the SDK.
- Added the test suite to run in weak mode. Need to assess how we
want to migrate these tests in the future.
- Updated one test to be legacy/nnbd agnostic.
- Update step names from DDK to DDC.
Change-Id: I0d2f1218c9acad82ab70dd525b0a0ad3cdc2ca92
Issue: https://github.com/dart-lang/sdk/issues/40266
Change-Id: If92e7778984de6a5a049faaf421a069c6f492b36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142557
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Also add `legacyTypeRep<T>()` that is similar but performs
a shallow conversion to a legacy type.
Using this in compiler/dartdevc_native/ tests gives a better usability
instead of constantly wrapping and unwrapping types. It allows us to
avoid stripping off the legacy from a type when calling `wrapType()`.
Issue: https://github.com/dart-lang/sdk/issues/40266
Change-Id: I07225f18c253222b31203b0b110233a3e018a7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142547
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This allows us to start experimenting with the legacy module format in flutter web/internal.
This also updates the DDC module name parsing to throw an ArgumentError on invalid formats, and exposes the parsing method.
Change-Id: I4ce85ecd4078a9827aba046e34425a4f1d1e9abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142263
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
The comment references a feature we don't plan to add because dartdevc
is not planned as a production compiler. The linked SDK issue is
unrelated.
Change-Id: I67d5946b7afe562e12fcdb2b45599afb648499b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141205
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This is only changing the names that appear in the JS source and
should not change the runtime semantics. Prepends "_N_" and "_L_"
to nullable and legacy type names.
Function types get their markers prepended to the word "To". For
example a type `int Function(String)` in a legacy library would
have a name in JS like "_L_String_L_To_L_int".
Change-Id: I26416e2c7396806f0ff9b3d36cd915f49d48d1cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140366
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This reverts commit a0e4f0575a.
Reason for revert: Issues with hot restart in google3, see b/152181536.
Original change's description:
> Revert "Revert "[dartdevc] record metrics""
>
> Reland with fixes for internal build (patch set 2+)
>
> Change-Id: I5b130d020c9437a2c52dd074ad007e1fef7a8fa5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139241
> Commit-Queue: Vijay Menon <vsm@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>
TBR=vsm@google.com,sigmund@google.com,grouma@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I012e1adaa405e85fd1a3d7d280b889b7df44e5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140580
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
This is a bare-bones implementation (and test) for having an explicit
toString on all `Node`s.
This can then be extended as-needed to better suit our debugging
purposes. It's not allowed to leak, though.
Change-Id: I8d3f5a9cd13b292ed7a6bf33762e507286f3fa7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139805
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Remove all `_check()` calls as they are now identical to `as()`.
Fixes: #41008
Change-Id: I4e4dd1ff50840d3d1cbf0aae9b8cef0621016079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139490
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This is a breaking change. https://github.com/dart-lang/sdk/issues/40709
This change makes the HeaderValue parsing more strict in two invalid
edge cases, supports parameters with null values as a feature, and fixes
toString() so it always produces tokens or quoted-strings valid per RFC
7230 3.2.6.
The empty parameter value without double quotes (which is not allowed by
the standards) is now parsed as the empty string rather than null. E.g.
HeaderValue.parse("v;a=").parameters now gives {"a": ""} rather than
{"a": null}.
Invalid inputs with unbalanced double quotes are now rejected. E.g.
HeaderValue.parse('v;a="b').parameters will now throw a HttpException
instead of giving {"a": "b"}.
The HeaderValue.toString() method now supports parameters with null
values by omitting the value. E.g.:
HeaderValue("v", {"a": null, "b": "c"}).toString()
now gives
v; a; b=c
This behavior can be used to implement some features in the Accept and
Sec-WebSocket-Extensions headers.
Likewise the empty value and values using characters outside of RFC 7230
3.2.6 tokens are now correctly implemented by double quoting such values
with escape sequences. E.g.:
HeaderValue("v",
{"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString()
now gives
v;a=A;b="(B)";c="";d="ø";e="\\\""
The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports one of
these semantic changes to the unmigrated SDK so any issues can be
discovered now instead of blocking the future SDK unfork.
Change-Id: Iafc790e03b6290232cac71fe14f995ce0f0b036b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136620
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
FutureOr<Object> --> Object
FutureOr<Object>? --> Object?
I don't believe this to be breaking because in the current SDK
nullable types do not yet exist, and we already landed the change
to normalize FutureOr of a top type. Right now Object is still
considered a top type.
Issue: #40611
Change-Id: I83cb06db9e4bca8cb9b2c041a044904eb1080d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139031
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Unlike non-nullable types, the purpose of the annotation in
our runtime is to ensure we don't generate extra checks. This
should remove a few nullFailed calls in the generated sdk.
Change-Id: I7b8ac012a6cfa5f8baf2667d89185e7540320ec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138783
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This is (intended to be) a small step towards removing the batch compiler.
Change-Id: I201c56b6d33420f91d2f4b989682670cd8d6a387
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138508
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Use a JavaScript Symbol() for Array rti property. This makes the
property non-enumerable, avoiding making the property visible via
JS-interop.
The code is feature-tested so that IE11 still works with an enumerable
String property.
Bug: 40535
Change-Id: Ic8b64dac5751989fe4b8d023b0626c3db04676c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137245
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This flag is unused and the behavior it enables was only useful along with
`dart:mirrors`.
- Remove the flag and the field on the options object.
- Prune code branches that are no longer reachable.
- Remove or inline some functions that became either empty or trivially small.
- Remove the manual check for a `dart:mirrors` import since this is handled by
the CFE now.
- Remove references to the flag in tests.
- Remove test files which only existed to enable the flag for other tests.
Change-Id: I21bf594271fb4eeb5b73fcbf07da736e9e8d1f33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138018
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Because we cache on instances of type objects, all "type"-ish constructs in DDC must be pre-initialized if we want to avoid any hasOwnProperty checks (which are slow).
1) We now consult legacy/nullable caches earlier when wrapping types, as the downstream logic can be much slower than a lookup.
2) We cache on nullble and legacy wrappers themselves as well as just the underlying object (formerly we cached on just the latter) for faster lookups.
3) We attach local caches upfront, maintaining monomorphicity during hot code paths.
This improves regressions for opt-out worst-case tests from (120 us -> 2100 us) to (120 us -> 500 us) and weak mode tests from (120 us -> 1100 us) to (120 us -> 330 us).
Change-Id: I98a26064404e746162ca3feb22b0993c3b39e63c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138330
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
The two fields are already treated the same, so having two is just
confusing.
Change-Id: I649db2a77bced62429dfd94ab300673cf886e367
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138291
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
These changes are also being back ported into the existing SDK
with minimal differences that will be gone when we unfork the
dart:_runtime library. In the current back port:
* FutureOr<Null>? is normalized to Future<Null>* instead of
Future<Null>?.
* There is no runtime normalization of FutureOr<T?>?. This
should have no effect since nullable types can not yet
appear.
Fixes: #40611, #40720
Change-Id: Ib3ddffbf3778f0f571cf95f58b6142d3ee0bf59b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136160
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
New analyzer errors are reported for dart:html around nullability.
Non-nullable fields are translated to native getters and setters if part
of a concrete class and normal getters and setters if abstract.
Change-Id: I2fd87803a08872b2a7eae4de0af704f184997c7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137481
Reviewed-by: Stephen Adams <sra@google.com>
If hashcode is null it gets set on line 128 to dart.hashcode which
is a top level method in the dart:_runtime library.
Change-Id: Ib26a70dc84305dfa11eb15206abd36f003adcd9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137401
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
These should go through the `cast` operation to fail in strong and pass with warning in weak.
Change-Id: I1863b507835c0c9993357318b9e7038154e47151
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136902
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
The diagnostic applies to both the if-null expression ('??') and the
compound assignment expression ('??='), so it seems like the name should
be more general.
Change-Id: I004cc2924ef97fcbd2168f070380ff17152cbb0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136903
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
These fixes also prepare for an upcoming change to normalize FutureOr
types.
- Cache and emit the hoisted function type at the top level without
nullability wrappers.
- Always emit nullability wrappers at the use site.
- Fix issue where sometimes the return type would be double wrapped.
Change-Id: If4a0c94e62eca626f271cc3c259c813911075d9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136404
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
They now become a `Object*` or `Object?` if the library where the method
is defined is legacy or null safe.
Change-Id: Ia3de0d728187b9c5bf64cc8c08aa075e63aff942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136723
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
It has always been ignored by kernel based DDC. No longer needed now
that analyzer based DDC has been deleted.
Change-Id: I50f010b79c22a41ee9a1b8c1e149f50f705a42fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130124
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This fixes the issue of nullability wrappers showing up around the settee of 'setBaseClass'.
Change-Id: I73207fafe33a039567052ae2c5c8c1a84d7505df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136724
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This means that TypeError no longer inherits a spurious `message` member.
The message of a platform-thrown TypeError is still available as `toString()`.
Fixes#40317
Bug: http://dartbug.com/40317
Change-Id: I77312859ebae3f92c2e56aeea6283b075b71c8d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136129
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
CSSStyleDeclaration.getPropertyValue returns a non-nullable string.
It will also return an empty string if the property is not found. Since
getPropertyValue returns the value of the native getPropertyValue, the
null check should be removed.
Change-Id: I9846553d3f9fcd68cbd15b9c39d2104cab594b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136413
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Several method bodies did not return a value conditionally or at all.
Change-Id: I01ca87e2e0501597bacb49bcddd10668b59026b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135626
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Current semantics with respect to evaluation order is retained.
Change-Id: I6794c8a720237536696afab2fe056042f8464ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129702
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501
HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.
This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.
The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.
Bug: https://github.com/dart-lang/sdk/issues/33501
Change-Id: Ieb9f4061b27ed3bbc6d82e6a408c77d11abb037b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135357
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Fix instance checks for types that are internal to the type system.
Fixes: #40610
Change-Id: I0c6c1bb4d64f25a97c53bd64a3940cf3e9f45c88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135580
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
So, it is reported even when hints are disabled.
Change-Id: Id2df8faa5421fac00e01755a70aedf3d3f570f10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135492
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Note: This is mostly just the DDC developer patch file.
Change-Id: I98277304b2fbe8fa939dc7e6fb4bd9e0c199b2b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135535
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>