source: webkit/trunk/Source/JavaScriptCore/build-symbol-table-index.py@ 174455

Last change on this file since 174455 was 172756, checked in by [email protected], 11 years ago

Merges the two native inlining passes from the build.
Also adds the AvailableExternallyLinkage assertion to linked
functions to allow unused and duplicate ones to be removed.
https://bugs.webkit.org/show_bug.cgi?id=135526

Reviewed by Filip Pizlo.

Removed second generation of llvm binary files.
Fixed the flags on the first pass.

  • build-symbol-table-index.py: Modified some paths.
  • build-symbol-table-index.sh: Removed.
  • copy-llvm-ir-to-derived-sources.sh: Now calls build-symbol-table-index directly.
  • ftl/FTLLowerDFGToLLVM.cpp: Added LLVMAvailableExternallyLinkage assertion.

(JSC::FTL::LowerDFGToLLVM::getModuleByPathForSymbol):

  • runtime/ArrayPrototype.cpp: Removed static declarations.
  • runtime/DateConstructor.cpp: ditto.

(JSC::dateParse):
(JSC::dateNow):
(JSC::dateUTC):

  • runtime/DatePrototype.cpp: ditto.
  • runtime/JSDataViewPrototype.cpp: ditto on both.

(JSC::dataViewProtoFuncGetInt8):
(JSC::dataViewProtoFuncGetInt16):
(JSC::dataViewProtoFuncGetInt32):
(JSC::dataViewProtoFuncGetUint8):
(JSC::dataViewProtoFuncGetUint16):
(JSC::dataViewProtoFuncGetUint32):
(JSC::dataViewProtoFuncGetFloat32):
(JSC::dataViewProtoFuncGetFloat64):
(JSC::dataViewProtoFuncSetInt8):
(JSC::dataViewProtoFuncSetInt16):
(JSC::dataViewProtoFuncSetInt32):
(JSC::dataViewProtoFuncSetUint8):
(JSC::dataViewProtoFuncSetUint16):
(JSC::dataViewProtoFuncSetUint32):
(JSC::dataViewProtoFuncSetFloat32):
(JSC::dataViewProtoFuncSetFloat64):

  • runtime/JSONObject.cpp: ditto.
  • runtime/ObjectConstructor.cpp: ditto.
  • runtime/StringPrototype.cpp: ditto.
  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/usr/bin/python
2
3import glob
4import os
5import subprocess
6import sys
7from sets import Set
8from operator import itemgetter
9
10
11current_arch = sys.argv[1]
12
13print("Building Index Table")
14
15if current_arch not in ("x86_64", "arm64"):
16 sys.exit()
17
18bitcode_file_original_directory = os.path.join(os.getenv("TARGET_TEMP_DIR"), "Objects-" + os.getenv("CURRENT_VARIANT"), current_arch)
19
20if not os.path.isdir(bitcode_file_original_directory):
21 print("Failed to build index table at " + bitcode_file_original_directory)
22 sys.exit()
23
24framework_directory = os.path.join(os.getenv("BUILT_PRODUCTS_DIR"), os.getenv("JAVASCRIPTCORE_RESOURCES_DIR"), "Runtime", current_arch)
25
26
27symbol_table_location = os.path.join(framework_directory, "Runtime.symtbl")
28
29symbol_table = {}
30
31symbol_table_is_out_of_date = False
32
33symbol_table_modification_time = 0
34
35if os.path.isfile(symbol_table_location):
36 symbol_table_modification_time = os.path.getmtime(symbol_table_location)
37
38file_suffix = "bc"
39file_suffix_length = len(file_suffix)
40
41tested_symbols_location = "./tested-symbols.symlst"
42include_symbol_table_location = os.path.join(os.getenv("SHARED_DERIVED_FILE_DIR"), "JavaScriptCore/InlineRuntimeSymbolTable.h")
43
44tested_symbols = Set([])
45
46if os.path.isfile(tested_symbols_location):
47 with open(tested_symbols_location, 'r') as file:
48 print("Loading tested symbols")
49 for line in file:
50 tested_symbols.add(line[:-1])
51
52print ("Original directory: " + bitcode_file_original_directory)
53
54for bitcode_file in glob.iglob(os.path.join(framework_directory, "*." + file_suffix)):
55 bitcode_basename = os.path.basename(bitcode_file)
56 bitcode_file_original = os.path.join(bitcode_file_original_directory, bitcode_basename[:-file_suffix_length] + "o")
57 if os.path.getmtime(bitcode_file_original) < symbol_table_modification_time:
58 continue
59
60 symbol_table_is_out_of_date = True
61
62 print("Appending symbols from " + bitcode_basename)
63 lines = subprocess.check_output(["nm", "-U", "-j", bitcode_file]).splitlines()
64
65 for symbol in lines:
66 if symbol[:2] == "__" and symbol[-3:] != ".eh" and symbol in tested_symbols:
67 symbol_table[symbol[1:]] = bitcode_basename
68
69if not symbol_table_is_out_of_date:
70 sys.exit()
71
72if os.path.isfile(symbol_table_location):
73 with open(symbol_table_location, 'r') as file:
74 print("Loading symbol table")
75 for line in file:
76 symbol, _, location = line[:-1].partition(" ")
77 # don't overwrite new symbols with old locations
78 if not symbol in symbol_table:
79 symbol_table[symbol] = location
80
81symbol_list = symbol_table.items()
82
83print("Writing symbol table: " + symbol_table_location)
84print("Writing inline file: " + include_symbol_table_location)
85
86with open(symbol_table_location, "w") as symbol_file:
87 with open(include_symbol_table_location, "w") as include_file:
88 include_file.write("#define FOR_EACH_LIBRARY_SYMBOL(macro)")
89 for symbol, location in symbol_list:
90 symbol_file.write("{} {}\n".format(symbol, location))
91 include_file.write(" \\\nmacro(\"{}\", \"{}\")".format(symbol, location))
92 include_file.write("\n")
93print("Done")
Note: See TracBrowser for help on using the repository browser.