| Index: tools/testing/dart/compiler_configuration.dart
|
| diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
|
| index 668804a361ae5f852b267da6d1aa989aa6664a93..1200392d147219c76aa1bd2adae1c80eb81cc1cc 100644
|
| --- a/tools/testing/dart/compiler_configuration.dart
|
| +++ b/tools/testing/dart/compiler_configuration.dart
|
| @@ -60,6 +60,7 @@ abstract class CompilerConfiguration {
|
| bool isHostChecked = configuration['host_checked'];
|
| bool useSdk = configuration['use_sdk'];
|
| bool isCsp = configuration['csp'];
|
| + bool useCps = configuration['cps_ir'];
|
|
|
| switch (compiler) {
|
| case 'dartanalyzer':
|
| @@ -73,8 +74,8 @@ abstract class CompilerConfiguration {
|
| case 'dart2js':
|
| return new Dart2jsCompilerConfiguration(
|
| isDebug: isDebug, isChecked: isChecked,
|
| - isHostChecked: isHostChecked, useSdk: useSdk, isCsp: isCsp,
|
| - extraDart2jsOptions:
|
| + isHostChecked: isHostChecked, useCps: useCps, useSdk: useSdk,
|
| + isCsp: isCsp, extraDart2jsOptions:
|
| TestUtils.getExtraOptions(configuration, 'dart2js_options'));
|
| case 'dart2dart':
|
| return new Dart2dartCompilerConfiguration(
|
| @@ -225,13 +226,18 @@ class Dart2xCompilerConfiguration extends CompilerConfiguration {
|
| /// Configuration for dart2js compiler.
|
| class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
|
| final bool isCsp;
|
| + final bool useCps;
|
| final List<String> extraDart2jsOptions;
|
| + // We cache the extended environment to save memory.
|
| + static Map<String, String> cpsFlagCache;
|
| + static Map<String, String> environmentOverridesCacheObject;
|
|
|
| Dart2jsCompilerConfiguration({
|
| bool isDebug,
|
| bool isChecked,
|
| bool isHostChecked,
|
| bool useSdk,
|
| + bool this.useCps,
|
| bool this.isCsp,
|
| this.extraDart2jsOptions})
|
| : super(
|
| @@ -247,12 +253,25 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
|
| return multiplier;
|
| }
|
|
|
| + Map<String, String> envWithCpsFlag(Map<String, String> env) {
|
| + if (env != environmentOverridesCacheObject || cpsFlagCache == null) {
|
| + cpsFlagCache = { 'DART_VM_OPTIONS' : '-DUSE_CPS_IR=true' };
|
| + if (env != null) {
|
| + cpsFlagCache.addAll(env);
|
| + }
|
| + environmentOverridesCacheObject = env;
|
| + }
|
| + return cpsFlagCache;
|
| + }
|
| +
|
| CommandArtifact computeCompilationArtifact(
|
| String buildDir,
|
| String tempDir,
|
| CommandBuilder commandBuilder,
|
| List arguments,
|
| Map<String, String> environmentOverrides) {
|
| + var env = useCps ? envWithCpsFlag(environmentOverrides) :
|
| + environmentOverrides;
|
| return new CommandArtifact(
|
| <Command>[
|
| this.computeCompilationCommand(
|
| @@ -260,7 +279,7 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
|
| buildDir,
|
| CommandBuilder.instance,
|
| []..addAll(arguments)..addAll(extraDart2jsOptions),
|
| - environmentOverrides)],
|
| + env)],
|
| '$tempDir/out.js',
|
| 'application/javascript');
|
| }
|
|
|