| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Dart project authors. All rights reserved. | 2 # Copyright 2016 The Dart project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 def HostCpuForArch(arch): | 77 def HostCpuForArch(arch): |
| 78 if arch in ['ia32', 'arm', 'armv6', 'armv5te', | 78 if arch in ['ia32', 'arm', 'armv6', 'armv5te', |
| 79 'simarm', 'simarmv6', 'simarmv5te', 'simdbc', | 79 'simarm', 'simarmv6', 'simarmv5te', 'simdbc', |
| 80 'armsimdbc']: | 80 'armsimdbc']: |
| 81 return 'x86' | 81 return 'x86' |
| 82 if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']: | 82 if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']: |
| 83 return 'x64' | 83 return 'x64' |
| 84 | 84 |
| 85 | 85 |
| 86 # The C compiler's target. |
| 86 def TargetCpuForArch(arch, target_os): | 87 def TargetCpuForArch(arch, target_os): |
| 87 if arch in ['ia32', 'simarm', 'simarmv6', 'simarmv5te']: | 88 if arch in ['ia32', 'simarm', 'simarmv6', 'simarmv5te']: |
| 88 return 'x86' | 89 return 'x86' |
| 89 if arch in ['simarm64']: | 90 if arch in ['x64', 'simarm64']: |
| 90 return 'x64' | 91 return 'x64' |
| 91 if arch == 'simdbc': | 92 if arch == 'simdbc': |
| 92 return 'arm' if target_os == 'android' else 'x86' | 93 return 'arm' if target_os == 'android' else 'x86' |
| 93 if arch == 'simdbc64': | 94 if arch == 'simdbc64': |
| 94 return 'arm64' if target_os == 'android' else 'x64' | 95 return 'arm64' if target_os == 'android' else 'x64' |
| 95 if arch == 'armsimdbc': | 96 if arch == 'armsimdbc': |
| 96 return 'arm' | 97 return 'arm' |
| 97 if arch == 'armsimdbc64': | 98 if arch == 'armsimdbc64': |
| 98 return 'arm64' | 99 return 'arm64' |
| 99 return arch | 100 return arch |
| 100 | 101 |
| 101 | 102 |
| 103 # The Dart compiler's target. |
| 104 def DartTargetCpuForArch(arch): |
| 105 if arch in ['ia32']: |
| 106 return 'ia32' |
| 107 if arch in ['x64']: |
| 108 return 'x64' |
| 109 if arch in ['arm', 'simarm']: |
| 110 return 'arm' |
| 111 if arch in ['armv6', 'simarmv6']: |
| 112 return 'armv6' |
| 113 if arch in ['armv5te', 'simarmv5te']: |
| 114 return 'armv5te' |
| 115 if arch in ['arm64', 'simarm64']: |
| 116 return 'arm64' |
| 117 if arch in ['simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64']: |
| 118 return 'dbc' |
| 119 return arch |
| 120 |
| 121 |
| 102 def HostOsForGn(host_os): | 122 def HostOsForGn(host_os): |
| 103 if host_os.startswith('macos'): | 123 if host_os.startswith('macos'): |
| 104 return 'mac' | 124 return 'mac' |
| 105 if host_os.startswith('win'): | 125 if host_os.startswith('win'): |
| 106 return 'win' | 126 return 'win' |
| 107 return host_os | 127 return host_os |
| 108 | 128 |
| 109 | 129 |
| 110 # Where string_map is formatted as X1=Y1,X2=Y2 etc. | 130 # Where string_map is formatted as X1=Y1,X2=Y2 etc. |
| 111 # If key is X1, returns Y1. | 131 # If key is X1, returns Y1. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 135 | 155 |
| 136 def ToGnArgs(args, mode, arch, target_os): | 156 def ToGnArgs(args, mode, arch, target_os): |
| 137 gn_args = {} | 157 gn_args = {} |
| 138 | 158 |
| 139 host_os = HostOsForGn(HOST_OS) | 159 host_os = HostOsForGn(HOST_OS) |
| 140 if target_os == 'host': | 160 if target_os == 'host': |
| 141 gn_args['target_os'] = host_os | 161 gn_args['target_os'] = host_os |
| 142 else: | 162 else: |
| 143 gn_args['target_os'] = target_os | 163 gn_args['target_os'] = target_os |
| 144 | 164 |
| 145 gn_args['dart_target_arch'] = arch | 165 gn_args['host_cpu'] = HostCpuForArch(arch) |
| 146 gn_args['target_cpu'] = TargetCpuForArch(arch, target_os) | 166 gn_args['target_cpu'] = TargetCpuForArch(arch, target_os) |
| 147 gn_args['host_cpu'] = HostCpuForArch(arch) | 167 gn_args['dart_target_arch'] = DartTargetCpuForArch(arch) |
| 148 crossbuild = gn_args['target_cpu'] != gn_args['host_cpu'] | 168 crossbuild = gn_args['target_cpu'] != gn_args['host_cpu'] |
| 149 | 169 |
| 150 if arch != HostCpuForArch(arch): | 170 if arch != HostCpuForArch(arch): |
| 151 # Training an app-jit snapshot under a simulator is slow. Use script | 171 # Training an app-jit snapshot under a simulator is slow. Use script |
| 152 # snapshots instead. | 172 # snapshots instead. |
| 153 gn_args['dart_snapshot_kind'] = 'script' | 173 gn_args['dart_snapshot_kind'] = 'script' |
| 154 else: | 174 else: |
| 155 gn_args['dart_snapshot_kind'] = 'app-jit' | 175 gn_args['dart_snapshot_kind'] = 'app-jit' |
| 156 | 176 |
| 157 # We only want the fallback root certs in the standalone VM on | 177 # We only want the fallback root certs in the standalone VM on |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 return 1 | 485 return 1 |
| 466 | 486 |
| 467 endtime = time.time() | 487 endtime = time.time() |
| 468 if args.verbose: | 488 if args.verbose: |
| 469 print ("GN Time: %.3f seconds" % (endtime - starttime)) | 489 print ("GN Time: %.3f seconds" % (endtime - starttime)) |
| 470 return 0 | 490 return 0 |
| 471 | 491 |
| 472 | 492 |
| 473 if __name__ == '__main__': | 493 if __name__ == '__main__': |
| 474 sys.exit(Main(sys.argv)) | 494 sys.exit(Main(sys.argv)) |
| OLD | NEW |