OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 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 itertools | 6 import itertools |
7 import js2c | 7 import js2c |
8 import multiprocessing | 8 import multiprocessing |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 for line in self.lines: | 813 for line in self.lines: |
814 result.append(line % filler) | 814 result.append(line % filler) |
815 return result | 815 return result |
816 | 816 |
817 | 817 |
818 # Parses HEADERFILENAME to find out which runtime functions are "inline". | 818 # Parses HEADERFILENAME to find out which runtime functions are "inline". |
819 def FindInlineRuntimeFunctions(): | 819 def FindInlineRuntimeFunctions(): |
820 inline_functions = [] | 820 inline_functions = [] |
821 with open(HEADERFILENAME, "r") as f: | 821 with open(HEADERFILENAME, "r") as f: |
822 inline_list = "#define INLINE_FUNCTION_LIST(F) \\\n" | 822 inline_list = "#define INLINE_FUNCTION_LIST(F) \\\n" |
823 inline_opt_list = "#define INLINE_OPTIMIZED_FUNCTION_LIST(F) \\\n" | |
824 inline_function = re.compile(r"^\s*F\((\w+), \d+, \d+\)\s*\\?") | 823 inline_function = re.compile(r"^\s*F\((\w+), \d+, \d+\)\s*\\?") |
825 mode = "SEARCHING" | 824 mode = "SEARCHING" |
826 for line in f: | 825 for line in f: |
827 if mode == "ACTIVE": | 826 if mode == "ACTIVE": |
828 match = inline_function.match(line) | 827 match = inline_function.match(line) |
829 if match: | 828 if match: |
830 inline_functions.append(match.group(1)) | 829 inline_functions.append(match.group(1)) |
831 if not line.endswith("\\\n"): | 830 if not line.endswith("\\\n"): |
832 mode = "SEARCHING" | 831 mode = "SEARCHING" |
833 elif mode == "SEARCHING": | 832 elif mode == "SEARCHING": |
834 if line == inline_list or line == inline_opt_list: | 833 if line == inline_list: |
835 mode = "ACTIVE" | 834 mode = "ACTIVE" |
836 return inline_functions | 835 return inline_functions |
837 | 836 |
838 | 837 |
839 def ReadFileAndExpandMacros(filename): | 838 def ReadFileAndExpandMacros(filename): |
840 found_macros = {} | 839 found_macros = {} |
841 expanded_lines = [] | 840 expanded_lines = [] |
842 with open(filename, "r") as f: | 841 with open(filename, "r") as f: |
843 found_macro = None | 842 found_macro = None |
844 for line in f: | 843 for line in f: |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 for i in range(len(processes)): | 1305 for i in range(len(processes)): |
1307 processes[i].join() | 1306 processes[i].join() |
1308 except KeyboardInterrupt: | 1307 except KeyboardInterrupt: |
1309 stop_running.set() | 1308 stop_running.set() |
1310 for i in range(len(processes)): | 1309 for i in range(len(processes)): |
1311 processes[i].join() | 1310 processes[i].join() |
1312 return 0 | 1311 return 0 |
1313 | 1312 |
1314 if __name__ == "__main__": | 1313 if __name__ == "__main__": |
1315 sys.exit(Main()) | 1314 sys.exit(Main()) |
OLD | NEW |