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>
The CL allows type substitution to run over types with implementations
of DartType unknown to it. Such types will be left unchanged in the
substituted type.
Closes#41199.
Bug: https://github.com/dart-lang/sdk/issues/41199
Change-Id: I335056ff02576d621a815dbd14fad3b3ffab017e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144361
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This makes the string (de)serialization independent of the core library
UTF-8 encoder/decoder so we can change that without affecting kernel
serialization.
It also speeds up serialization and deserialization by a few percent.
Change-Id: I347e471ed0174cc5cb191335dd7c47e6eb3dad59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140293
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
The CL reduces the number of false positive cases in the round-trip
serialization unit testing by refining the verifier analysis. Not it
doesn't attempt to make the round trip over the sub-trees containing
free variables.
Change-Id: Ib6fb2e72f7543ea7d99c5273c337801f3ad1bec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144285
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
There is no need to make each isolate have it's own PC -> RawCode lookup
table, now that we share the program structure.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: Iba2bbf7e735655b52c07a61c399c6d2409598145
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144297
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Ensure that a generator entry point only passes type arguments for
parameters that are not erased.
The generator header was passing too many arguments to the generator
body, causing the element type to be misaligned.
Change-Id: I062df5f7172ed8bb410c81013a3faee35d66ef1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144351
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
While I was referencing the dart2js implementation to fix a bug in DDC I
noticed an unused local variable here.
Change-Id: I4e6dfd961cbc54ee346f1796eb1b5184d3c01ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144347
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
All these tests now pass in both weak and strong mode, except for
relation_subclass_test and typedef_reflected_type_test. For those 2
tests I fixed the compile time error and now they have the same runtime
errors in both weak and strong mode (they were already failing at
runtime in weak mode).
Change-Id: If0157f811fffcf72a12ce6690ac0568c8f4419a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144343
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
When using C++ value types to represent tagged pointers, we cannot use forward declarations for tagged pointers. This helps to break include cycles when attempting to keep IsXYZ predicates as tagged pointer member functions.
class_id.h also seems like a more natural place for these predicates, which were written before there was a class_id.h.
Change-Id: I0677560a794ed084d10f844606e202feb0c3820a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144321
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This allows the program to get at the singleton component context
for the currently running component. The component context can
be meaningfully instantiated only once; and since dart doesn't
have a predefined way to wire platform-specific values into
platform-specific code, we instantiate a singleton here, so all
code that is interested can use it.
The users of this functionality will be the dart and flutter
fuchsia runners. See issue
https://github.com/dart-lang/sdk/issues/41523 for details.
Tested:
manual compile for fuchsia, check behavior.
Change-Id: Ib4e15af376ecb932c2d2b28d6f099383d53ccc84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136524
Commit-Queue: Filip Filmar <fmil@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Change-Id: Ibdd201b595b8835015a1a17417ee1d6e76030676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144140
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
* Add tentative release date.
* Fix some bad characters.
* Move changes that didn't make the cut to 2.9.0.
Change-Id: I13d7ffa45ec96057d7b3d08b4437662d48d4d732
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144288
Reviewed-by: William Hesse <whesse@google.com>
When an isolate dies it has to close all it's open ports. Right now this
is done by walking all ports in the system.
=> O(#num-isolates x #num-ports) complexity
Instead we let each isolate remember it's own open ports: When the
isolate dies we iterate over those ports that particular isolate has
open and close them.
=> O(#num-isolates + #num-ports) complexity
On a many-isolate test of the form:
foo(int n) {
if (n == 1) return 1;
return foo(n-1) + 1;
}
for `foo(50k)` this reduces the runtime from 90 seconds to 30 seconds.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: I3ac68c5334a1d5e8cac47e89e15cbb50c26b65ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144261
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
For some reason constexpr seems to need a definition, because the linker
complains about not being able to find the symbol:
% tools/gn.py -ax64 -mdebug -d0
% tools/build.py -ax64 -mdebug
...
ld.lld: error: undefined symbol: dart::FlowGraphBuilderHelper::kPhiSelfReference
>>> referenced by constant_propagator_test.cc:53 (../../runtime/vm/compiler/backend/constant_propagator_test.cc:53)
...
We may also want to consider passing `-fmerge-all-constants` explicitly
in the future - though it is not standards compliant.
See also http://crbug.com/829795.
Change-Id: I1cc125a01751c8a83092b033e80afdcc591c7b92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144287
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This CL extracts the hashset implementation from PortMap into
it's own (template) class into port_set.h:PortSet.
This splits the functionality (a nice cleanup in itself) and will
make it re-usable (via template) for a follow-up CL which makes
each message handler aware of it's own open ports.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: I4a56c997414672a4efc9330077110ac5f54d03d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144260
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
When a mutator get's de-scheduled, it should not hold on to it's TLAB
during the time there is nothing to do to ensure other threads which
are scheduled and ready can use it.
When having many isolates this can improve the performance by 10x+.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: I994b584102a9777b8e57dc7b0942588344c34675
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143817
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Define a "Version" class in kernel that allows easy comparison between
versions (e.g. a < b, a >= b etc).
Use this Version class in CFE.
Change-Id: I2f382e7bb3c2083258743b9b66a909a88d575dbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144283
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
As part of adding support for brew installations, a bug was introduced
which resulted in the executable directory path not being resolved
correctly if the process was launched via a symlink. This resulted in
the script path passed to the CFE not being fully qualified relative to
the executable location which would cause lookup failures for relative
script paths.
Fixes https://github.com/dart-lang/sdk/issues/41329
Change-Id: I31813ccbc024eb0e4dd6dc265986ba3aefd9898e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144005
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Async transformation sometimes inserts additional unsafeCast calls in
order to make sure kernel AST is typed.
We can recognize these calls in TFA and handle them more accurately,
maintaining type flow through these native (and otherwise opaque) calls.
Change-Id: I3e316507e0a37f36dcf8a9621dbd7b342ce5f19d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138661
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Previously, all parameters returned by
MigrationResolutionHooksImpl.getExecutableParameters were synthetic
ones that came from translating the executable element's decorated
function type to its final post-migration type. Synthetic parameters
can't be field formal parameters, so this meant that when the
FixBuilder was re-resolving a constructor containing field formal
parameters, references to the field in the constructor body would get
incorrectly interpreted as pointing to the parameter rather than the
field, and that would cause them to be subject to promotion.
The fix is to only return synthetic parameters from
MigrationResolutionHooksImpl.getExecutableParameters when the
executable in question is in a library *not* being migrated. When
it's in a library that *is* being migrated, we can just return all of
the executable's parameters without translating them, because we know
that the parameters themselves have been visited by the NodeBuilder
and EdgeBuilder, hence they all have thier own associated decorated
types.
Fixes#41405.
Change-Id: I5e3c411dc92fe242a959a5670b9253fbccea2b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144122
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Consider the following code:
int f(int i) => i == null ? null : i + 1;
Previously, migration would mark the return type of `f` as nullable
even if `i` was non-nullable. This happened because the edge
connecting the explicit `null` (in the "then branch" of the
conditional) to the return type of `f` is created after visiting the
conditional expression, so the condition guards are no longer in
scope.
With this CL, we create an extra graph node when needed to ensure that
the guard is applied to the expression type.
Change-Id: Ie00eea0b431905241612c6661d69bdb55c0910d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144121
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This change adds the ability to detect when one branch of a
conditional expression is weak-only due to nullability. For example,
in the following code:
int f(int/*!*/ i) => i == null ? g(null) : i;
int g(int j) => ...;
the call to `g` can only happen in weak checking mode. The migrator
also now understands that j only needs to be nullable if i is
nullable.
Fixes#41555.
Partially addresses #41551.
Bug: https://github.com/dart-lang/sdk/issues/41555
Change-Id: I02c9c3072f0104db0f1a5b432fb1f2f8f06d5282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144120
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>