Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 """Script to create snapshot bin file.""" | 7 """Script to create snapshot bin file.""" |
| 8 | 8 |
| 9 import getopt | 9 import getopt |
| 10 import optparse | 10 import optparse |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 action="store", type="string", | 25 action="store", type="string", |
| 26 help="path to snapshot generator executable") | 26 help="path to snapshot generator executable") |
| 27 result.add_option("--vm_output_bin", | 27 result.add_option("--vm_output_bin", |
| 28 action="store", type="string", | 28 action="store", type="string", |
| 29 help="output file name into which vm isolate snapshot in binary form " + | 29 help="output file name into which vm isolate snapshot in binary form " + |
| 30 "is generated") | 30 "is generated") |
| 31 result.add_option("--output_bin", | 31 result.add_option("--output_bin", |
| 32 action="store", type="string", | 32 action="store", type="string", |
| 33 help="output file name into which isolate snapshot in binary form " + | 33 help="output file name into which isolate snapshot in binary form " + |
| 34 "is generated") | 34 "is generated") |
| 35 result.add_option("--instructions_bin", | |
| 36 action="store", type="string", | |
| 37 help="output file name into which instructions snapshot in binary form " + | |
|
rmacnak
2015/10/21 23:06:18
It's in assembly form, not binary form.
Chinmay
2015/10/22 00:13:17
ack
| |
| 38 "is generated") | |
| 39 result.add_option("--vm_entry_points_manifest", | |
| 40 action="store", type="string", | |
| 41 help="input manifest with the vm entry points in a precompiled snapshot") | |
| 35 result.add_option("--script", | 42 result.add_option("--script", |
| 36 action="store", type="string", | 43 action="store", type="string", |
| 37 help="Dart script for which snapshot is to be generated") | 44 help="Dart script for which snapshot is to be generated") |
| 38 result.add_option("--package_root", | 45 result.add_option("--package_root", |
| 39 action="store", type="string", | 46 action="store", type="string", |
| 40 help="path used to resolve package: imports.") | 47 help="path used to resolve package: imports.") |
| 41 result.add_option("--url_mapping", | 48 result.add_option("--url_mapping", |
| 42 default=[], | 49 default=[], |
| 43 action="append", | 50 action="append", |
| 44 help=("mapping from url to file name, used when generating snapshots " + | 51 help=("mapping from url to file name, used when generating snapshots " + |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 | 108 |
| 102 # Pass along the package_root if there is one. | 109 # Pass along the package_root if there is one. |
| 103 if options.package_root: | 110 if options.package_root: |
| 104 script_args.append(''.join([ "--package_root=", options.package_root])) | 111 script_args.append(''.join([ "--package_root=", options.package_root])) |
| 105 | 112 |
| 106 # First setup the vm isolate and regular isolate snapshot output filename. | 113 # First setup the vm isolate and regular isolate snapshot output filename. |
| 107 script_args.append(''.join([ "--vm_isolate_snapshot=", | 114 script_args.append(''.join([ "--vm_isolate_snapshot=", |
| 108 options.vm_output_bin ])) | 115 options.vm_output_bin ])) |
| 109 script_args.append(''.join([ "--isolate_snapshot=", options.output_bin ])) | 116 script_args.append(''.join([ "--isolate_snapshot=", options.output_bin ])) |
| 110 | 117 |
| 118 # Setup the instuctions snapshot output filename | |
| 119 if options.instructions_bin: | |
| 120 script_args.append(''.join([ "--instructions_snapshot=", | |
| 121 options.instructions_bin ])) | |
| 122 | |
| 123 # Specify the VM entry points snapshot | |
| 124 if options.vm_entry_points_manifest: | |
| 125 script_args.append(''.join([ "--vm_entry_points_manifest=", | |
| 126 options.vm_entry_points_manifest ])) | |
| 127 | |
| 111 # Next setup all url mapping options specified. | 128 # Next setup all url mapping options specified. |
| 112 for url_arg in options.url_mapping: | 129 for url_arg in options.url_mapping: |
| 113 url_mapping_argument = ''.join(["--url_mapping=", url_arg ]) | 130 url_mapping_argument = ''.join(["--url_mapping=", url_arg ]) |
| 114 script_args.append(url_mapping_argument) | 131 script_args.append(url_mapping_argument) |
| 115 | 132 |
| 116 # Finally append the script name if one is specified. | 133 # Finally append the script name if one is specified. |
| 117 if options.script: | 134 if options.script: |
| 118 script_args.append(options.script) | 135 script_args.append(options.script) |
| 119 | 136 |
| 120 # Construct command line to execute the snapshot generator binary and invoke. | 137 # Construct command line to execute the snapshot generator binary and invoke. |
| 121 command = [ options.executable ] + script_args | 138 command = [ options.executable ] + script_args |
| 122 try: | 139 try: |
| 123 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, | 140 utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr, |
| 124 verbose=options.verbose, printErrorInfo=True) | 141 verbose=options.verbose, printErrorInfo=True) |
| 125 except Exception as e: | 142 except Exception as e: |
| 126 return -1 | 143 return -1 |
| 127 | 144 |
| 128 # Success, update timestamp file. | 145 # Success, update timestamp file. |
| 129 CreateTimestampFile(options) | 146 CreateTimestampFile(options) |
| 130 | 147 |
| 131 return 0 | 148 return 0 |
| 132 | 149 |
| 133 | 150 |
| 134 if __name__ == '__main__': | 151 if __name__ == '__main__': |
| 135 sys.exit(Main()) | 152 sys.exit(Main()) |
| OLD | NEW |