| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 compiler_configuration; | 5 library compiler_configuration; |
| 6 | 6 |
| 7 import 'dart:io' show Platform; | 7 import 'dart:io' show Platform; |
| 8 | 8 |
| 9 import 'runtime_configuration.dart' show RuntimeConfiguration; | 9 import 'runtime_configuration.dart' show RuntimeConfiguration; |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return new Dart2jsCompilerConfiguration( | 72 return new Dart2jsCompilerConfiguration( |
| 73 isDebug: isDebug, | 73 isDebug: isDebug, |
| 74 isChecked: isChecked, | 74 isChecked: isChecked, |
| 75 isHostChecked: isHostChecked, | 75 isHostChecked: isHostChecked, |
| 76 useCps: useCps, | 76 useCps: useCps, |
| 77 useSdk: useSdk, | 77 useSdk: useSdk, |
| 78 isCsp: isCsp, | 78 isCsp: isCsp, |
| 79 useFastStartup: useFastStartup, | 79 useFastStartup: useFastStartup, |
| 80 extraDart2jsOptions: | 80 extraDart2jsOptions: |
| 81 TestUtils.getExtraOptions(configuration, 'dart2js_options')); | 81 TestUtils.getExtraOptions(configuration, 'dart2js_options')); |
| 82 case 'dart2appjit': | 82 case 'app_jit': |
| 83 case 'dart2app': | |
| 84 return new Dart2AppSnapshotCompilerConfiguration( | 83 return new Dart2AppSnapshotCompilerConfiguration( |
| 85 isDebug: isDebug, isChecked: isChecked, useBlobs: useBlobs); | 84 isDebug: isDebug, isChecked: isChecked); |
| 86 case 'precompiler': | 85 case 'precompiler': |
| 87 return new PrecompilerCompilerConfiguration( | 86 return new PrecompilerCompilerConfiguration( |
| 88 isDebug: isDebug, | 87 isDebug: isDebug, |
| 89 isChecked: isChecked, | 88 isChecked: isChecked, |
| 90 arch: configuration['arch'], | 89 arch: configuration['arch'], |
| 91 useBlobs: useBlobs, | 90 useBlobs: useBlobs, |
| 92 isAndroid: configuration['system'] == 'android'); | 91 isAndroid: configuration['system'] == 'android'); |
| 93 case 'dartk': | 92 case 'dartk': |
| 94 return ComposedCompilerConfiguration.createDartKConfiguration( | 93 return ComposedCompilerConfiguration.createDartKConfiguration( |
| 95 isHostChecked: isHostChecked, | 94 isHostChecked: isHostChecked, |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 args.add('--enable_type_checks'); | 693 args.add('--enable_type_checks'); |
| 695 } | 694 } |
| 696 return args | 695 return args |
| 697 ..addAll(vmOptions) | 696 ..addAll(vmOptions) |
| 698 ..addAll(sharedOptions) | 697 ..addAll(sharedOptions) |
| 699 ..addAll(originalArguments); | 698 ..addAll(originalArguments); |
| 700 } | 699 } |
| 701 } | 700 } |
| 702 | 701 |
| 703 class Dart2AppSnapshotCompilerConfiguration extends CompilerConfiguration { | 702 class Dart2AppSnapshotCompilerConfiguration extends CompilerConfiguration { |
| 704 final bool useBlobs; | 703 Dart2AppSnapshotCompilerConfiguration({bool isDebug, bool isChecked}) |
| 705 Dart2AppSnapshotCompilerConfiguration({bool isDebug, bool isChecked, bool useB
lobs}) | 704 : super._subclass(isDebug: isDebug, isChecked: isChecked); |
| 706 : super._subclass(isDebug: isDebug, isChecked: isChecked), this.useBlobs =
useBlobs; | |
| 707 | 705 |
| 708 int computeTimeoutMultiplier() { | 706 int computeTimeoutMultiplier() { |
| 709 int multiplier = 2; | 707 int multiplier = 2; |
| 710 if (isDebug) multiplier *= 4; | 708 if (isDebug) multiplier *= 4; |
| 711 if (isChecked) multiplier *= 2; | 709 if (isChecked) multiplier *= 2; |
| 712 return multiplier; | 710 return multiplier; |
| 713 } | 711 } |
| 714 | 712 |
| 715 CommandArtifact computeCompilationArtifact( | 713 CommandArtifact computeCompilationArtifact( |
| 716 String buildDir, | 714 String buildDir, |
| 717 String tempDir, | 715 String tempDir, |
| 718 CommandBuilder commandBuilder, | 716 CommandBuilder commandBuilder, |
| 719 List arguments, | 717 List arguments, |
| 720 Map<String, String> environmentOverrides) { | 718 Map<String, String> environmentOverrides) { |
| 719 var snapshot = "$tempDir/out.jitsnapshot"; |
| 721 return new CommandArtifact(<Command>[ | 720 return new CommandArtifact(<Command>[ |
| 722 this.computeCompilationCommand(tempDir, buildDir, | 721 this.computeCompilationCommand(tempDir, buildDir, |
| 723 CommandBuilder.instance, arguments, environmentOverrides) | 722 CommandBuilder.instance, arguments, environmentOverrides) |
| 724 ], tempDir, 'application/dart-snapshot'); | 723 ], snapshot, 'application/dart-snapshot'); |
| 725 } | 724 } |
| 726 | 725 |
| 727 CompilationCommand computeCompilationCommand( | 726 CompilationCommand computeCompilationCommand( |
| 728 String tempDir, | 727 String tempDir, |
| 729 String buildDir, | 728 String buildDir, |
| 730 CommandBuilder commandBuilder, | 729 CommandBuilder commandBuilder, |
| 731 List arguments, | 730 List arguments, |
| 732 Map<String, String> environmentOverrides) { | 731 Map<String, String> environmentOverrides) { |
| 733 var exec = "$buildDir/dart"; | 732 var exec = "$buildDir/dart"; |
| 734 var args = new List(); | 733 var args = new List(); |
| 735 args.add("--snapshot=$tempDir/out.jitsnapshot"); | 734 var snapshot = "$tempDir/out.jitsnapshot"; |
| 735 args.add("--snapshot=$snapshot"); |
| 736 args.add("--snapshot-kind=app-jit"); | 736 args.add("--snapshot-kind=app-jit"); |
| 737 if (useBlobs) { | |
| 738 args.add("--use-blobs"); | |
| 739 } | |
| 740 args.addAll(arguments); | 737 args.addAll(arguments); |
| 741 | 738 |
| 742 return commandBuilder.getCompilationCommand( | 739 return commandBuilder.getCompilationCommand( |
| 743 'dart2snapshot', | 740 'app_jit', |
| 744 tempDir, | 741 tempDir, |
| 745 !useSdk, | 742 !useSdk, |
| 746 bootstrapDependencies(buildDir), | 743 bootstrapDependencies(buildDir), |
| 747 exec, | 744 exec, |
| 748 args, | 745 args, |
| 749 environmentOverrides); | 746 environmentOverrides); |
| 750 } | 747 } |
| 751 | 748 |
| 752 List<String> computeCompilerArguments( | 749 List<String> computeCompilerArguments( |
| 753 vmOptions, sharedOptions, originalArguments) { | 750 vmOptions, sharedOptions, originalArguments) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 768 TestInformation info, | 765 TestInformation info, |
| 769 List<String> vmOptions, | 766 List<String> vmOptions, |
| 770 List<String> sharedOptions, | 767 List<String> sharedOptions, |
| 771 List<String> originalArguments, | 768 List<String> originalArguments, |
| 772 CommandArtifact artifact) { | 769 CommandArtifact artifact) { |
| 773 List<String> args = []; | 770 List<String> args = []; |
| 774 if (isChecked) { | 771 if (isChecked) { |
| 775 args.add('--enable_asserts'); | 772 args.add('--enable_asserts'); |
| 776 args.add('--enable_type_checks'); | 773 args.add('--enable_type_checks'); |
| 777 } | 774 } |
| 778 return args | 775 args |
| 779 ..addAll(vmOptions) | 776 ..addAll(vmOptions) |
| 780 ..addAll(sharedOptions) | 777 ..addAll(sharedOptions) |
| 781 ..addAll(originalArguments); | 778 ..addAll(originalArguments); |
| 779 for (var i = 0; i < args.length; i++) { |
| 780 if (args[i].endsWith(".dart")) { |
| 781 args[i] = artifact.filename; |
| 782 } |
| 783 } |
| 784 return args; |
| 782 } | 785 } |
| 783 } | 786 } |
| 784 | 787 |
| 785 class AnalyzerCompilerConfiguration extends CompilerConfiguration { | 788 class AnalyzerCompilerConfiguration extends CompilerConfiguration { |
| 786 AnalyzerCompilerConfiguration( | 789 AnalyzerCompilerConfiguration( |
| 787 {bool isDebug, bool isChecked, bool isStrong, bool isHostChecked, bool | 790 {bool isDebug, bool isChecked, bool isStrong, bool isHostChecked, bool |
| 788 useSdk}) | 791 useSdk}) |
| 789 : super._subclass( | 792 : super._subclass( |
| 790 isDebug: isDebug, | 793 isDebug: isDebug, |
| 791 isChecked: isChecked, | 794 isChecked: isChecked, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 RuntimeConfiguration runtimeConfiguration, | 843 RuntimeConfiguration runtimeConfiguration, |
| 841 String buildDir, | 844 String buildDir, |
| 842 TestInformation info, | 845 TestInformation info, |
| 843 List<String> vmOptions, | 846 List<String> vmOptions, |
| 844 List<String> sharedOptions, | 847 List<String> sharedOptions, |
| 845 List<String> originalArguments, | 848 List<String> originalArguments, |
| 846 CommandArtifact artifact) { | 849 CommandArtifact artifact) { |
| 847 return <String>[]; | 850 return <String>[]; |
| 848 } | 851 } |
| 849 } | 852 } |
| OLD | NEW |