OLD | NEW |
(Empty) | |
| 1 # The dart2js compiler |
| 2 |
| 3 Welcome to the sources of the dart2js compiler! |
| 4 |
| 5 ## Architecture |
| 6 |
| 7 The compiler is currently undergoing a long refactoring process. As you navigate |
| 8 this code you may find it helpful to understand how the compiler used to be, |
| 9 where it is going, and where it is today. |
| 10 |
| 11 ### The near future architecture |
| 12 |
| 13 The compiler will operate in these general phases: |
| 14 |
| 15 1. **load kernel**: Load all the code as kernel |
| 16 * Collect dart sources transtively |
| 17 * Convert to kernel AST |
| 18 (this is will handled by invoking the front-end package) |
| 19 |
| 20 Alternatively, the compiler can start compilation directly from a kernel |
| 21 file(s). |
| 22 |
| 23 2. **model**: Create a Dart model of the program |
| 24 * The kernel ASTs could be used as a model, so this might be a no-op or just |
| 25 creating a thin wrapper on top of kernel. |
| 26 |
| 27 3. **tree-shake and create world**: Build world of reachable code |
| 28 * For each reachable piece of code: |
| 29 * Compute impact (i1) from kernel AST |
| 30 * Build a closed world (w1) |
| 31 |
| 32 4. **analyze**: Run a global analysis |
| 33 * Assume closed world semantics (from w1) |
| 34 * Produce a global result (g) |
| 35 * Like today (g) will contain type and nullability information |
| 36 * After we adopt strong-mode types, we want to explore simplifying this |
| 37 to only contain native + nullability information. |
| 38 |
| 39 5. **codegen model**: Create a JS model of the program |
| 40 * Model JavaScript specific concepts (like the split of constructor bodies |
| 41 as separate elements) and provide a mapping to the Dart model |
| 42 |
| 43 6. **codegen and tree-shake**: Generate code, as needed |
| 44 * For each reachable piece of code: |
| 45 * build ssa graph from kernel ASTs and global results (g) |
| 46 * optimize ssa |
| 47 * compute impact (i2) from optimized code |
| 48 * emit JS ASTs for the code |
| 49 * Build a codegen closed world (w2) from new impacts (i2) |
| 50 |
| 51 7. **emit**: Assemble and minify the program |
| 52 * Build program structure from the compiled pieces (w2) |
| 53 * Use frequency namer to minify names. |
| 54 * Emit js and source map files. |
| 55 |
| 56 ### The old architecture |
| 57 |
| 58 The compiler used to operate as follows: |
| 59 |
| 60 1. **load dart**: Load all source files |
| 61 * Collect dart sources transtively |
| 62 * Scan enough tokens to build import dependencies. |
| 63 |
| 64 2. **model**: Create a Dart model (aka. Element Model) of the program |
| 65 * Do a diet-parse of the program to create the high-level element model |
| 66 |
| 67 3. **resolve and tree-shake**: Resolve and build world of reachable code (the |
| 68 resolution enqueuer) |
| 69 * For each reachable piece of code: |
| 70 * Parse the full body of the function |
| 71 * Resolve it and enqueue other pieces that are reachable |
| 72 * Type check the body of the function |
| 73 |
| 74 5. **analyze**: Run a global analysis |
| 75 * Assume closed world semantics (from everything enqueued by the resolver) |
| 76 * Produce a global result about type and nullability information of method |
| 77 arguments, return values, and receivers of dynamic sends. |
| 78 |
| 79 6. **codegen and tree-shake**: Generate code, as needed (via the codegen |
| 80 enqueuer) |
| 81 * For each reachable piece of code: |
| 82 * build ssa graph from resolved source ASTs global results (g) |
| 83 * optimize ssa |
| 84 * enqueue visible dependencies |
| 85 * emit js asts for the code |
| 86 |
| 87 7. **emit**: Assemble and minify the program |
| 88 * Build program structure from the compiled pieces |
| 89 * Use frequency namer to minify names. |
| 90 * Emit js and source map files. |
| 91 |
| 92 ### The architecture today (which might be changing while you read this!) |
| 93 |
| 94 When using the `--use-kernel` flag, you can test the latest state of the |
| 95 compiler as we are migrating to the new architecture. Currently it works as |
| 96 follows: |
| 97 |
| 98 1. **load dart**: (same as old compiler) |
| 99 |
| 100 2. **model**: (same element model as old compiler) |
| 101 |
| 102 3. **resolve, tree-shake and build world**: Build world of reachable code |
| 103 * For each reachable piece of code: |
| 104 * Parse full body of the function |
| 105 * Resolve it from the parsed source ASTs |
| 106 * Type check it (same as old compiler) |
| 107 * Compute impact (i1) from resolved source ASTs (no kernel) |
| 108 * Build a closed world (w1) |
| 109 |
| 110 6. **kernelize**: Create kernel ASTs |
| 111 * For all resolved elements in w1, compute their kernel representation using |
| 112 the `rasta` visitor. |
| 113 |
| 114 5. **analyze**: (almost same as old compiler) |
| 115 |
| 116 6. **codegen and tree-shake**: Generate code, as needed |
| 117 * For each reachable piece of code: |
| 118 * build ssa graph from kernel ASTs (uses global results g) |
| 119 * optimize ssa |
| 120 * compute impact (i2) from optimized code |
| 121 * emit js asts for the code |
| 122 * Build a codegen closed world (w2) from new impacts (i2) |
| 123 |
| 124 7. **emit**: (same as old compiler) |
| 125 |
| 126 Some additional details worth highlighting: |
| 127 |
| 128 * tree-shaking is close to working as we want: the notion of a world and world |
| 129 impacts are computed explicitly: |
| 130 |
| 131 * In the old compiler, the resolver and code generator directly |
| 132 enqueued items to be processed, there was no knowledge of what had |
| 133 to be done other than in the algorithm itself. |
| 134 |
| 135 * Now the information is computed explicitly in two ways: |
| 136 |
| 137 * The dependencies of a single element are computed as an "impact" |
| 138 object, these are derived from the structure of the |
| 139 code (either the resolved code or the generated code). |
| 140 |
| 141 * The closed world is now an explicit concept that can be replaced in the |
| 142 compiler. |
| 143 |
| 144 * This allows us to delete the resolver in the future and replace it |
| 145 with a kernel loader, an impact builder from kernel, and a kernel world. |
| 146 |
| 147 * There is an implementation of a kernel impact builder, but it is not yet |
| 148 in use in the compiler pipeline (gated on replacing the Dart model) |
| 149 |
| 150 * We still depend on the Dart model computed by resolution, but progress has |
| 151 been made introducing an abstraction common to the new and old models. The |
| 152 old model is the "Element model", the generic abstraction is called the |
| 153 "Entity model". Some portions of the compiler now refer to the entity model. |
| 154 |
| 155 * The ssa graph is built from the kernel ASTs, but it still depends on the old |
| 156 element model computed from resolution (accessed via a kernel2Ast adapter). |
| 157 The graph builder implementation covers a large chunk of the language |
| 158 features, but is not complete (89% of langage & corelib tests are passing). |
| 159 |
| 160 * Global analysis is still working on top of the dart2js ASTs. |
| 161 |
| 162 ## Code organization and history |
| 163 |
| 164 The compiler package was initially intended to be compiler for multiple targets: |
| 165 Javascript, Dart (dart2dart), and dartino bytecodes. It has now evolved to be a |
| 166 Javascript only compiler, but some of the abstractions to support multiple |
| 167 targets still remain. |
| 168 |
| 169 ### Possibly confusing terminology |
| 170 |
| 171 Some of the terminology in the compiler is confusing without knowing its |
| 172 history. We are cleaning this up as we are rearchitecting the system, but here |
| 173 are some of the legacy terminology we have: |
| 174 |
| 175 * **target**: the output the compiler is producing. Nowdays it just |
| 176 JavaScript, but in the past there was also Dart and dartino bytecodes. |
| 177 |
| 178 * **backend**: pieces of the compiler that were target-specific. |
| 179 Note: in the past we've used the term *backend* also for code that is used |
| 180 in the frontend of the compiler that happens to be target-specific, as well |
| 181 as and code that is used in the emitter or what traditionally is known |
| 182 as the backend of the compiler. |
| 183 |
| 184 * **frontend**: the parser, resolver, and other early stages of the compiler. |
| 185 The front-end however makes target-specific choices. For example, to compile |
| 186 a program with async-await, the dart2js backend needs to include some helper |
| 187 functions that are used by the expanded async-await code, these helpers need |
| 188 to be parsed by the frontend and added to the compilation pipeline. |
| 189 |
| 190 * **world**: the compiler exploits closed-world assumptions to do |
| 191 optimizations. The *world* encapsulates some of our knowledge of the |
| 192 program, like what's reachable from `main`, which classes are instantiated, |
| 193 etc. |
| 194 |
| 195 * **universe**: rather than loading entire programs and removing unreachable |
| 196 code, the compiler uses a tree-growing approach: it enqueues work based on |
| 197 what it sees. While this is happening the *world* is considered to be |
| 198 growing, in the past the term *universe* was used to describe this growing |
| 199 world. While the term is not completely deleted from the codebase, a lot of |
| 200 progress has been made to rename *universe* into *world builders*. |
| 201 |
| 202 * **model**: there are many models in the compiler: |
| 203 |
| 204 * **element model**: this is an abstraction describing the elements seen in |
| 205 Dart programs, like "libraries", "classes", "methods", etc. |
| 206 |
| 207 * **entity model**: also describes elements seen in Dart programs, but it is |
| 208 meant to be minimalistic and a super-hierarcy above the *element models*. |
| 209 This is a newer addition, is an added abstraction to make it possible to |
| 210 refactor our code from our old frontend to the kernel frontend. |
| 211 |
| 212 * **Dart vs JS models**: the compiler in the past had a single model to |
| 213 describe elements in the source and elements that were being compiled. In |
| 214 the future we plan to have two. Both input model and output models will be |
| 215 implementations of the *entity model*. The JS model is intended to have |
| 216 concepts specific about generating code in JS (like constructor-bodies as |
| 217 a separate entity than the constructor, closure classes, etc). |
| 218 |
| 219 * **emitter model**: this is a model just used for dumping out the structure |
| 220 of the program in a .js text file. It doesn't have enough semantic meaning |
| 221 to be a JS model for compilation at this moment. |
| 222 |
| 223 * **enqueuer**: a work-queue used to achieve tree-shaking (or more precisely |
| 224 tree-growing): elements are added to the enqueuer as we recognize that they |
| 225 are needed in a given application. Note that we even track how elements are |
| 226 used, since some ways of using an element require more code than others. |
| 227 |
| 228 ### Code layout |
| 229 |
| 230 Here are some details of our current code layout and what's on each file. This |
| 231 list also includes some action items (labeled AI below), which are mainly |
| 232 cleanup tasks that we have been discussing for a while: |
| 233 |
| 234 **bin folder**: some experimental command-line entrypoints, these need to be |
| 235 revisited |
| 236 |
| 237 * `bin/dart2js.dart`: is a dart2js entry point, not used today other than |
| 238 locally for development, most of our tools launch dart2js from |
| 239 `lib/src/dart2js.dart` instead. |
| 240 |
| 241 AI: change how we build the SDK to launch dart2js from here, most logic might |
| 242 remain inside `lib/src/dart2js.dart` for testing purposes. |
| 243 |
| 244 * `bin/resolver.dart`: an experiemntal binary we used to run the resolver and |
| 245 serializer. As we are moving to work on top of kernel this is deprecated and |
| 246 should be deleted. |
| 247 |
| 248 AI: delete this file. |
| 249 |
| 250 **lib folder**: API to use dart2js as a library. This is used by our |
| 251 command-line tool to launch dart2js, but also by pub to invoke dart2js as a |
| 252 library during `pub-build` and `pub-serve`. |
| 253 |
| 254 * `lib/compiler_new.dart`: the current API. This API is used by our command-line |
| 255 tool to spawn the dart2js compiler. This API (and everything that is |
| 256 transitively created from it) has no dependencies on `dart:io` so that the |
| 257 compiler can be used in contexts where `dart:io` is not available (e.g. |
| 258 running in a browser worker) or where `dart:io` is not used explicitly (e.g. |
| 259 running as a pub transformer). |
| 260 |
| 261 AI: rename to `compiler.dart`. |
| 262 |
| 263 * `lib/compiler.dart`: a legacy API that now is implemented by adapting calls to |
| 264 the new API in `compiler_new.dart`. |
| 265 |
| 266 AI: migrate users to the new API (pub is one of those users, possibly dart-pad |
| 267 is another), and delete the legacy API. |
| 268 |
| 269 **lib/src folder**: most of the compiler lives here, as very little of its |
| 270 funtionality is publicly exposed. |
| 271 |
| 272 |
| 273 * `lib/src/dart2js.dart`: the command-line script that runs dart2js. When |
| 274 building the SDK, the dart2js snapshot is built using the main method on this |
| 275 script. This file creates the parameters needed to invoke the API defined in |
| 276 `lib/compiler_new.dart`. All dependencies on `dart:io` come from here. This is |
| 277 also where we process options (although some of the logic is done in |
| 278 `options.dart`). |
| 279 |
| 280 * `lib/src/compiler.dart`: defines the core `Compiler` object, which contains |
| 281 all the logic about what the compiler pipeline does and how data is organized |
| 282 and communicated between different phases. For a long time, `Compiler` was |
| 283 also used throughout the system as a global dependency-injection object. |
| 284 We've been slowly disentangling those dependencies, but there are still many |
| 285 references to `compiler` still in use. |
| 286 |
| 287 * `lib/src/apiimpl.dart`: defines `CompilerImpl` a subclass of `Compiler` that |
| 288 adds support for loading scripts, resolving package URIs and patch files. The |
| 289 separation here is a bit historical and we should be able to remove it. It was |
| 290 added to make it easier to create a `MockCompiler` implementation for unit |
| 291 testing. The `MockCompiler` has been replaced in most unit tests by a regular |
| 292 `CompilerImpl` that uses a mock of the file-system (see |
| 293 `tests/compiler/dart2js/memory_compiler.dart`). |
| 294 |
| 295 AI: Once all tests are migrated to this memory compiler, we should merge |
| 296 `Compiler` and `CompilerImpl` and remove this file. |
| 297 |
| 298 * `lib/src/old_to_new_api.dart`: helper library used to adapt the public API in |
| 299 `lib/compiler.dart` to `lib/compiler_new.dart`. |
| 300 |
| 301 * `lib/src/closure.dart`: closures are compiled as classes, this file has the |
| 302 logic to do this kind of conversion in the Dart element model. This includes |
| 303 computing what needs to be boxed and creating fake element models to represent |
| 304 closures as classes. We use the fake model approach because the compiler |
| 305 currently uses the same element model for Dart and JS. Our goal with the |
| 306 compiler rearchitecture described earlier is to have two models. The |
| 307 Dart model will be able to encode closures directly, and we'll introduce their |
| 308 corresponding classes when we create the corresponding JS model, removing the |
| 309 need of the fake elements. |
| 310 |
| 311 * `lib/src/colors.dart`: ANSII support for reporting error messages with colors. |
| 312 |
| 313 AI: this file should move under a utilities folder. |
| 314 |
| 315 |
| 316 * Handling of options: as mentioned earlier `lib/src/dart2js.dart` has some |
| 317 handling of command-line options, the rest is divided into these files: |
| 318 |
| 319 * `lib/src/commandline_options.dart`: defines the flags that dart2js accepts. |
| 320 |
| 321 * `lib/src/options.dart`: defines first-class objects to represent options of |
| 322 dart2js. This includes a parse function that can translate flags into their |
| 323 corresponding objects. This was added recently to simplify how options were |
| 324 propagated throughout the compiler. |
| 325 |
| 326 AI: simplify further how we specify options. Ideally all changes can be done |
| 327 in a single file (`options.dart`?), and unit-tests can specify options via an |
| 328 options object rather than command-line flags. |
| 329 |
| 330 * `lib/src/common.dart`: convenience file that reexports code used in many |
| 331 places in the compiler. |
| 332 |
| 333 AI: consider deleting this file. |
| 334 |
| 335 |
| 336 * Constants: the compiler has a constant system that delays evaluation of |
| 337 constants and provides different semantics depending on the embedder, this |
| 338 abstraction was especially necessary when dart2js was used as a front-end for |
| 339 non-JS systems like dart2dart and dartino. |
| 340 |
| 341 * `lib/src/constants/expressions.dart`: this is how constants are represented |
| 342 after they are parsed but before they are evaluated. It is a target |
| 343 agnostic representation, all expressions are kept as they appear in the |
| 344 source, and it doesn't replace _environemnt_ values that are provided on the |
| 345 command line. In particular, the constant `1 == 1.0` is represented as an |
| 346 expression that includes the `==` binary expression, and `const |
| 347 String.fromEnvironment("FOO")` is not expanded. |
| 348 |
| 349 * `lib/src/constants/value.dart`: this is the represented value of a constant |
| 350 after it has been evaluated. The resulting value is specific to the target |
| 351 of the compiler and will no longer have environment placeholders. For |
| 352 example, when the target is Dart (dart2dart) `1 == 1.0` is evaluated to |
| 353 `false`, and when the target is JavaScript it is evaluated to `true`. This |
| 354 specific example is a result of the way dart2js compiles numbers as |
| 355 JavaScript Numbers. |
| 356 |
| 357 * `lib/src/constants/evaluation.dart`: defines the algorithm to turn an |
| 358 expression into a value. |
| 359 |
| 360 * `lib/src/constants/constant_system.dart`: an abstraction that defines how |
| 361 expressions may be folded. Different implementations of the constant system |
| 362 are used to target Dart or JavaScript. |
| 363 |
| 364 * `lib/src/compile_time_constants.dart`: defines how constant expresions are |
| 365 created from a parsed AST. |
| 366 |
| 367 * `lib/src/constant_system_dart.dart`: defines an implementation of a constant |
| 368 system with the Dart semantics (where `1 == 1.0` is true). |
| 369 |
| 370 * `lib/src/js_backend/constant_system_javascript.dart`: defines an |
| 371 implementation of a constant system with the JavaScript semantics (where |
| 372 `1 == 1.0` is false). |
| 373 |
| 374 * `lib/src/constants/constructors.dart` and |
| 375 `lib/src/constants/constant_constructors.dart`: used to define expressions |
| 376 containing constant constructors. They depend on the resolver to figure out |
| 377 what is the meaning of an initializer or a field on a constructed constant |
| 378 created this way. |
| 379 |
| 380 AI: consider deleting `constant_system_dart.dart` now that it is no longer |
| 381 used, or move under testing, if it might be used for unittests of the constant |
| 382 expressions. |
| 383 |
| 384 * Common elements: the compiler often refers to certain elements during |
| 385 compilation either because they are first-class in the language or because |
| 386 they are implicitly used to implement some features. These include: |
| 387 |
| 388 * `lib/src/common_elements.dart`: provides an interface to lookup basic |
| 389 elements like the class of `Object`, `int`, `List`, and their corresponding |
| 390 interface types, constructors for symbols, annotations such as |
| 391 `@MirrorsUsed`, the `identical` function, etc. These are normally restricted |
| 392 to elements that are understood directly in Dart. |
| 393 |
| 394 * `lib/src/js_backend/backend_helpers.dart`: provides a way to lookup internal |
| 395 elements of the Javascript backend, like our internal |
| 396 representation of JSInt31, JSArray, and other implementation-specific |
| 397 elements. |
| 398 |
| 399 * `lib/src/dart2js_resolver.dart`: a script to run the compiler up to resolution |
| 400 and to generate a serialized json representation of the element model. |
| 401 |
| 402 AI: delete. |
| 403 |
| 404 * `lib/src/deferred_load.dart`: general analysis for deferred loading. This is |
| 405 where we compute how to split the code in different JS chunks or fragments. |
| 406 This is run after resolution, but at a time when no code is generated yet, so |
| 407 the decisions made here are used later on by the emitter to dump code into |
| 408 different files. |
| 409 |
| 410 * `lib/src/dump_info.dart`: a special phase used to create a .info.json file. |
| 411 This file contains lots of information computed by dart2js including decisions |
| 412 about deferred loading, results of the global type-inference, and the actual |
| 413 code generated for each function. The output is used by tools provided in the |
| 414 `dart2js_info` package to analyze a program and better understand why |
| 415 something wasn't optimized as you'd expect. |
| 416 |
| 417 * Tree-shaking: The compiler does two phases of reducing the program size by |
| 418 throwing away unreachable code. The first phase is done while resolving the |
| 419 program (reachablity is basically based on dependencies that appear in the |
| 420 code), the second phase is done as functions are optimized (which in turn can |
| 421 delete branches of the code and make more code unreachable). Externally |
| 422 we refer to it as tree-shaking, but it behaves more like a tree-growing |
| 423 algorithm: elements are added as they are discovered or as they are used. |
| 424 On some large apps we've seen 50% of code tree-shaken: 20% from the first |
| 425 phase, and an additional 30% from the second phase. |
| 426 |
| 427 * `lib/src/enqueue.dart`: this is the basic algorithm that adds things as they |
| 428 are discovered during resolution. |
| 429 |
| 430 * `lib/src/js_backend/enqueuer.dart`: this is the enqueuer used during code |
| 431 generation. |
| 432 |
| 433 * `lib/src/environment.dart`: simple interface for collecting environment values |
| 434 (these are values passed via -D flags on the command line). |
| 435 |
| 436 * `lib/src/filenames.dart`: basic support for converting between native and Uri |
| 437 paths. |
| 438 |
| 439 AI: move to utils |
| 440 |
| 441 * `lib/src/id_generator.dart`: simple id generator |
| 442 |
| 443 AI: move to utils |
| 444 |
| 445 * `lib/src/library_loader.dart`: the loader of the dart2js frontend. Asks the |
| 446 compiler to read and scan files, produce enough metadata to understand |
| 447 import, export, and part directives and keep crawling. It also triggers the |
| 448 patch parser to load patch files. |
| 449 |
| 450 * `lib/src/mirrors_used.dart`: task that analyzes `@MirrorsUsed` annotations, |
| 451 which let the compiler continue to do tree-shaking even when code is used via |
| 452 `dart:mirrors`. |
| 453 |
| 454 * Input/output: the compiler is designed to avoid all dependencies on dart:io. |
| 455 Most data is consumed and emitted via provider APIs. |
| 456 |
| 457 * `lib/src/compiler_new.dart`: defines the interface of these providers (see |
| 458 `CompilerInput` and `CompilerOutput`). |
| 459 |
| 460 * `lib/src/null_compiler_output.dart`: an `CompilerOutput` that discards all |
| 461 data written to it (name derives from /dev/null). |
| 462 |
| 463 * `lib/src/source_file_provider.dart`: _TODO: add details_. |
| 464 |
| 465 * Parsing: most of the parsing logic is now in the `front_end` package, |
| 466 currently under `pkg/front_end/lib/src/fasta/scanner` and |
| 467 `pkg/front_end/lib/src/fasta/parser`. The `front_end` parser is AST agnostic |
| 468 and uses listeners to create on the side what they want as the result of |
| 469 parsing. The logic to create dart2js' ASTs is defined in listeners within the |
| 470 compiler package: |
| 471 |
| 472 * `lib/src/parser/element_listener.dart`: listener used to create the first |
| 473 skeleton of the element model (used by the diet parser) |
| 474 |
| 475 * `lib/src/parser/partial_elements.dart`: representation of elements in the |
| 476 element model whose body is not parsed yet (e.g. a diet-parsed member). |
| 477 |
| 478 * `lib/src/parser/node_listener.dart`: listener used to create the body of |
| 479 methods. |
| 480 |
| 481 * `lib/src/parser/member_listener.dart`: listener used to attach method bodies |
| 482 to class members. |
| 483 |
| 484 * `lib/src/parser/parser_task.dart`: Task to execute the full parser. |
| 485 |
| 486 * `lib/src/parser/diet_parser_task.dart`: Task to execute diet parsing. |
| 487 |
| 488 * `lib/src/patch_parser.dart`: additional support for parsing patch files. We |
| 489 expect this will also move under `front_end` in the future. |
| 490 |
| 491 |
| 492 * URI resolution: the compiler needs special logic to resolve `dart:*` URIs and |
| 493 `package:*` URIs. These are specified in three parts: |
| 494 |
| 495 * sdk library files are specified in a .platform file. This file has a special |
| 496 .ini format which is parsed with `lib/src/platform_configuration.dart`. |
| 497 |
| 498 * sdk patch files are hardcoded in the codebase in |
| 499 `lib/src/js_backend/backend.dart` (see `_patchLocations`). |
| 500 |
| 501 * package resolution is specified with a `.packages` file, which is parsed |
| 502 using the `package_config` package. |
| 503 |
| 504 * `lib/src/resolved_uri_translator.dart`: has the logic to translate all these |
| 505 URIs when they are encountered by the library loader. |
| 506 |
| 507 AI: consider changing the .platform file format to yaml. |
| 508 |
| 509 |
| 510 * `lib/src/typechecker.dart`: the type checker (spec mode semantics, no support |
| 511 for strong mode here). |
| 512 |
| 513 * World: _TODO: add details_ |
| 514 |
| 515 * `lib/src/world.dart` |
| 516 * `lib/src/universe/call_structure.dart` |
| 517 * `lib/src/universe/use.dart` |
| 518 * `lib/src/universe/feature.dart` |
| 519 * `lib/src/universe/world_impact.dart` |
| 520 * `lib/src/universe/selector.dart` |
| 521 * `lib/src/universe/side_effects.dart` |
| 522 * `lib/src/universe/class_set.dart` |
| 523 * `lib/src/universe/world_builder.dart` |
| 524 * `lib/src/universe/function_set.dart` |
| 525 |
| 526 |
| 527 * Testing, debugging, and what not: _TODO: add details_ |
| 528 * `lib/src/tracer.dart` |
| 529 * `lib/src/use_unused_api.dart` |
| 530 |
| 531 |
| 532 * SSA (`lib/src/ssa`): internal IR used to optimize functions before emitting |
| 533 JavaScript. _TODO: add details_. |
| 534 * `ssa.dart` |
| 535 * `kernel_string_builder.dart` |
| 536 * `codegen.dart` |
| 537 * `variable_allocator.dart` |
| 538 * `type_builder.dart` |
| 539 * `value_set.dart` |
| 540 * `types.dart` |
| 541 * `jump_handler.dart` |
| 542 * `codegen_helpers.dart` |
| 543 * `switch_continue_analysis.dart` |
| 544 * `types_propagation.dart` |
| 545 * `nodes.dart` |
| 546 * `kernel_ast_adapter.dart` |
| 547 * `graph_builder.dart` |
| 548 * `validate.dart` |
| 549 * `builder.dart.rej` |
| 550 * `interceptor_simplifier.dart` |
| 551 * `builder_kernel.dart` |
| 552 * `locals_handler.dart` |
| 553 * `optimize.dart` |
| 554 * `kernel_impact.dart` |
| 555 * `invoke_dynamic_specializers.dart` |
| 556 * `builder.dart` |
| 557 * `ssa_branch_builder.dart` |
| 558 * `value_range_analyzer.dart` |
| 559 * `ssa_tracer.dart` |
| 560 * `loop_handler.dart` |
| 561 |
| 562 * `tool`: some helper scripts, some of these could be deleted |
| 563 |
| 564 * `tool/perf.dart`: used by our benchmark runners to measure performance of |
| 565 some frontend pieces of dart2js. We shuld be able to delete it in the near |
| 566 future once the front end code is moved into `fasta`. |
| 567 |
| 568 * `tool/perf_test.dart`: small test to ensure we don't break `perf.dart`. |
| 569 |
| 570 * `tool/track_memory.dart`: a helper script to see memory usage of dart2js |
| 571 while it's running. Used in the past to profile the global analysis phases |
| 572 when run on very large apps. |
| 573 |
| 574 * `tool/dart2js_stress.dart` and `tool/dart2js_profile_many.dart`: other |
| 575 helper wrappers to make it easier to profile dart2js with Observatory. |
| 576 |
| 577 * Source map tracking (`lib/src/io`): helpers used to track source information |
| 578 and to build source map files. _TODO: add details_. |
| 579 * `lib/src/io/code_output.dart` |
| 580 * `lib/src/io/source_map_builder.dart` |
| 581 * `lib/src/io/start_end_information.dart` |
| 582 * `lib/src/io/position_information.dart` |
| 583 * `lib/src/io/source_information.dart` |
| 584 * `lib/src/io/source_file.dart` |
| 585 * `lib/src/io/line_column_provider.dart` |
| 586 |
| 587 * Kernel conversion (`lib/src/kernel`): temporary code to create kernel within |
| 588 dart2js (previously known as `rasta`). Most of this code will be gone when we |
| 589 are in the final architecture. _TODO: add details_. |
| 590 * `lib/src/kernel/task.dart` |
| 591 * `lib/src/kernel/kernel_visitor.dart` |
| 592 * `lib/src/kernel/kernel_debug.dart` |
| 593 * `lib/src/kernel/unresolved.dart` |
| 594 * `lib/src/kernel/kernel.dart` |
| 595 * `lib/src/kernel/unavailable.dart` |
| 596 * `lib/src/kernel/accessors.dart` |
| 597 * `lib/src/kernel/constant_visitor.dart` |
| 598 * `lib/src/kernel/error.dart` |
| 599 |
| 600 * Global whole-program analysis (a.k.a. type inference): We try to avoid the |
| 601 term "type inference" to avoid confusion with strong-mode type inference. |
| 602 However the code still uses the term inference for this global analysis. The |
| 603 code is contained under `lib/src/inferrer`. _TODO: add details_. |
| 604 * `lib/src/inferrer/type_graph_dump.dart` |
| 605 * `lib/src/inferrer/node_tracer.dart` |
| 606 * `lib/src/inferrer/list_tracer.dart` |
| 607 * `lib/src/inferrer/closure_tracer.dart` |
| 608 * `lib/src/inferrer/inferrer_engine.dart` |
| 609 * `lib/src/inferrer/type_graph_inferrer.dart` |
| 610 * `lib/src/inferrer/type_graph_nodes.dart` |
| 611 * `lib/src/inferrer/type_system.dart` |
| 612 * `lib/src/inferrer/debug.dart` |
| 613 * `lib/src/inferrer/locals_handler.dart` |
| 614 * `lib/src/inferrer/map_tracer.dart` |
| 615 * `lib/src/inferrer/builder.dart` |
| 616 |
| 617 * Serialization (`lib/src/serialization/*`: the compiler had support to emit a |
| 618 serialized form of the element model. This is likely going to be deleted in |
| 619 the near future (it was created before we had the intent to use kernel as a |
| 620 serialization format). |
| 621 |
| 622 --------- |
| 623 |
| 624 _TODO: complete the documentation for the following files_. |
| 625 |
| 626 `lib/src/ordered_typeset.dart` |
| 627 `lib/src/script.dart` |
| 628 `lib/src/string_validator.dart` |
| 629 |
| 630 `lib/src/native` |
| 631 `lib/src/native/ssa.dart` |
| 632 `lib/src/native/scanner.dart` |
| 633 `lib/src/native/js.dart` |
| 634 `lib/src/native/enqueue.dart` |
| 635 `lib/src/native/behavior.dart` |
| 636 `lib/src/native/native.dart` |
| 637 |
| 638 `lib/src/js_emitter` |
| 639 `lib/src/js_emitter/native_emitter.dart` |
| 640 `lib/src/js_emitter/main_call_stub_generator.dart` |
| 641 `lib/src/js_emitter/model.dart` |
| 642 `lib/src/js_emitter/headers.dart` |
| 643 `lib/src/js_emitter/native_generator.dart` |
| 644 `lib/src/js_emitter/parameter_stub_generator.dart` |
| 645 `lib/src/js_emitter/constant_ordering.dart` |
| 646 `lib/src/js_emitter/program_builder` |
| 647 `lib/src/js_emitter/program_builder/collector.dart` |
| 648 `lib/src/js_emitter/program_builder/program_builder.dart` |
| 649 `lib/src/js_emitter/program_builder/field_visitor.dart` |
| 650 `lib/src/js_emitter/program_builder/registry.dart` |
| 651 `lib/src/js_emitter/metadata_collector.dart` |
| 652 `lib/src/js_emitter/code_emitter_task.dart.rej` |
| 653 `lib/src/js_emitter/code_emitter_task.dart.orig` |
| 654 `lib/src/js_emitter/code_emitter_task.dart` |
| 655 `lib/src/js_emitter/interceptor_stub_generator.dart` |
| 656 `lib/src/js_emitter/full_emitter` |
| 657 `lib/src/js_emitter/full_emitter/class_builder.dart` |
| 658 `lib/src/js_emitter/full_emitter/container_builder.dart` |
| 659 `lib/src/js_emitter/full_emitter/deferred_output_unit_hash.dart` |
| 660 `lib/src/js_emitter/full_emitter/class_emitter.dart` |
| 661 `lib/src/js_emitter/full_emitter/interceptor_emitter.dart` |
| 662 `lib/src/js_emitter/full_emitter/code_emitter_helper.dart` |
| 663 `lib/src/js_emitter/full_emitter/emitter.dart` |
| 664 `lib/src/js_emitter/full_emitter/setup_program_builder.dart` |
| 665 `lib/src/js_emitter/full_emitter/declarations.dart` |
| 666 `lib/src/js_emitter/full_emitter/nsm_emitter.dart` |
| 667 `lib/src/js_emitter/type_test_registry.dart` |
| 668 `lib/src/js_emitter/js_emitter.dart.rej` |
| 669 `lib/src/js_emitter/class_stub_generator.dart` |
| 670 `lib/src/js_emitter/lazy_emitter` |
| 671 `lib/src/js_emitter/lazy_emitter/model_emitter.dart` |
| 672 `lib/src/js_emitter/lazy_emitter/emitter.dart` |
| 673 `lib/src/js_emitter/startup_emitter` |
| 674 `lib/src/js_emitter/startup_emitter/deferred_fragment_hash.dart` |
| 675 `lib/src/js_emitter/startup_emitter/model_emitter.dart` |
| 676 `lib/src/js_emitter/startup_emitter/emitter.dart` |
| 677 `lib/src/js_emitter/startup_emitter/fragment_emitter.dart` |
| 678 `lib/src/js_emitter/js_emitter.dart` |
| 679 `lib/src/js_emitter/helpers.dart` |
| 680 `lib/src/js_emitter/runtime_type_generator.dart` |
| 681 `lib/src/js_emitter/js_emitter.dart.orig` |
| 682 |
| 683 `lib/src/elements` |
| 684 `lib/src/elements/modelx.dart` |
| 685 `lib/src/elements/types.dart` |
| 686 `lib/src/elements/resolution_types.dart` |
| 687 `lib/src/elements/entities.dart` |
| 688 `lib/src/elements/common.dart` |
| 689 `lib/src/elements/names.dart` |
| 690 `lib/src/elements/visitor.dart` |
| 691 `lib/src/elements/elements.dart` |
| 692 |
| 693 `lib/src/diagnostics` |
| 694 `lib/src/diagnostics/invariant.dart` |
| 695 `lib/src/diagnostics/generated` |
| 696 `lib/src/diagnostics/generated/shared_messages.dart` |
| 697 `lib/src/diagnostics/messages.dart` |
| 698 `lib/src/diagnostics/source_span.dart` |
| 699 `lib/src/diagnostics/code_location.dart` |
| 700 `lib/src/diagnostics/diagnostic_listener.dart` |
| 701 `lib/src/diagnostics/spannable.dart` |
| 702 |
| 703 `lib/src/common` |
| 704 `lib/src/common/codegen.dart` |
| 705 `lib/src/common/resolution.dart` |
| 706 `lib/src/common/tasks.dart` |
| 707 `lib/src/common/work.dart` |
| 708 `lib/src/common/backend_api.dart` |
| 709 `lib/src/common/names.dart` |
| 710 |
| 711 `lib/src/tokens/token_map.dart`: unused |
| 712 |
| 713 `lib/src/resolution` |
| 714 `lib/src/resolution/typedefs.dart` |
| 715 `lib/src/resolution/registry.dart.orig` |
| 716 `lib/src/resolution/scope.dart` |
| 717 `lib/src/resolution/members.dart` |
| 718 `lib/src/resolution/label_scope.dart` |
| 719 `lib/src/resolution/registry.dart.rej` |
| 720 `lib/src/resolution/resolution.dart` |
| 721 `lib/src/resolution/access_semantics.dart` |
| 722 `lib/src/resolution/operators.dart` |
| 723 `lib/src/resolution/member_impl.dart` |
| 724 `lib/src/resolution/resolution_common.dart` |
| 725 `lib/src/resolution/semantic_visitor.dart` |
| 726 `lib/src/resolution/resolution_result.dart` |
| 727 `lib/src/resolution/send_resolver.dart` |
| 728 `lib/src/resolution/send_structure.dart` |
| 729 `lib/src/resolution/variables.dart` |
| 730 `lib/src/resolution/enum_creator.dart` |
| 731 `lib/src/resolution/members.dart.orig` |
| 732 `lib/src/resolution/type_resolver.dart` |
| 733 `lib/src/resolution/class_members.dart` |
| 734 `lib/src/resolution/constructors.dart` |
| 735 `lib/src/resolution/secret_tree_element.dart` |
| 736 `lib/src/resolution/registry.dart` |
| 737 `lib/src/resolution/tree_elements.dart` |
| 738 `lib/src/resolution/semantic_visitor_mixins.dart` |
| 739 `lib/src/resolution/class_hierarchy.dart` |
| 740 `lib/src/resolution/signatures.dart` |
| 741 |
| 742 `lib/src/scanner` |
| 743 `lib/src/scanner/scanner_task.dart` |
| 744 |
| 745 `lib/src/helpers` |
| 746 `lib/src/helpers/trace.dart` |
| 747 `lib/src/helpers/debug_collection.dart` |
| 748 `lib/src/helpers/expensive_map.dart` |
| 749 `lib/src/helpers/helpers.dart` |
| 750 `lib/src/helpers/track_map.dart` |
| 751 `lib/src/helpers/expensive_set.dart` |
| 752 `lib/src/helpers/stats.dart` |
| 753 |
| 754 `lib/src/js` |
| 755 `lib/src/js/js.dart` |
| 756 `lib/src/js/placeholder_safety.dart` |
| 757 `lib/src/js/js_debug.dart` |
| 758 `lib/src/js/js_source_mapping.dart` |
| 759 `lib/src/js/rewrite_async.dart` |
| 760 |
| 761 `lib/src/util` |
| 762 `lib/src/util/uri_extras.dart` |
| 763 `lib/src/util/indentation.dart` |
| 764 `lib/src/util/enumset.dart` |
| 765 `lib/src/util/link.dart` |
| 766 `lib/src/util/util.dart` |
| 767 `lib/src/util/maplet.dart` |
| 768 `lib/src/util/setlet.dart` |
| 769 `lib/src/util/characters.dart` |
| 770 `lib/src/util/emptyset.dart` |
| 771 `lib/src/util/link_implementation.dart` |
| 772 `lib/src/util/util_implementation.dart` |
| 773 `lib/src/util/command_line.dart` |
| 774 |
| 775 `lib/src/js_backend` |
| 776 `lib/src/js_backend/frequency_namer.dart` |
| 777 `lib/src/js_backend/patch_resolver.dart` |
| 778 `lib/src/js_backend/minify_namer.dart` |
| 779 `lib/src/js_backend/mirrors_analysis.dart` |
| 780 `lib/src/js_backend/js_backend.dart` |
| 781 `lib/src/js_backend/field_naming_mixin.dart` |
| 782 `lib/src/js_backend/native_data.dart` |
| 783 `lib/src/js_backend/namer.dart` |
| 784 `lib/src/js_backend/custom_elements_analysis.dart` |
| 785 `lib/src/js_backend/type_variable_handler.dart` |
| 786 `lib/src/js_backend/js_interop_analysis.dart` |
| 787 `lib/src/js_backend/backend_impact.dart` |
| 788 `lib/src/js_backend/constant_emitter.dart` |
| 789 `lib/src/js_backend/lookup_map_analysis.dart` |
| 790 `lib/src/js_backend/namer_names.dart` |
| 791 `lib/src/js_backend/runtime_types.dart` |
| 792 `lib/src/js_backend/no_such_method_registry.dart` |
| 793 `lib/src/js_backend/constant_system_javascript.dart` |
| 794 `lib/src/js_backend/backend.dart` |
| 795 `lib/src/js_backend/backend_serialization.dart` |
| 796 `lib/src/js_backend/checked_mode_helpers.dart` |
| 797 `lib/src/js_backend/constant_handler_javascript.dart` |
| 798 |
| 799 `lib/src/tree` |
| 800 `lib/src/tree/prettyprint.dart` |
| 801 `lib/src/tree/tree.dart` |
| 802 `lib/src/tree/nodes.dart` |
| 803 `lib/src/tree/dartstring.dart` |
| 804 `lib/src/tree/unparser.dart` |
| 805 |
| 806 `lib/src/types` |
| 807 `lib/src/types/abstract_value_domain.dart` |
| 808 `lib/src/types/types.dart` |
| 809 `lib/src/types/type_mask.dart` |
| 810 `lib/src/types/dictionary_type_mask.dart` |
| 811 `lib/src/types/map_type_mask.dart` |
| 812 `lib/src/types/forwarding_type_mask.dart` |
| 813 `lib/src/types/container_type_mask.dart` |
| 814 `lib/src/types/constants.dart` |
| 815 `lib/src/types/flat_type_mask.dart` |
| 816 `lib/src/types/masks.dart` |
| 817 `lib/src/types/value_type_mask.dart` |
| 818 `lib/src/types/union_type_mask.dart` |
| 819 |
| 820 `lib/src/hash` |
| 821 `lib/src/hash/sha1.dart` |
OLD | NEW |