OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library dart2js.src.options; | 5 library dart2js.src.options; |
6 | 6 |
7 import '../compiler.dart' show PackagesDiscoveryProvider; | 7 import '../compiler.dart' show PackagesDiscoveryProvider; |
8 import 'commandline_options.dart' show Flags; | 8 import 'commandline_options.dart' show Flags; |
9 | 9 |
10 /// Options used for controlling diagnostic messages. | 10 /// Options used for controlling diagnostic messages. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 final bool useNewSourceInfo; | 223 final bool useNewSourceInfo; |
224 | 224 |
225 /// Whether the user requested to use the fast startup emitter. The full | 225 /// Whether the user requested to use the fast startup emitter. The full |
226 /// emitter might still be used if the program uses dart:mirrors. | 226 /// emitter might still be used if the program uses dart:mirrors. |
227 final bool useStartupEmitter; | 227 final bool useStartupEmitter; |
228 | 228 |
229 /// Enable verbose printing during compilation. Includes progress messages | 229 /// Enable verbose printing during compilation. Includes progress messages |
230 /// during each phase and a time-breakdown between phases at the end. | 230 /// during each phase and a time-breakdown between phases at the end. |
231 final bool verbose; | 231 final bool verbose; |
232 | 232 |
| 233 /// Track allocations in the JS output. |
| 234 /// |
| 235 /// This is an experimental feature. |
| 236 final bool experimentalTrackAllocations; |
| 237 |
| 238 /// The path to the file that contains the profiled allocations. |
| 239 /// |
| 240 /// The file must contain the Map that was produced by using |
| 241 /// [experimentalTrackAllocations] encoded as a JSON map. |
| 242 /// |
| 243 /// This is an experimental feature. |
| 244 final String experimentalAllocationsPath; |
| 245 |
233 // ------------------------------------------------- | 246 // ------------------------------------------------- |
234 // Options for deprecated features | 247 // Options for deprecated features |
235 // ------------------------------------------------- | 248 // ------------------------------------------------- |
236 // TODO(sigmund): delete these as we delete the underlying features | 249 // TODO(sigmund): delete these as we delete the underlying features |
237 | 250 |
238 /// Whether to preserve comments while scanning (only use for dart:mirrors). | 251 /// Whether to preserve comments while scanning (only use for dart:mirrors). |
239 final bool preserveComments; | 252 final bool preserveComments; |
240 | 253 |
241 /// Strip option used by dart2dart. | 254 /// Strip option used by dart2dart. |
242 final List<String> strips; | 255 final List<String> strips; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 disableInlining: _hasOption(options, Flags.disableInlining), | 290 disableInlining: _hasOption(options, Flags.disableInlining), |
278 disableTypeInference: _hasOption(options, Flags.disableTypeInference), | 291 disableTypeInference: _hasOption(options, Flags.disableTypeInference), |
279 dumpInfo: _hasOption(options, Flags.dumpInfo), | 292 dumpInfo: _hasOption(options, Flags.dumpInfo), |
280 enableExperimentalMirrors: | 293 enableExperimentalMirrors: |
281 _hasOption(options, Flags.enableExperimentalMirrors), | 294 _hasOption(options, Flags.enableExperimentalMirrors), |
282 enableMinification: _hasOption(options, Flags.minify), | 295 enableMinification: _hasOption(options, Flags.minify), |
283 enableNativeLiveTypeAnalysis: | 296 enableNativeLiveTypeAnalysis: |
284 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 297 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
285 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 298 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
286 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 299 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 300 experimentalTrackAllocations: |
| 301 _hasOption(options, Flags.experimentalTrackAllocations), |
| 302 experimentalAllocationsPath: _extractStringOption( |
| 303 options, "${Flags.experimentalAllocationsPath}=", null), |
287 generateCodeWithCompileTimeErrors: | 304 generateCodeWithCompileTimeErrors: |
288 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 305 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
289 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 306 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
290 kernelGlobalInference: _hasOption(options, Flags.kernelGlobalInference), | 307 kernelGlobalInference: _hasOption(options, Flags.kernelGlobalInference), |
291 outputUri: _extractUriOption(options, '--out='), | 308 outputUri: _extractUriOption(options, '--out='), |
292 platformConfigUri: | 309 platformConfigUri: |
293 _resolvePlatformConfigFromOptions(libraryRoot, options), | 310 _resolvePlatformConfigFromOptions(libraryRoot, options), |
294 preserveComments: _hasOption(options, Flags.preserveComments), | 311 preserveComments: _hasOption(options, Flags.preserveComments), |
295 preserveUris: _hasOption(options, Flags.preserveUris), | 312 preserveUris: _hasOption(options, Flags.preserveUris), |
296 resolutionInputs: resolutionInputs, | 313 resolutionInputs: resolutionInputs, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 List<String> shownPackageWarnings: null, | 359 List<String> shownPackageWarnings: null, |
343 bool disableInlining: false, | 360 bool disableInlining: false, |
344 bool disableTypeInference: false, | 361 bool disableTypeInference: false, |
345 bool dumpInfo: false, | 362 bool dumpInfo: false, |
346 bool enableAssertMessage: true, | 363 bool enableAssertMessage: true, |
347 bool enableExperimentalMirrors: false, | 364 bool enableExperimentalMirrors: false, |
348 bool enableMinification: false, | 365 bool enableMinification: false, |
349 bool enableNativeLiveTypeAnalysis: true, | 366 bool enableNativeLiveTypeAnalysis: true, |
350 bool enableTypeAssertions: false, | 367 bool enableTypeAssertions: false, |
351 bool enableUserAssertions: false, | 368 bool enableUserAssertions: false, |
| 369 bool experimentalTrackAllocations: false, |
| 370 String experimentalAllocationsPath: null, |
352 bool generateCodeWithCompileTimeErrors: false, | 371 bool generateCodeWithCompileTimeErrors: false, |
353 bool generateSourceMap: true, | 372 bool generateSourceMap: true, |
354 bool kernelGlobalInference: false, | 373 bool kernelGlobalInference: false, |
355 Uri outputUri: null, | 374 Uri outputUri: null, |
356 Uri platformConfigUri: null, | 375 Uri platformConfigUri: null, |
357 bool preserveComments: false, | 376 bool preserveComments: false, |
358 bool preserveUris: false, | 377 bool preserveUris: false, |
359 List<Uri> resolutionInputs: null, | 378 List<Uri> resolutionInputs: null, |
360 Uri resolutionOutput: null, | 379 Uri resolutionOutput: null, |
361 bool resolveOnly: false, | 380 bool resolveOnly: false, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 shownPackageWarnings: shownPackageWarnings, | 433 shownPackageWarnings: shownPackageWarnings, |
415 disableInlining: disableInlining, | 434 disableInlining: disableInlining, |
416 disableTypeInference: disableTypeInference, | 435 disableTypeInference: disableTypeInference, |
417 dumpInfo: dumpInfo, | 436 dumpInfo: dumpInfo, |
418 enableAssertMessage: enableAssertMessage, | 437 enableAssertMessage: enableAssertMessage, |
419 enableExperimentalMirrors: enableExperimentalMirrors, | 438 enableExperimentalMirrors: enableExperimentalMirrors, |
420 enableMinification: enableMinification, | 439 enableMinification: enableMinification, |
421 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 440 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
422 enableTypeAssertions: enableTypeAssertions, | 441 enableTypeAssertions: enableTypeAssertions, |
423 enableUserAssertions: enableUserAssertions, | 442 enableUserAssertions: enableUserAssertions, |
| 443 experimentalTrackAllocations: experimentalTrackAllocations, |
| 444 experimentalAllocationsPath: experimentalAllocationsPath, |
424 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 445 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
425 generateSourceMap: generateSourceMap, | 446 generateSourceMap: generateSourceMap, |
426 kernelGlobalInference: kernelGlobalInference, | 447 kernelGlobalInference: kernelGlobalInference, |
427 outputUri: outputUri, | 448 outputUri: outputUri, |
428 platformConfigUri: platformConfigUri ?? | 449 platformConfigUri: platformConfigUri ?? |
429 _resolvePlatformConfig(libraryRoot, null, const []), | 450 _resolvePlatformConfig(libraryRoot, null, const []), |
430 preserveComments: preserveComments, | 451 preserveComments: preserveComments, |
431 preserveUris: preserveUris, | 452 preserveUris: preserveUris, |
432 resolutionInputs: resolutionInputs, | 453 resolutionInputs: resolutionInputs, |
433 resolutionOutput: resolutionOutput, | 454 resolutionOutput: resolutionOutput, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 List<String> shownPackageWarnings: null, | 486 List<String> shownPackageWarnings: null, |
466 this.disableInlining: false, | 487 this.disableInlining: false, |
467 this.disableTypeInference: false, | 488 this.disableTypeInference: false, |
468 this.dumpInfo: false, | 489 this.dumpInfo: false, |
469 this.enableAssertMessage: true, | 490 this.enableAssertMessage: true, |
470 this.enableExperimentalMirrors: false, | 491 this.enableExperimentalMirrors: false, |
471 this.enableMinification: false, | 492 this.enableMinification: false, |
472 this.enableNativeLiveTypeAnalysis: false, | 493 this.enableNativeLiveTypeAnalysis: false, |
473 this.enableTypeAssertions: false, | 494 this.enableTypeAssertions: false, |
474 this.enableUserAssertions: false, | 495 this.enableUserAssertions: false, |
| 496 this.experimentalTrackAllocations: false, |
| 497 this.experimentalAllocationsPath: null, |
475 this.generateCodeWithCompileTimeErrors: false, | 498 this.generateCodeWithCompileTimeErrors: false, |
476 this.generateSourceMap: true, | 499 this.generateSourceMap: true, |
477 this.kernelGlobalInference: false, | 500 this.kernelGlobalInference: false, |
478 this.outputUri: null, | 501 this.outputUri: null, |
479 this.platformConfigUri: null, | 502 this.platformConfigUri: null, |
480 this.preserveComments: false, | 503 this.preserveComments: false, |
481 this.preserveUris: false, | 504 this.preserveUris: false, |
482 this.resolutionInputs: null, | 505 this.resolutionInputs: null, |
483 this.resolutionOutput: null, | 506 this.resolutionOutput: null, |
484 this.resolveOnly: false, | 507 this.resolveOnly: false, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 List<String> shownPackageWarnings, | 546 List<String> shownPackageWarnings, |
524 disableInlining, | 547 disableInlining, |
525 disableTypeInference, | 548 disableTypeInference, |
526 dumpInfo, | 549 dumpInfo, |
527 enableAssertMessage, | 550 enableAssertMessage, |
528 enableExperimentalMirrors, | 551 enableExperimentalMirrors, |
529 enableMinification, | 552 enableMinification, |
530 enableNativeLiveTypeAnalysis, | 553 enableNativeLiveTypeAnalysis, |
531 enableTypeAssertions, | 554 enableTypeAssertions, |
532 enableUserAssertions, | 555 enableUserAssertions, |
| 556 experimentalTrackAllocations, |
| 557 experimentalAllocationsPath, |
533 generateCodeWithCompileTimeErrors, | 558 generateCodeWithCompileTimeErrors, |
534 generateSourceMap, | 559 generateSourceMap, |
535 kernelGlobalInference, | 560 kernelGlobalInference, |
536 outputUri, | 561 outputUri, |
537 platformConfigUri, | 562 platformConfigUri, |
538 preserveComments, | 563 preserveComments, |
539 preserveUris, | 564 preserveUris, |
540 resolutionInputs, | 565 resolutionInputs, |
541 resolutionOutput, | 566 resolutionOutput, |
542 resolveOnly, | 567 resolveOnly, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 enableAssertMessage: enableAssertMessage ?? options.enableAssertMessage, | 611 enableAssertMessage: enableAssertMessage ?? options.enableAssertMessage, |
587 enableExperimentalMirrors: | 612 enableExperimentalMirrors: |
588 enableExperimentalMirrors ?? options.enableExperimentalMirrors, | 613 enableExperimentalMirrors ?? options.enableExperimentalMirrors, |
589 enableMinification: enableMinification ?? options.enableMinification, | 614 enableMinification: enableMinification ?? options.enableMinification, |
590 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? | 615 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? |
591 options.enableNativeLiveTypeAnalysis, | 616 options.enableNativeLiveTypeAnalysis, |
592 enableTypeAssertions: | 617 enableTypeAssertions: |
593 enableTypeAssertions ?? options.enableTypeAssertions, | 618 enableTypeAssertions ?? options.enableTypeAssertions, |
594 enableUserAssertions: | 619 enableUserAssertions: |
595 enableUserAssertions ?? options.enableUserAssertions, | 620 enableUserAssertions ?? options.enableUserAssertions, |
| 621 experimentalTrackAllocations: experimentalTrackAllocations ?? |
| 622 options.experimentalTrackAllocations, |
| 623 experimentalAllocationsPath: |
| 624 experimentalAllocationsPath ?? options.experimentalAllocationsPath, |
596 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? | 625 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? |
597 options.generateCodeWithCompileTimeErrors, | 626 options.generateCodeWithCompileTimeErrors, |
598 generateSourceMap: generateSourceMap ?? options.generateSourceMap, | 627 generateSourceMap: generateSourceMap ?? options.generateSourceMap, |
599 kernelGlobalInference: | 628 kernelGlobalInference: |
600 kernelGlobalInference ?? options.kernelGlobalInference, | 629 kernelGlobalInference ?? options.kernelGlobalInference, |
601 outputUri: outputUri ?? options.outputUri, | 630 outputUri: outputUri ?? options.outputUri, |
602 platformConfigUri: platformConfigUri ?? options.platformConfigUri, | 631 platformConfigUri: platformConfigUri ?? options.platformConfigUri, |
603 preserveComments: preserveComments ?? options.preserveComments, | 632 preserveComments: preserveComments ?? options.preserveComments, |
604 preserveUris: preserveUris ?? options.preserveUris, | 633 preserveUris: preserveUris ?? options.preserveUris, |
605 resolutionInputs: resolutionInputs ?? options.resolutionInputs, | 634 resolutionInputs: resolutionInputs ?? options.resolutionInputs, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 _extractStringOption(options, "--platform-config=", null), | 746 _extractStringOption(options, "--platform-config=", null), |
718 _extractCsvOption(options, '--categories=')); | 747 _extractCsvOption(options, '--categories=')); |
719 } | 748 } |
720 | 749 |
721 /// Locations of the platform descriptor files relative to the library root. | 750 /// Locations of the platform descriptor files relative to the library root. |
722 const String _clientPlatform = "lib/dart_client.platform"; | 751 const String _clientPlatform = "lib/dart_client.platform"; |
723 const String _serverPlatform = "lib/dart_server.platform"; | 752 const String _serverPlatform = "lib/dart_server.platform"; |
724 const String _sharedPlatform = "lib/dart_shared.platform"; | 753 const String _sharedPlatform = "lib/dart_shared.platform"; |
725 | 754 |
726 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 755 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
OLD | NEW |