Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: pkg/compiler/lib/src/options.dart

Issue 2797443008: Reapply "Add "load from .dill" file capability and run a white-box test."" (Closed)
Patch Set: take two Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/serialization/task.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 /// Whether to trust type annotations during inference and optimizations. 196 /// Whether to trust type annotations during inference and optimizations.
197 final bool trustTypeAnnotations; 197 final bool trustTypeAnnotations;
198 198
199 /// Whether to generate code compliant with content security policy (CSP). 199 /// Whether to generate code compliant with content security policy (CSP).
200 final bool useContentSecurityPolicy; 200 final bool useContentSecurityPolicy;
201 201
202 /// Whether to use kernel internally as part of compilation. 202 /// Whether to use kernel internally as part of compilation.
203 final bool useKernel; 203 final bool useKernel;
204 204
205 /// Read input from a .dill file rather than a .dart input (only to be used in
206 /// conjunction with useKernel = true).
207 final bool loadFromDill;
208
205 // Whether to use kernel internally for global type inference calculations. 209 // Whether to use kernel internally for global type inference calculations.
206 // TODO(efortuna): Remove this and consolidate with useKernel. 210 // TODO(efortuna): Remove this and consolidate with useKernel.
207 final bool kernelGlobalInference; 211 final bool kernelGlobalInference;
208 212
209 /// When obfuscating for minification, whether to use the frequency of a name 213 /// When obfuscating for minification, whether to use the frequency of a name
210 /// as an heuristic to pick shorter names. 214 /// as an heuristic to pick shorter names.
211 final bool useFrequencyNamer; 215 final bool useFrequencyNamer;
212 216
213 /// Whether to generate source-information from both the old and the new 217 /// Whether to generate source-information from both the old and the new
214 /// source-information engines. (experimental) 218 /// source-information engines. (experimental)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 sourceMapUri: _extractUriOption(options, '--source-map='), 299 sourceMapUri: _extractUriOption(options, '--source-map='),
296 strips: _extractCsvOption(options, '--force-strip='), 300 strips: _extractCsvOption(options, '--force-strip='),
297 testMode: _hasOption(options, Flags.testMode), 301 testMode: _hasOption(options, Flags.testMode),
298 trustJSInteropTypeAnnotations: 302 trustJSInteropTypeAnnotations:
299 _hasOption(options, Flags.trustJSInteropTypeAnnotations), 303 _hasOption(options, Flags.trustJSInteropTypeAnnotations),
300 trustPrimitives: _hasOption(options, Flags.trustPrimitives), 304 trustPrimitives: _hasOption(options, Flags.trustPrimitives),
301 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), 305 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
302 useContentSecurityPolicy: 306 useContentSecurityPolicy:
303 _hasOption(options, Flags.useContentSecurityPolicy), 307 _hasOption(options, Flags.useContentSecurityPolicy),
304 useKernel: _hasOption(options, Flags.useKernel), 308 useKernel: _hasOption(options, Flags.useKernel),
309 loadFromDill: _hasOption(options, Flags.loadFromDill),
305 useFrequencyNamer: 310 useFrequencyNamer:
306 !_hasOption(options, Flags.noFrequencyBasedMinification), 311 !_hasOption(options, Flags.noFrequencyBasedMinification),
307 useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo), 312 useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
308 useNewSourceInfo: _hasOption(options, Flags.useNewSourceInfo), 313 useNewSourceInfo: _hasOption(options, Flags.useNewSourceInfo),
309 useStartupEmitter: _hasOption(options, Flags.fastStartup), 314 useStartupEmitter: _hasOption(options, Flags.fastStartup),
310 verbose: _hasOption(options, Flags.verbose)); 315 verbose: _hasOption(options, Flags.verbose));
311 } 316 }
312 317
313 /// Creates an option object for the compiler. 318 /// Creates an option object for the compiler.
314 /// 319 ///
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 Uri resolutionOutput: null, 360 Uri resolutionOutput: null,
356 bool resolveOnly: false, 361 bool resolveOnly: false,
357 Uri sourceMapUri: null, 362 Uri sourceMapUri: null,
358 List<String> strips: const [], 363 List<String> strips: const [],
359 bool testMode: false, 364 bool testMode: false,
360 bool trustJSInteropTypeAnnotations: false, 365 bool trustJSInteropTypeAnnotations: false,
361 bool trustPrimitives: false, 366 bool trustPrimitives: false,
362 bool trustTypeAnnotations: false, 367 bool trustTypeAnnotations: false,
363 bool useContentSecurityPolicy: false, 368 bool useContentSecurityPolicy: false,
364 bool useKernel: false, 369 bool useKernel: false,
370 bool loadFromDill: false,
365 bool useFrequencyNamer: true, 371 bool useFrequencyNamer: true,
366 bool useMultiSourceInfo: false, 372 bool useMultiSourceInfo: false,
367 bool useNewSourceInfo: false, 373 bool useNewSourceInfo: false,
368 bool useStartupEmitter: false, 374 bool useStartupEmitter: false,
369 bool verbose: false}) { 375 bool verbose: false}) {
370 // TODO(sigmund): should entrypoint be here? should we validate it is not 376 // TODO(sigmund): should entrypoint be here? should we validate it is not
371 // null? In unittests we use the same compiler to analyze or build multiple 377 // null? In unittests we use the same compiler to analyze or build multiple
372 // entrypoints. 378 // entrypoints.
373 if (libraryRoot == null) { 379 if (libraryRoot == null) {
374 throw new ArgumentError("[libraryRoot] is null."); 380 throw new ArgumentError("[libraryRoot] is null.");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 resolutionOutput: resolutionOutput, 433 resolutionOutput: resolutionOutput,
428 resolveOnly: resolveOnly, 434 resolveOnly: resolveOnly,
429 sourceMapUri: sourceMapUri, 435 sourceMapUri: sourceMapUri,
430 strips: strips, 436 strips: strips,
431 testMode: testMode, 437 testMode: testMode,
432 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, 438 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations,
433 trustPrimitives: trustPrimitives, 439 trustPrimitives: trustPrimitives,
434 trustTypeAnnotations: trustTypeAnnotations, 440 trustTypeAnnotations: trustTypeAnnotations,
435 useContentSecurityPolicy: useContentSecurityPolicy, 441 useContentSecurityPolicy: useContentSecurityPolicy,
436 useKernel: useKernel, 442 useKernel: useKernel,
443 loadFromDill: loadFromDill,
437 useFrequencyNamer: useFrequencyNamer, 444 useFrequencyNamer: useFrequencyNamer,
438 useMultiSourceInfo: useMultiSourceInfo, 445 useMultiSourceInfo: useMultiSourceInfo,
439 useNewSourceInfo: useNewSourceInfo, 446 useNewSourceInfo: useNewSourceInfo,
440 useStartupEmitter: useStartupEmitter, 447 useStartupEmitter: useStartupEmitter,
441 verbose: verbose); 448 verbose: verbose);
442 } 449 }
443 450
444 CompilerOptions._(this.entryPoint, this.libraryRoot, this.packageRoot, 451 CompilerOptions._(this.entryPoint, this.libraryRoot, this.packageRoot,
445 this.packageConfig, this.packagesDiscoveryProvider, this.environment, 452 this.packageConfig, this.packagesDiscoveryProvider, this.environment,
446 {this.allowMockCompilation: false, 453 {this.allowMockCompilation: false,
(...skipping 30 matching lines...) Expand all
477 this.resolveOnly: false, 484 this.resolveOnly: false,
478 this.compileOnly: false, 485 this.compileOnly: false,
479 this.sourceMapUri: null, 486 this.sourceMapUri: null,
480 this.strips: const [], 487 this.strips: const [],
481 this.testMode: false, 488 this.testMode: false,
482 this.trustJSInteropTypeAnnotations: false, 489 this.trustJSInteropTypeAnnotations: false,
483 this.trustPrimitives: false, 490 this.trustPrimitives: false,
484 this.trustTypeAnnotations: false, 491 this.trustTypeAnnotations: false,
485 this.useContentSecurityPolicy: false, 492 this.useContentSecurityPolicy: false,
486 this.useKernel: false, 493 this.useKernel: false,
494 this.loadFromDill: false,
487 this.useFrequencyNamer: false, 495 this.useFrequencyNamer: false,
488 this.useMultiSourceInfo: false, 496 this.useMultiSourceInfo: false,
489 this.useNewSourceInfo: false, 497 this.useNewSourceInfo: false,
490 this.useStartupEmitter: false, 498 this.useStartupEmitter: false,
491 this.verbose: false}) 499 this.verbose: false})
492 : _shownPackageWarnings = shownPackageWarnings; 500 : _shownPackageWarnings = shownPackageWarnings;
493 501
494 /// Creates a copy of the [CompilerOptions] where the provided non-null 502 /// Creates a copy of the [CompilerOptions] where the provided non-null
495 /// option values replace existing. 503 /// option values replace existing.
496 static CompilerOptions copy(CompilerOptions options, 504 static CompilerOptions copy(CompilerOptions options,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 resolveOnly, 542 resolveOnly,
535 compileOnly, 543 compileOnly,
536 sourceMapUri, 544 sourceMapUri,
537 strips, 545 strips,
538 testMode, 546 testMode,
539 trustJSInteropTypeAnnotations, 547 trustJSInteropTypeAnnotations,
540 trustPrimitives, 548 trustPrimitives,
541 trustTypeAnnotations, 549 trustTypeAnnotations,
542 useContentSecurityPolicy, 550 useContentSecurityPolicy,
543 useKernel, 551 useKernel,
552 loadFromDill,
544 useFrequencyNamer, 553 useFrequencyNamer,
545 useMultiSourceInfo, 554 useMultiSourceInfo,
546 useNewSourceInfo, 555 useNewSourceInfo,
547 useStartupEmitter, 556 useStartupEmitter,
548 verbose}) { 557 verbose}) {
549 return new CompilerOptions._( 558 return new CompilerOptions._(
550 entryPoint ?? options.entryPoint, 559 entryPoint ?? options.entryPoint,
551 libraryRoot ?? options.libraryRoot, 560 libraryRoot ?? options.libraryRoot,
552 packageRoot ?? options.packageRoot, 561 packageRoot ?? options.packageRoot,
553 packageConfig ?? options.packageConfig, 562 packageConfig ?? options.packageConfig,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 strips: strips ?? options.strips, 610 strips: strips ?? options.strips,
602 testMode: testMode ?? options.testMode, 611 testMode: testMode ?? options.testMode,
603 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations ?? 612 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations ??
604 options.trustJSInteropTypeAnnotations, 613 options.trustJSInteropTypeAnnotations,
605 trustPrimitives: trustPrimitives ?? options.trustPrimitives, 614 trustPrimitives: trustPrimitives ?? options.trustPrimitives,
606 trustTypeAnnotations: 615 trustTypeAnnotations:
607 trustTypeAnnotations ?? options.trustTypeAnnotations, 616 trustTypeAnnotations ?? options.trustTypeAnnotations,
608 useContentSecurityPolicy: 617 useContentSecurityPolicy:
609 useContentSecurityPolicy ?? options.useContentSecurityPolicy, 618 useContentSecurityPolicy ?? options.useContentSecurityPolicy,
610 useKernel: useKernel ?? options.useKernel, 619 useKernel: useKernel ?? options.useKernel,
620 loadFromDill: loadFromDill ?? options.loadFromDill,
611 useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer, 621 useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer,
612 useMultiSourceInfo: useMultiSourceInfo ?? options.useMultiSourceInfo, 622 useMultiSourceInfo: useMultiSourceInfo ?? options.useMultiSourceInfo,
613 useNewSourceInfo: useNewSourceInfo ?? options.useNewSourceInfo, 623 useNewSourceInfo: useNewSourceInfo ?? options.useNewSourceInfo,
614 useStartupEmitter: useStartupEmitter ?? options.useStartupEmitter, 624 useStartupEmitter: useStartupEmitter ?? options.useStartupEmitter,
615 verbose: verbose ?? options.verbose); 625 verbose: verbose ?? options.verbose);
616 } 626 }
617 627
618 /// Returns `true` if warnings and hints are shown for all packages. 628 /// Returns `true` if warnings and hints are shown for all packages.
619 bool get showAllPackageWarnings { 629 bool get showAllPackageWarnings {
620 return _shownPackageWarnings != null && _shownPackageWarnings.isEmpty; 630 return _shownPackageWarnings != null && _shownPackageWarnings.isEmpty;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 _extractStringOption(options, "--platform-config=", null), 717 _extractStringOption(options, "--platform-config=", null),
708 _extractCsvOption(options, '--categories=')); 718 _extractCsvOption(options, '--categories='));
709 } 719 }
710 720
711 /// Locations of the platform descriptor files relative to the library root. 721 /// Locations of the platform descriptor files relative to the library root.
712 const String _clientPlatform = "lib/dart_client.platform"; 722 const String _clientPlatform = "lib/dart_client.platform";
713 const String _serverPlatform = "lib/dart_server.platform"; 723 const String _serverPlatform = "lib/dart_server.platform";
714 const String _sharedPlatform = "lib/dart_shared.platform"; 724 const String _sharedPlatform = "lib/dart_shared.platform";
715 725
716 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; 726 const String _UNDETERMINED_BUILD_ID = "build number could not be determined";
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/serialization/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698