This ensures that the helpers are seen as being part of the main unit
for deferred-load compiles.
Prior to this change, debug dart2js would assert:
$ sdk/bin/dart2js_developer --test-mode --packages=.packages benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --out=om1c/o.js
org-dartlang-sdk:///lib/_internal/js_runtime/lib/late_helper.dart@343+1:
Internal Error: The compiler crashed when compiling this element.
The compiler is broken.
When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.
The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.
Please include the following information:
* the name and version of your operating system,
* the Dart SDK build number (build number could not be determined), and
* the entire message you see here (including the full stack trace
below as well as the source location above).
The compiler crashed: 'package:compiler/src/deferred_load/output_unit.dart': Failed assertion: line 272 pos 12: 'unit != null': No output unit for member j:method(throwLateFieldNI)
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 OutputUnitData.outputUnitForMember (package:compiler/src/deferred_load/output_unit.dart:272:12)
#3 OutputUnitData.hasOnlyNonDeferredImportPaths (package:compiler/src/deferred_load/output_unit.dart:306:33)
#4 KernelSsaGraphBuilder._tryInlineMethod.heuristicSayGoodToGo (package:compiler/src/ssa/builder_kernel.dart:5922:12)
Change-Id: Ic31c4894105a9a22eb0821a489c8dd2a4e3d0110
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241686
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Previously, the analyzer didn't actually fix the type parameters; it
simply stopped accumulating type constraints for them, and then
re-inferred them in later rounds of inference. In theory this doesn't
actually fix the type parameters, since a type parameter can have an
"extends" constraint that causes it to depend on other type
parameters; if those type parameters change in later rounds of
inference, then the re-inferred type parameter might actually wind up
changing. In practice I haven't been able to construct a
(non-erroneous) case where this actually occurs, but to make the code
easier to reason about, I think it's better to actually fix the type
parameters when we say we do.
This change makes the analyzer's type inference logic more similar to
the front end's type inference logic.
Change-Id: Ia1f86a27eaca98520903a2aba9d0359afd59e36f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Helps readability and ease of debugging for dump info.
Note: IDs only shadow each other for Class and ClassType info objects,
but these are already disambiguated with a serializedId that prepends
the info type to the ID.
Change-Id: Ie9862d474436cba85a972f567f606c1e3190b929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240917
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Even if the main program disables executable stacks, dlopen'ing a library that doesn't itself disable executable stack will switch the stack to executable. (Presumably in the name of compatability with GNU nested functions.)
Dart does not need executable stacks, and executable stacks are an additional attack surface.
TEST=readelf
Bug: b/229648756
Change-Id: Ia8c234ebc6178a26528d37b1359a10dd42039a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241540
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
The "Proposed Edits" panel displays the number of edits, but only when
this number not immediately displayed below and would need to be
calculated.
Change-Id: I89793305876d5488c9d14b03a91470ae3f4fe4f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241340
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Previously, the front end would perform downwards and upwards
inference using separate TypeConstraintGatherer objects. This meant
that any constraint gathering work performed during downwards
inference had to be repeated during upwards inference.
This change avoids the extra work by using a single
TypeConstraintGatherer object for both downwards and upwards
inference.
This should help pave the way to implementing support for
https://github.com/dart-lang/language/issues/731 (improved inference
for fold etc.)
Change-Id: Ib4031ab1397d6a8547a705f386632de0e4dd1a2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Since tests of our internal tools often deliberately contain edge cases
and unusual code constructs, scrape supports ignoring Dart files in
those directories in order to focus on more representative code.
This updates that ignore list to handle all of the various
compiler-related packages I could find.
Change-Id: I4006d2b3b14a81572f27db0b65e6c6194c4f7f54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241506
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
The rich hierarchy of operators is no longer relevant since parsing
was moved to the common front-end.
All that remains is a Set of operator names that can be used to
declare instance methods.
This set is used for picking the 'operator' variety of Selector. I'm not
sure we even need operator selectors, but I am leaving that for future
consideration.
Change-Id: I7337c0cf82a3cb8f7ebf5fa17a737bac3a83f48b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241560
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Only the 'fileUri' property was used, so we pass it directly instead.
Change-Id: I7b47f18f7ebc2c50036c5202e469caad4ba35897
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241009
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Remove LibraryBuilder.addBuilder to let the implementations in
SourceLibraryBuilder and DillLibraryBuilder to change independently.
Offset argument removed from DillLibraryBuilder.addMember and
'addX' members are in DillLibraryBuilder are made private.
Change-Id: If239ae441655d3d7f7484fd5e809cc015effd78c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241005
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
`.clamp` is a special cased ternary operator and handled differently
from other calls.
In particular something as simple as `var x = 1.clamp(2, 3);` would
crash the compiler.
Fixes https://github.com/dart-lang/sdk/issues/48812
Change-Id: Icf65847ef3f4b41e60ed77fdc73440231d7c1e37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This changes two parts about handling of nullability in libraries:
1) Instead of using Nullability.nullable for explicit nullability in
legacy libraries, which is an error case, we use Nullability.legacy
so that legacy libraries only contain legacy nullabilities.
2) Avoid performing legacy erasure on parameter types. This change
explicit `Never` from "Null" to the correct "Never*".
Change-Id: Iba2fa8244c8820375056d106f30d6de8054f2681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240921
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Having first-class Wasm function references makes it possible to call
JS function objects directly from Dart, and to call some Dart functions
(static functions with no optional parameters and no type parameters)
from JS as function objects.
Change-Id: I1c788338d418c8857493ec76560d74fdd17d5dd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241001
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Adjust TimelineEvent::PrintJSON to use JSONWriter for compatibility with PRODUCT mode.
TEST=ci
Change-Id: I694889c655719371364012b4324b7947d7b2d5e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240911
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
LLVM seems to prefer generating __unwind_info instead of __eh_frame
on certain targets. Unfortunately the way we use CFI directives
in assembly snapshots results in incomplete __unwind_info:
only the first function in the instruction snapshot gets unwinding
information recorded properly.
To fix this we change assembly writer to emit CFI directives
inside each individual function.
TEST=manually via `objdump -u`
Fixes https://github.com/flutter/flutter/issues/101708
Change-Id: I027bfe6483dcd7f7e39ab23154abfe12ebc478da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241282
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>