Source/JavaScriptCore/ChangeLog

 12015-10-12 Brian Burg <bburg@apple.com>
 2
 3 Restructure generate-js-bindings script to be modular and testable
 4 https://bugs.webkit.org/show_bug.cgi?id=149929
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * DerivedSources.make:
 9 * scripts/codegen/__init__.py: Added.
 10 * scripts/codegen/builtins_generator.py: Added.
 11 (ucfirst):
 12 (BuiltinsGenerator):
 13 (BuiltinsGenerator.__init__):
 14 (BuiltinsGenerator.model):
 15 (BuiltinsGenerator.generate_license):
 16 (BuiltinsGenerator.generate_output):
 17 (BuiltinsGenerator.output_filename):
 18 * scripts/codegen/builtins_model.py: Added.
 19 (lcfirst):
 20 (ParseException):
 21 (Function):
 22 (Function.__init__):
 23 (Function.fromString):
 24 (Function.mangledName):
 25 (Function.mangledNameForCode):
 26 (Function.__str__):
 27 (Builtins):
 28 (Builtins.__init__):
 29 (Builtins.parse_builtins_file):
 30 (Builtins.copyrights):
 31 (Builtins.all_functions):
 32 (Builtins._parse_copyright_lines):
 33 (Builtins._parse_functions):
 34 * scripts/codegen/builtins_templates.py: Added.
 35 (BuiltinsGeneratorTemplates):
 36 (JSCBuiltins_h):
 37 * scripts/codegen/generate_builtins_combined_header.py: Added.
 38 (BuiltinsCombinedHeaderGenerator):
 39 (BuiltinsCombinedHeaderGenerator.__init__):
 40 (BuiltinsCombinedHeaderGenerator.output_filename):
 41 (BuiltinsCombinedHeaderGenerator.generate_output):
 42 (BuiltinsCombinedHeaderGenerator.generate_forward_declarations):
 43 (FunctionExecutable):
 44 (VM):
 45 (ConstructAbility):
 46 (generate_section_for_object):
 47 (generate_externs_for_object):
 48 (generate_macros_for_object):
 49 (generate_defines_for_object):
 50 (generate_section_for_code_table_macro):
 51 (generate_section_for_code_name_macro):
 52 * scripts/codegen/generate_builtins_combined_implementation.py: Added.
 53 (BuiltinsCombinedImplementationGenerator):
 54 (BuiltinsCombinedImplementationGenerator.__init__):
 55 (BuiltinsCombinedImplementationGenerator.output_filename):
 56 (BuiltinsCombinedImplementationGenerator.generate_output):
 57 (BuiltinsCombinedImplementationGenerator.generate_embedded_code_string_sections):
 58 * scripts/codegen/lazywriter.py: Added.
 59 (LazyFileWriter):
 60 (LazyFileWriter.__init__):
 61 (LazyFileWriter.write):
 62 (LazyFileWriter.close):
 63 * scripts/generate-js-builtins.py: Added.
 64 (generate_bindings_for_builtins_files):
 65
1662015-10-11 Yusuke Suzuki <utatane.tea@gmail.com>
267
368 ES6 classes: When a class extends B, super() invokes B.prototype.constructor() instead of B()

Source/JavaScriptCore/DerivedSources.make

@@all : \
7171 udis86_itab.h \
7272 Bytecodes.h \
7373 InitBytecodes.asm \
74  JSCBuiltins \
 74 JSCBuiltins.h \
7575#
7676
77 # builtin functions
7877PYTHON = python
7978PERL = perl
 79JavaScriptCore_SCRIPTS = $(JavaScriptCore)/Scripts
8080
8181ifeq ($(OS),Windows_NT)
8282 DELETE = cmd //C del

@@else
8585endif
8686# --------
8787
88 .PHONY: JSCBuiltins
89 JSCBuiltins: $(JavaScriptCore)/generate-js-builtins JSCBuiltins.h JSCBuiltins.cpp
90 JSCBuiltins.h: $(JavaScriptCore)/generate-js-builtins $(JavaScriptCore)/builtins JSCBuiltinsSources
91  $(PYTHON) $(JavaScriptCore)/generate-js-builtins --input-directory $(JavaScriptCore)/builtins --output $@
92 
93 JSCBuiltins.cpp: JSCBuiltins.h
 88# JavaScript builtins.
 89
 90BUILTINS_GENERATOR_SCRIPTS = \
 91 $(JavaScriptCore_SCRIPTS)/builtins/__init__.py \
 92 $(JavaScriptCore_SCRIPTS)/builtins/builtins_generator.py \
 93 $(JavaScriptCore_SCRIPTS)/builtins/builtins_model.py \
 94 $(JavaScriptCore_SCRIPTS)/builtins/builtins_templates.py \
 95 $(JavaScriptCore_SCRIPTS)/builtins/generate_builtins_combined_header.py \
 96 $(JavaScriptCore_SCRIPTS)/builtins/generate_builtins_combined_implementation.py \
 97 $(JavaScriptCore_SCRIPTS)/builtins/generate_builtins_separate_header.py \
 98 $(JavaScriptCore_SCRIPTS)/builtins/generate_builtins_separate_implementation.py \
 99 $(JavaScriptCore_SCRIPTS)/builtins/generate_builtins_separate_wrapper.py \
 100 $(JavaScriptCore_SCRIPTS)/generate-js-builtins.py \
 101 $(JavaScriptCore_SCRIPTS)/lazywriter.py \
 102#
94103
95 .PHONY: JSCBuiltinsSources
96 JSCBuiltinsSources: \
 104JavaScriptCore_BUILTINS_SOURCES = \
97105 $(JavaScriptCore)/builtins/ArrayConstructor.js \
98106 $(JavaScriptCore)/builtins/ArrayIterator.prototype.js \
99107 $(JavaScriptCore)/builtins/Array.prototype.js \

@@JSCBuiltinsSources: \
110118 $(JavaScriptCore)/builtins/ReflectObject.js \
111119 $(JavaScriptCore)/builtins/StringConstructor.js \
112120 $(JavaScriptCore)/builtins/StringIterator.prototype.js \
 121 $(JavaScriptCore)/builtins/TypedArray.prototype.js \
113122#
114123
 124# The combined output file depends on the contents of builtins and generator scripts, so
 125# adding, modifying, or removing builtins or scripts will trigger regeneration of files.
 126
 127.PHONY: force
 128JavaScriptCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS)/UpdateContents.py force
 129 $(PYTHON) $(JavaScriptCore_SCRIPTS)/UpdateContents.py '$(JavaScriptCore_BUILTINS_SOURCES) $(BUILTINS_GENERATOR_SCRIPTS)' $@
 130
 131JSCBuiltins.h: $(BUILTINS_GENERATOR_SCRIPTS) $(JavaScriptCore_BUILTINS_SOURCES) JavaScriptCore_BUILTINS_DEPENDENCIES_LIST
 132 $(PYTHON) $(JavaScriptCore_SCRIPTS)/generate-js-builtins.py --combined --output-directory . --framework JavaScriptCore $(JavaScriptCore_BUILTINS_SOURCES)
 133
115134# lookup tables for classes
116135
117136%.lut.h: create_hash_table %.cpp

@@all : \
198217# adding, modifying, or removing domains will trigger regeneration of inspector files.
199218
200219.PHONY: force
201 EnabledInspectorDomains : $(JavaScriptCore)/UpdateContents.py force
202  $(PYTHON) $(JavaScriptCore)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
 220EnabledInspectorDomains : $(JavaScriptCore_SCRIPTS)/UpdateContents.py force
 221 $(PYTHON) $(JavaScriptCore_SCRIPTS)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
203222
204223CombinedDomains.json : inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
205224 $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

12061206 969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07950ED1D3AE00F1F681 /* Opcode.h */; settings = {ATTRIBUTES = (Private, ); }; };
12071207 978801401471AD920041B016 /* JSDateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9788FC221471AD0C0068CE2D /* JSDateMath.cpp */; };
12081208 978801411471AD920041B016 /* JSDateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 9788FC231471AD0C0068CE2D /* JSDateMath.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1209 991D5ED41BCC35AA00E4C25D /* generate-js-builtins.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B311BCC23DC007C250D /* generate-js-builtins.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1210 991D5ED51BCC35B100E4C25D /* builtins_generator.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B3B1BCC2491007C250D /* builtins_generator.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1211 991D5ED61BCC35B100E4C25D /* builtins_model.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B3C1BCC2491007C250D /* builtins_model.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1212 991D5ED71BCC35B100E4C25D /* builtins_templates.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B3D1BCC2491007C250D /* builtins_templates.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1213 991D5ED81BCC35B100E4C25D /* generate_builtins_combined_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B3E1BCC2491007C250D /* generate_builtins_combined_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1214 991D5ED91BCC35B100E4C25D /* generate_builtins_combined_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B3F1BCC2491007C250D /* generate_builtins_combined_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1215 991D5EDA1BCC35B100E4C25D /* generate_builtins_separate_header.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B411BCC2B05007C250D /* generate_builtins_separate_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1216 991D5EDB1BCC35B100E4C25D /* generate_builtins_separate_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B421BCC2B05007C250D /* generate_builtins_separate_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1217 991D5EDC1BCC35B100E4C25D /* generate_builtins_separate_wrapper.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B431BCC2B05007C250D /* generate_builtins_separate_wrapper.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1218 991D5EDD1BCC35B300E4C25D /* lazywriter.py in Headers */ = {isa = PBXBuildFile; fileRef = 99044B401BCC2491007C250D /* lazywriter.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1219 991D5EDF1BCC630C00E4C25D /* UpdateContents.py in Headers */ = {isa = PBXBuildFile; fileRef = 991D5EDE1BCC62EA00E4C25D /* UpdateContents.py */; settings = {ATTRIBUTES = (Private, ); }; };
 1220 991D5EE11BCC646900E4C25D /* builtins.py in Headers */ = {isa = PBXBuildFile; fileRef = 991D5EE01BCC641500E4C25D /* builtins.py */; settings = {ATTRIBUTES = (Private, ); }; };
12091221 9928FF3B18AC4AEC00B8CF12 /* JSReplayInputs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9928FF3918AC4AEC00B8CF12 /* JSReplayInputs.cpp */; };
12101222 9928FF3C18AC4AEC00B8CF12 /* JSReplayInputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 9928FF3A18AC4AEC00B8CF12 /* JSReplayInputs.h */; settings = {ATTRIBUTES = (Private, ); }; };
12111223 996231E918D1804200C03FDA /* InspectorBackendCommands.js in Headers */ = {isa = PBXBuildFile; fileRef = A53243961856A475002ED692 /* InspectorBackendCommands.js */; settings = {ATTRIBUTES = (Private, ); }; };

31013113 969A09220ED1E09C00F1F681 /* Completion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Completion.cpp; sourceTree = "<group>"; };
31023114 9788FC221471AD0C0068CE2D /* JSDateMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDateMath.cpp; sourceTree = "<group>"; };
31033115 9788FC231471AD0C0068CE2D /* JSDateMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDateMath.h; sourceTree = "<group>"; };
 3116 99044B311BCC23DC007C250D /* generate-js-builtins.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-js-builtins.py"; sourceTree = "<group>"; };
 3117 99044B3A1BCC2491007C250D /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = "<group>"; };
 3118 99044B3B1BCC2491007C250D /* builtins_generator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_generator.py; sourceTree = "<group>"; };
 3119 99044B3C1BCC2491007C250D /* builtins_model.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_model.py; sourceTree = "<group>"; };
 3120 99044B3D1BCC2491007C250D /* builtins_templates.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins_templates.py; sourceTree = "<group>"; };
 3121 99044B3E1BCC2491007C250D /* generate_builtins_combined_header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generate_builtins_combined_header.py; sourceTree = "<group>"; };
 3122 99044B3F1BCC2491007C250D /* generate_builtins_combined_implementation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generate_builtins_combined_implementation.py; sourceTree = "<group>"; };
 3123 99044B401BCC2491007C250D /* lazywriter.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = lazywriter.py; sourceTree = "<group>"; };
 3124 99044B411BCC2B05007C250D /* generate_builtins_separate_header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generate_builtins_separate_header.py; sourceTree = "<group>"; };
 3125 99044B421BCC2B05007C250D /* generate_builtins_separate_implementation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generate_builtins_separate_implementation.py; sourceTree = "<group>"; };
 3126 99044B431BCC2B05007C250D /* generate_builtins_separate_wrapper.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generate_builtins_separate_wrapper.py; sourceTree = "<group>"; };
 3127 991D5EDE1BCC62EA00E4C25D /* UpdateContents.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = UpdateContents.py; sourceTree = "<group>"; };
 3128 991D5EE01BCC641500E4C25D /* builtins.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = builtins.py; sourceTree = "<group>"; };
31043129 9928FF3918AC4AEC00B8CF12 /* JSReplayInputs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReplayInputs.cpp; sourceTree = "<group>"; };
31053130 9928FF3A18AC4AEC00B8CF12 /* JSReplayInputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReplayInputs.h; sourceTree = "<group>"; };
31063131 9928FF3D18AC4B1C00B8CF12 /* JSInputs.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = JSInputs.json; sourceTree = "<group>"; };

38293854 A7D8019F1880D66E0026C39B /* builtins */,
38303855 969A078F0ED1D3AE00F1F681 /* bytecode */,
38313856 7E39D81D0EC38EFA003AF11A /* bytecompiler */,
3832  1C90513E0BA9E8830081E9D0 /* Configurations */,
38333857 1480DB9A0DDC2231003CFDF2 /* debugger */,
3834  650FDF8D09D0FCA700769E54 /* Derived Sources */,
38353858 86EC9DB31328DF44002B2AD7 /* dfg */,
38363859 0FF4272E158EBCCE004CB9FF /* disassembler */,
3837  0867D69AFE84028FC02AAC07 /* Frameworks */,
38383860 0FEA09FC1705137F00BB722C /* ftl */,
38393861 142E312A134FF0A600AFADB5 /* heap */,
38403862 A5BA15DF1823409200A82E69 /* inspector */,

38433865 0F46809C14BA7F4D00BFE272 /* llint */,
38443866 0FCEFAAD1805CA4400472CE4 /* llvm */,
38453867 7E39D8370EC3A388003AF11A /* parser */,
3846  034768DFFF38A50411DB9C8B /* Products */,
38473868 95AB831A0DA42C6900BC83F3 /* profiler */,
38483869 99E45A0C18A01E930026D88F /* replay */,
3849  932FC3C20824BB70005B3C75 /* Resources */,
38503870 7EF6E0BB0EB7A1EC0079AFAF /* runtime */,
38513871 141211000A48772600480255 /* tests */,
38523872 8603CEF014C753EF00AE59E3 /* tools */,
38533873 7B98D1331B60CD1E0023B1A4 /* wasm */,
38543874 86EAC48C0F93E8B9008EC948 /* yarr */,
 3875 650FDF8D09D0FCA700769E54 /* Derived Sources */,
 3876 99044B301BCC23B2007C250D /* Scripts */,
 3877 932FC3C20824BB70005B3C75 /* Resources */,
 3878 0867D69AFE84028FC02AAC07 /* Frameworks */,
 3879 034768DFFF38A50411DB9C8B /* Products */,
 3880 1C90513E0BA9E8830081E9D0 /* Configurations */,
38553881 );
38563882 name = JavaScriptCore;
38573883 sourceTree = "<group>";

57125738 path = bytecode;
57135739 sourceTree = "<group>";
57145740 };
 5741 99044B301BCC23B2007C250D /* Scripts */ = {
 5742 isa = PBXGroup;
 5743 children = (
 5744 99044B391BCC23FF007C250D /* builtins */,
 5745 99044B311BCC23DC007C250D /* generate-js-builtins.py */,
 5746 99044B401BCC2491007C250D /* lazywriter.py */,
 5747 991D5EDE1BCC62EA00E4C25D /* UpdateContents.py */,
 5748 );
 5749 path = Scripts;
 5750 sourceTree = "<group>";
 5751 };
 5752 99044B391BCC23FF007C250D /* builtins */ = {
 5753 isa = PBXGroup;
 5754 children = (
 5755 99044B3A1BCC2491007C250D /* __init__.py */,
 5756 991D5EE01BCC641500E4C25D /* builtins.py */,
 5757 99044B3B1BCC2491007C250D /* builtins_generator.py */,
 5758 99044B3C1BCC2491007C250D /* builtins_model.py */,
 5759 99044B3D1BCC2491007C250D /* builtins_templates.py */,
 5760 99044B3E1BCC2491007C250D /* generate_builtins_combined_header.py */,
 5761 99044B3F1BCC2491007C250D /* generate_builtins_combined_implementation.py */,
 5762 99044B411BCC2B05007C250D /* generate_builtins_separate_header.py */,
 5763 99044B421BCC2B05007C250D /* generate_builtins_separate_implementation.py */,
 5764 99044B431BCC2B05007C250D /* generate_builtins_separate_wrapper.py */,
 5765 );
 5766 path = builtins;
 5767 sourceTree = "<group>";
 5768 };
57155769 99E45A0C18A01E930026D88F /* replay */ = {
57165770 isa = PBXGroup;
57175771 children = (

60096063 FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */,
60106064 A7D801A51880D66E0026C39B /* BuiltinExecutables.h in Headers */,
60116065 A75EE9B218AAB7E200AAD043 /* BuiltinNames.h in Headers */,
 6066 991D5EE11BCC646900E4C25D /* builtins.py in Headers */,
 6067 991D5ED51BCC35B100E4C25D /* builtins_generator.py in Headers */,
 6068 991D5ED61BCC35B100E4C25D /* builtins_model.py in Headers */,
 6069 991D5ED71BCC35B100E4C25D /* builtins_templates.py in Headers */,
60126070 41DEA1321B9F3163006D65DD /* BuiltinUtils.h in Headers */,
60136071 9E72940B190F0514001A91B5 /* BundlePath.h in Headers */,
60146072 0FB7F39715ED8E4600F167B2 /* Butterfly.h in Headers */,

60366094 0F0B83B914BCF95F00885B4F /* CallReturnOffsetToBytecodeOffset.h in Headers */,
60376095 0F3B7E2B19A11B8000D9BC56 /* CallVariant.h in Headers */,
60386096 0F24E54217EA9F5900ABB217 /* CCallHelpers.h in Headers */,
 6097 0F1C3DDA1BBCE09E00E523E4 /* CellState.h in Headers */,
60396098 BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */,
60406099 0FE050261AA9095600D33B33 /* ClonedArguments.h in Headers */,
60416100 969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */,

61686227 A78A9775179738B8009DF744 /* DFGFailedFinalizer.h in Headers */,
61696228 A7BFF3C0179868940002F462 /* DFGFiltrationResult.h in Headers */,
61706229 A78A9777179738B8009DF744 /* DFGFinalizer.h in Headers */,
6171  7B8329BF1BB21FE300649A6E /* WASMFunctionLLVMIRGenerator.h in Headers */,
61726230 0F2BDC16151C5D4F00CD8910 /* DFGFixupPhase.h in Headers */,
61736231 0F9D339717FFC4E60073C2BC /* DFGFlushedAt.h in Headers */,
6174  0F32BD111BB34F190093A57F /* HeapHelperPool.h in Headers */,
61756232 A7D89CF817A0B8CC00773AD8 /* DFGFlushFormat.h in Headers */,
61766233 0F2DD8151AB3D8BE00BBB8E8 /* DFGForAllKills.h in Headers */,
61776234 0F69CC89193AC60A0045759E /* DFGFrozenValue.h in Headers */,

62406297 0FB17663196B8F9E0091052A /* DFGPureValue.h in Headers */,
62416298 0F3A1BFA1A9ECB7D000DE01A /* DFGPutStackSinkingPhase.h in Headers */,
62426299 86EC9DD11328DF82002B2AD7 /* DFGRegisterBank.h in Headers */,
6243  DEA7E2451BBC677F00D78440 /* JSTypedArrayViewPrototype.h in Headers */,
62446300 0F2FCCFC18A60070001A27F8 /* DFGSafepoint.h in Headers */,
62456301 A77A424317A0BBFD00A8DB81 /* DFGSafeToExecute.h in Headers */,
62466302 A741017F179DAF80002EB8BA /* DFGSaneStringGetByValSlowPathGenerator.h in Headers */,

63846440 A532439418569709002ED692 /* generate-combined-inspector-json.py in Headers */,
63856441 C4703CC0192844960013FBEA /* generate-inspector-protocol-bindings.py in Headers */,
63866442 2DFB8AFE1BB323BD0093D237 /* generate-js-builtins in Headers */,
 6443 991D5ED41BCC35AA00E4C25D /* generate-js-builtins.py in Headers */,
 6444 991D5ED81BCC35B100E4C25D /* generate_builtins_combined_header.py in Headers */,
 6445 991D5ED91BCC35B100E4C25D /* generate_builtins_combined_implementation.py in Headers */,
 6446 991D5EDA1BCC35B100E4C25D /* generate_builtins_separate_header.py in Headers */,
 6447 991D5EDB1BCC35B100E4C25D /* generate_builtins_separate_implementation.py in Headers */,
 6448 991D5EDC1BCC35B100E4C25D /* generate_builtins_separate_wrapper.py in Headers */,
63876449 A5EA70EC19F5B3EA0098F5EC /* generate_cpp_alternate_backend_dispatcher_header.py in Headers */,
63886450 A5EF9B141A1D43F600702E90 /* generate_cpp_backend_dispatcher_header.py in Headers */,
63896451 A5EF9B151A1D43FA00702E90 /* generate_cpp_backend_dispatcher_implementation.py in Headers */,

64206482 142E3138134FF0A600AFADB5 /* HandleStack.h in Headers */,
64216483 1478297B1379E8A800A7C2A3 /* HandleTypes.h in Headers */,
64226484 14BA7A9813AADFF8005B7C2C /* Heap.h in Headers */,
 6485 0F32BD111BB34F190093A57F /* HeapHelperPool.h in Headers */,
64236486 C2DA778318E259990066FCB6 /* HeapInlines.h in Headers */,
64246487 2AD8932B17E3868F00668276 /* HeapIterationScope.h in Headers */,
64256488 2A6F462617E959CE00C45C98 /* HeapOperation.h in Headers */,

65636626 86E3C614167BABD7006D760A /* JSExport.h in Headers */,
65646627 A7B4ACAF1484C9CE00B38A36 /* JSExportMacros.h in Headers */,
65656628 0F2B66EF17B6B5AB00A7AE3F /* JSFloat32Array.h in Headers */,
6566  53917E7B1B7906FA000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h in Headers */,
65676629 0F2B66F017B6B5AB00A7AE3F /* JSFloat64Array.h in Headers */,
65686630 BC18C41F0E16F5CD00B34460 /* JSFunction.h in Headers */,
65696631 A72028BA1797603D0098028C /* JSFunctionInlines.h in Headers */,

65726634 0F2B66F317B6B5AB00A7AE3F /* JSGenericTypedArrayViewConstructorInlines.h in Headers */,
65736635 0F2B66F417B6B5AB00A7AE3F /* JSGenericTypedArrayViewInlines.h in Headers */,
65746636 0F2B66F517B6B5AB00A7AE3F /* JSGenericTypedArrayViewPrototype.h in Headers */,
 6637 53917E7B1B7906FA000EBD33 /* JSGenericTypedArrayViewPrototypeFunctions.h in Headers */,
65756638 0F2B66F617B6B5AB00A7AE3F /* JSGenericTypedArrayViewPrototypeInlines.h in Headers */,
65766639 797E07AA1B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h in Headers */,
65776640 BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */,

66446707 0F2B66FB17B6B5AB00A7AE3F /* JSTypedArrayConstructors.h in Headers */,
66456708 0F2B66FD17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.h in Headers */,
66466709 0F2B66FF17B6B5AB00A7AE3F /* JSTypedArrays.h in Headers */,
 6710 DEA7E2451BBC677F00D78440 /* JSTypedArrayViewPrototype.h in Headers */,
66476711 6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */,
66486712 0F2B670217B6B5AB00A7AE3F /* JSUint16Array.h in Headers */,
66496713 0F2B670317B6B5AB00A7AE3F /* JSUint32Array.h in Headers */,

66676731 969A072A0ED1CE6900F1F681 /* Label.h in Headers */,
66686732 960097A60EBABB58007A7297 /* LabelScope.h in Headers */,
66696733 0FB5467714F59B5C002C2989 /* LazyOperandValueProfile.h in Headers */,
 6734 991D5EDD1BCC35B300E4C25D /* lazywriter.py in Headers */,
66706735 BC18C4520E16F5CD00B34460 /* LegacyProfiler.h in Headers */,
66716736 BC18C4310E16F5CD00B34460 /* Lexer.h in Headers */,
66726737 BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */,

69216986 A7B601821639FD2A00372BA3 /* UnlinkedCodeBlock.h in Headers */,
69226987 14142E511B796ECE00F4BF4B /* UnlinkedFunctionExecutable.h in Headers */,
69236988 0F2E892C16D028AD009E4FD2 /* UnusedPointer.h in Headers */,
 6989 991D5EDF1BCC630C00E4C25D /* UpdateContents.py in Headers */,
69246990 0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */,
6925  0F1C3DDA1BBCE09E00E523E4 /* CellState.h in Headers */,
69266991 0F426A481460CBB300131F8F /* ValueRecovery.h in Headers */,
69276992 79EE0C001B4AFB85000385C9 /* VariableEnvironment.h in Headers */,
69286993 0F6C73511AC9F99F00BE1682 /* VariableWriteFireDetail.h in Headers */,

69346999 7B0247551B8682DD00542440 /* WASMConstants.h in Headers */,
69357000 7BC547D31B6959A100959B58 /* WASMFormat.h in Headers */,
69367001 7B2E010E1B97AA6900EF5D5C /* WASMFunctionCompiler.h in Headers */,
 7002 7B8329BF1BB21FE300649A6E /* WASMFunctionLLVMIRGenerator.h in Headers */,
69377003 7B0247571B8682E400542440 /* WASMFunctionParser.h in Headers */,
69387004 7B0247591B868EB700542440 /* WASMFunctionSyntaxChecker.h in Headers */,
69397005 7B39F76E1B62DE3200360FB4 /* WASMModuleParser.h in Headers */,

77457811 142E3135134FF0A600AFADB5 /* HandleSet.cpp in Sources */,
77467812 142E3137134FF0A600AFADB5 /* HandleStack.cpp in Sources */,
77477813 14BA7A9713AADFF8005B7C2C /* Heap.cpp in Sources */,
 7814 0F32BD101BB34F190093A57F /* HeapHelperPool.cpp in Sources */,
77487815 C24D31E2161CD695002AA4DB /* HeapStatistics.cpp in Sources */,
77497816 C2E526BD1590EF000054E48D /* HeapTimer.cpp in Sources */,
77507817 FE7BA60F1A1A7CEC00F1F7B4 /* HeapVerifier.cpp in Sources */,

79017968 0F2B66FA17B6B5AB00A7AE3F /* JSTypedArrayConstructors.cpp in Sources */,
79027969 0F2B66FC17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.cpp in Sources */,
79037970 0F2B66FE17B6B5AB00A7AE3F /* JSTypedArrays.cpp in Sources */,
 7971 DEA7E2441BBC677200D78440 /* JSTypedArrayViewPrototype.cpp in Sources */,
79047972 86E3C61A167BABEE006D760A /* JSValue.mm in Sources */,
79057973 14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */,
79067974 86E3C61C167BABEE006D760A /* JSVirtualMachine.mm in Sources */,

79748042 0F98206016BFE38100240D02 /* PreciseJumpTargets.cpp in Sources */,
79758043 95742F650DD11F5A000917FB /* Profile.cpp in Sources */,
79768044 95CD45760E1C4FDD0085358E /* ProfileGenerator.cpp in Sources */,
7977  DEA7E2441BBC677200D78440 /* JSTypedArrayViewPrototype.cpp in Sources */,
79788045 95AB83560DA43C3000BC83F3 /* ProfileNode.cpp in Sources */,
79798046 0FF729AD166AD35C000F5BA3 /* ProfilerBytecode.cpp in Sources */,
79808047 0FF729AE166AD35C000F5BA3 /* ProfilerBytecodes.cpp in Sources */,

80818148 0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,
80828149 0FF42743158EBE91004CB9FF /* udis86_input.c in Sources */,
80838150 0FF4274D158EBFE6004CB9FF /* udis86_itab_holder.c in Sources */,
8084  0F32BD101BB34F190093A57F /* HeapHelperPool.cpp in Sources */,
80858151 0FF42745158EBE91004CB9FF /* udis86_syn-att.c in Sources */,
80868152 0FF42746158EBE91004CB9FF /* udis86_syn-intel.c in Sources */,
80878153 0FF42747158EBE91004CB9FF /* udis86_syn.c in Sources */,

Source/JavaScriptCore/Scripts/UpdateContents.py

 1#!/usr/bin/python
 2
 3# Copyright (C) 2015 Apple Inc. All rights reserved.
 4#
 5# Redistribution and use in source and binary forms, with or without
 6# modification, are permitted provided that the following conditions
 7# are met:
 8#
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14# 3. Neither the name of Apple, Inc. ("Apple") nor the names of
 15# its contributors may be used to endorse or promote products derived
 16# from this software without specific prior written permission.
 17#
 18# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 19# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 21# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 22# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 25# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28
 29import sys
 30import os
 31
 32assert(len(sys.argv) == 3)
 33
 34comp = sys.argv[1]
 35filename = sys.argv[2]
 36
 37t = False
 38
 39if os.path.isfile(filename):
 40 f = open(filename, 'r')
 41 comparator = f.read()
 42 f.close()
 43 t = True
 44
 45if (not t or comp != comparator):
 46 f = open(filename, 'w')
 47 f.write(comp)
 48 f.close()

Source/JavaScriptCore/Scripts/builtins/__init__.py

 1# Required for Python to search this directory for module files
 2
 3from builtins import *

Source/JavaScriptCore/Scripts/builtins/builtins.py

 1# This file is used to simulate the builtins/ directory when generate-js-builtins.py
 2# is run from JavaScriptCore framework's private headers directory, which is flattened.
 3
 4from builtins_model import *
 5from builtins_templates import *
 6
 7from builtins_generator import *
 8from generate_builtins_combined_header import *
 9from generate_builtins_combined_implementation import *
 10from generate_builtins_separate_header import *
 11from generate_builtins_separate_implementation import *
 12from generate_builtins_separate_wrapper import *

Source/JavaScriptCore/Scripts/builtins/builtins_generator.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27import logging
 28import os.path
 29import re
 30from string import Template
 31
 32from builtins_templates import BuiltinsGeneratorTemplates as Templates
 33
 34log = logging.getLogger('global')
 35
 36
 37def ucfirst(str):
 38 return str[:1].upper() + str[1:]
 39
 40
 41class BuiltinsGenerator:
 42 def __init__(self, model):
 43 self._model = model
 44
 45 def model(self):
 46 return self._model
 47
 48 def generate_license(self):
 49 raw_license = Template(Templates.LicenseText).substitute(None)
 50 copyrights = self._model.copyrights()
 51 copyrights.sort()
 52
 53 license_block = [];
 54 license_block.append("/*")
 55 for copyright in copyrights:
 56 license_block.append(" * Copyright (c) %s" % copyright)
 57 if len(copyrights) > 0:
 58 license_block.append(" * ")
 59
 60 for line in raw_license.split('\n'):
 61 license_block.append(" * " + line)
 62
 63 license_block.append(" */")
 64
 65 return '\n'.join(license_block)
 66
 67 def generate_includes_from_entries(self, entries):
 68 includes = set()
 69 for entry in entries:
 70 (allowed_framework_names, data) = entry
 71 (framework_name, header_path) = data
 72
 73 if self.model().framework.name not in allowed_framework_names:
 74 continue
 75 if self.model().framework.name != framework_name:
 76 includes.add("#include <%s>" % header_path)
 77 else:
 78 includes.add("#include \"%s\"" % os.path.basename(header_path))
 79
 80 sorted_includes = sorted(list(includes))
 81 name, ext = os.path.splitext(self.output_filename())
 82 if ext is not '.h':
 83 sorted_includes[:0] = [
 84 "#include \"config.h\"",
 85 "#include \"%s.h\"" % name,
 86 "",
 87 ]
 88
 89 return sorted_includes
 90
 91 # These methods are overridden by subclasses.
 92 def generate_output(self):
 93 pass
 94
 95 def output_filename(self):
 96 pass

Source/JavaScriptCore/Scripts/builtins/builtins_model.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2015 Apple Inc. All rights reserved.
 4#
 5# Redistribution and use in source and binary forms, with or without
 6# modification, are permitted provided that the following conditions
 7# are met:
 8# 1. Redistributions of source code must retain the above copyright
 9# notice, this list of conditions and the following disclaimer.
 10# 2. Redistributions in binary form must reproduce the above copyright
 11# notice, this list of conditions and the following disclaimer in the
 12# documentation and/or other materials provided with the distribution.
 13#
 14# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 15# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 16# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 17# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 18# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 19# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 20# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 21# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 22# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 23# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 24# THE POSSIBILITY OF SUCH DAMAGE.
 25
 26import logging
 27import re
 28import os
 29
 30log = logging.getLogger('global')
 31
 32_FRAMEWORK_CONFIG_MAP = {
 33 "Global": {
 34 },
 35 "JavaScriptCore": {
 36 "macro_prefix": "JSC",
 37 "namespace": "JSC"
 38 },
 39 "WebCore": {
 40 "macro_prefix": "WEBCORE",
 41 "namespace": "WebCore"
 42 },
 43 # Used for code generator tests.
 44 "Test": {
 45 }
 46}
 47
 48def lcfirst(str):
 49 return str[:1].lower() + str[1:]
 50
 51
 52functionHeadRegExp = re.compile(r"(?:function|constructor)\s+\w+\s*\(.*?\)", re.MULTILINE | re.S)
 53functionNameRegExp = re.compile(r"(?:function|constructor)\s+(\w+)\s*\(", re.MULTILINE | re.S)
 54functionIsConstructorRegExp = re.compile(r"^constructor", re.MULTILINE | re.S)
 55functionParameterFinder = re.compile(r"^(?:function|constructor)\s+(?:\w+)\s*\(((?:\s*\w+)?\s*(?:\s*,\s*\w+)*)?\s*\)", re.MULTILINE | re.S)
 56
 57multilineCommentRegExp = re.compile(r"\/\*.*?\*\/", re.MULTILINE | re.S)
 58singleLineCommentRegExp = re.compile(r"\/\/.*?\n", re.MULTILINE | re.S)
 59
 60
 61class ParseException(Exception):
 62 pass
 63
 64
 65class Framework:
 66 def __init__(self, name):
 67 self._settings = _FRAMEWORK_CONFIG_MAP[name]
 68 self.name = name
 69
 70 def setting(self, key, default=''):
 71 return self._settings.get(key, default)
 72
 73 @staticmethod
 74 def fromString(frameworkString):
 75 if frameworkString == "Global":
 76 return Frameworks.Global
 77
 78 if frameworkString == "JavaScriptCore":
 79 return Frameworks.JavaScriptCore
 80
 81 if frameworkString == "WebCore":
 82 return Frameworks.WebCore
 83
 84 if frameworkString == "Test":
 85 return Frameworks.Test
 86
 87 raise ParseException("Unknown framework: %s" % frameworkString)
 88
 89
 90class Frameworks:
 91 Global = Framework("Global")
 92 JavaScriptCore = Framework("JavaScriptCore")
 93 WebCore = Framework("WebCore")
 94 Test = Framework("Test")
 95
 96class BuiltinObject:
 97 def __init__(self, object_name, functions):
 98 self.object_name = object_name
 99 self.functions = functions
 100 self.collection = None # Set by the owning BuiltinsCollection
 101
 102class BuiltinFunction:
 103 def __init__(self, function_name, function_source, is_constructor, parameters):
 104 self.function_name = function_name
 105 self.function_source = function_source
 106 self.is_constructor = is_constructor
 107 self.parameters = parameters
 108 self.object = None # Set by the owning BuiltinObject
 109
 110 @staticmethod
 111 def fromString(function_string):
 112 function_source = multilineCommentRegExp.sub("", function_string)
 113 function_name = functionNameRegExp.findall(function_source)[0]
 114 is_constructor = functionIsConstructorRegExp.match(function_source) != None
 115 parameters = [s.strip() for s in functionParameterFinder.findall(function_source)[0].split(',')]
 116 if len(parameters[0]) == 0:
 117 parameters = []
 118
 119 return BuiltinFunction(function_name, function_source, is_constructor, parameters)
 120
 121 def mangledName(self):
 122 qName = "%s.%s" % (self.object, self.function_name)
 123 mangledName = ""
 124 i = 0
 125 while i < len(qName):
 126 if qName[i] == '.':
 127 mangledName = mangledName + qName[i + 1].upper()
 128 i = i + 1
 129 else:
 130 mangledName = mangledName + qName[i]
 131 i = i + 1
 132 if self.is_constructor:
 133 mangledName = mangledName + "Constructor"
 134 return mangledName
 135
 136 def mangledNameForCode(self):
 137 return lcfirst(self.mangledName()) + "Code"
 138
 139 def __str__(self):
 140 interface = "%s(%s)" % (self.function_name, ', '.join(self.parameters))
 141 if self.is_constructor:
 142 interface = interface + " [Constructor]"
 143
 144 return interface
 145
 146class BuiltinsCollection:
 147 def __init__(self, framework_name):
 148 self._copyright_lines = set()
 149 self.objects = []
 150 self.framework = Framework.fromString(framework_name)
 151 log.debug("Created new Builtins collection.")
 152
 153 def parse_builtins_file(self, filename, text):
 154 log.debug("Parsing builtins file: %s" % filename)
 155
 156 parsed_copyrights = set(self._parse_copyright_lines(text))
 157 self._copyright_lines = self._copyright_lines.union(parsed_copyrights)
 158
 159 log.debug("Found copyright lines:")
 160 for line in self._copyright_lines:
 161 log.debug(line);
 162 log.debug("")
 163
 164 object_name, ext = os.path.splitext(os.path.basename(filename))
 165 log.debug("Parsing object: %s" % object_name)
 166
 167 parsed_functions = self._parse_functions(text)
 168 for function in parsed_functions:
 169 function.object = object_name
 170
 171 log.debug("Parsed functions:")
 172 for func in parsed_functions:
 173 log.debug(func)
 174 log.debug("")
 175
 176 new_object = BuiltinObject(object_name, parsed_functions)
 177 new_object.collection = self
 178 self.objects.append(new_object)
 179
 180 def copyrights(self):
 181 owner_to_years = dict()
 182 copyrightYearRegExp = re.compile(r"(\d{4})[, ]{0,2}")
 183 ownerStartRegExp = re.compile(r"[^\d, ]")
 184
 185 # Returns deduplicated copyrights keyed on the owner.
 186 for line in self._copyright_lines:
 187 years = set(copyrightYearRegExp.findall(line))
 188 ownerIndex = ownerStartRegExp.search(line).start()
 189 owner = line[ownerIndex:]
 190 log.debug("Found years: %s and owner: %s" % (years, owner))
 191 if owner not in owner_to_years:
 192 owner_to_years[owner] = set()
 193
 194 owner_to_years[owner] = owner_to_years[owner].union(years)
 195
 196 result = []
 197
 198 for owner, years in owner_to_years.items():
 199 sorted_years = list(years)
 200 sorted_years.sort()
 201 result.append("%s %s" % (', '.join(sorted_years), owner))
 202
 203 return result
 204
 205 def all_functions(self):
 206 result = []
 207 for object in self.objects:
 208 result.extend(object.functions)
 209
 210 result.sort()
 211 return result
 212
 213 # Private methods.
 214
 215 def _parse_copyright_lines(self, text):
 216 licenseBlock = multilineCommentRegExp.findall(text)[0]
 217 licenseBlock = licenseBlock[:licenseBlock.index("Redistribution")]
 218
 219 copyrightLines = []
 220 for line in licenseBlock.split("\n"):
 221 line = line.replace("/*", "")
 222 line = line.replace("*/", "")
 223 line = line.replace("*", "")
 224 line = line.replace("Copyright", "")
 225 line = line.replace("copyright", "")
 226 line = line.replace("(C)", "")
 227 line = line.replace("(c)", "")
 228 line = line.strip();
 229
 230 if len(line) == 0:
 231 continue
 232
 233 copyrightLines.append(line)
 234
 235 return copyrightLines
 236
 237 def _parse_functions(self, text):
 238 text = multilineCommentRegExp.sub("/**/", singleLineCommentRegExp.sub("//\n", text))
 239
 240 matches = [func for func in functionHeadRegExp.finditer(text)]
 241 functionBounds = []
 242 start = 0
 243 end = 0
 244 for match in matches:
 245 start = match.start()
 246 if start < end:
 247 continue
 248 end = match.end()
 249 while text[end] != '{':
 250 end = end + 1
 251 depth = 1
 252 end = end + 1
 253 while depth > 0:
 254 if text[end] == '{':
 255 depth = depth + 1
 256 elif text[end] == '}':
 257 depth = depth - 1
 258 end = end + 1
 259 functionBounds.append((start, end))
 260
 261 functionStrings = [text[start:end].strip() for (start, end) in functionBounds]
 262 return map(BuiltinFunction.fromString, functionStrings);

Source/JavaScriptCore/Scripts/builtins/builtins_templates.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2015 Apple Inc. All rights reserved.
 4#
 5# Redistribution and use in source and binary forms, with or without
 6# modification, are permitted provided that the following conditions
 7# are met:
 8# 1. Redistributions of source code must retain the above copyright
 9# notice, this list of conditions and the following disclaimer.
 10# 2. Redistributions in binary form must reproduce the above copyright
 11# notice, this list of conditions and the following disclaimer in the
 12# documentation and/or other materials provided with the distribution.
 13#
 14# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 15# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 16# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 17# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 18# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 19# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 20# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 21# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 22# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 23# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 24# THE POSSIBILITY OF SUCH DAMAGE.
 25
 26# Builtins generator templates, which can be filled with string.Template.
 27
 28class BuiltinsGeneratorTemplates:
 29
 30 LicenseText = (
 31 """Redistribution and use in source and binary forms, with or without
 32modification, are permitted provided that the following conditions
 33are met:
 341. Redistributions of source code must retain the above copyright
 35 notice, this list of conditions and the following disclaimer.
 362. Redistributions in binary form must reproduce the above copyright
 37 notice, this list of conditions and the following disclaimer in the
 38 documentation and/or other materials provided with the distribution.
 39
 40THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 41AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 42THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 43PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 44BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 45CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 46SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 47INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 48CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 49ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 50THE POSSIBILITY OF SUCH DAMAGE.
 51""")
 52
 53 DoNotEditWarning = (
 54 """// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
 55// builtins by the script: Source/JavaScriptCore/scripts/generate-js-builtins.py""")
 56
 57 HeaderIncludeGuardTop = (
 58 """#ifndef ${headerGuard}
 59#define ${headerGuard}""")
 60
 61 HeaderIncludeGuardBottom = (
 62 """#endif // JSCBuiltins_h
 63""")
 64
 65 NamespaceTop = (
 66 """namespace ${namespace} {""")
 67
 68 NamespaceBottom = (
 69 """} // namespace ${namespace}""")
 70
 71 CombinedHeaderStaticMacros = (
 72 """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
 73 JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
 74
 75${macroPrefix}_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
 76#undef DECLARE_BUILTIN_GENERATOR
 77
 78#define ${macroPrefix}_BUILTIN_EXISTS(object, func) defined ${macroPrefix}_BUILTIN_ ## object ## _ ## func""")
 79
 80 SeparateHeaderStaticMacros = (
 81 """#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
 82 JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
 83
 84${macroPrefix}_FOREACH_${objectName}_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
 85#undef DECLARE_BUILTIN_GENERATOR
 86
 87#define ${macroPrefix}_BUILTIN_${objectName}_EXISTS(object, func) defined ${macroPrefix}_BUILTIN_ ## object ## _ ## func""")
 88
 89 CombinedJSCImplementationStaticMacros = (
 90 """
 91#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
 92JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
 93{\\
 94 return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); \
 95}
 96${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 97#undef DEFINE_BUILTIN_GENERATOR
 98""")
 99
 100 SeparateJSCImplementationStaticMacros = (
 101 """
 102#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \\
 103JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \\
 104{\\
 105 return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source()); \
 106}
 107${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 108#undef DEFINE_BUILTIN_GENERATOR
 109""")
 110
 111 CombinedWebCoreImplementationStaticMacros = (
 112 """
 113#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
 114JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 115{\
 116 JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
 117 return clientData->readableStreamBuiltins().codeName##Executable()->link(vm, clientData->readableStreamBuiltins().codeName##Source()); \
 118}
 119${macroPrefix}_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 120#undef DEFINE_BUILTIN_GENERATOR
 121""")
 122
 123 SeparateWebCoreImplementationStaticMacros = (
 124 """
 125#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, argumentCount) \
 126JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
 127{\
 128 JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \
 129 return clientData->readableStreamBuiltins().codeName##Executable()->link(vm, clientData->readableStreamBuiltins().codeName##Source()); \
 130}
 131${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
 132#undef DEFINE_BUILTIN_GENERATOR
 133""")
 134
 135 SeparateWrapperHeaderBoilerplate = (
 136 """class ${objectName}BuiltinsWrapper : private JSC::WeakHandleOwner {
 137public:
 138 explicit ${objectName}BuiltinsWrapper(JSC::VM* vm)
 139 : m_vm(*vm)
 140 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
 141#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(JSC::makeSource(StringImpl::createFromLiteral(s_##name, length)))
 142 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
 143#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
 144 {
 145 }
 146
 147#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, length) \\
 148 JSC::UnlinkedFunctionExecutable* name##Executable(); \\
 149 const JSC::SourceCode& name##Source() const { return m_##name##Source; }
 150 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
 151#undef EXPOSE_BUILTIN_EXECUTABLES
 152
 153 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
 154
 155 void exportNames();
 156
 157private:
 158 JSC::VM& m_vm;
 159
 160 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
 161
 162#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) \\
 163 JSC::SourceCode m_##name##Source;\\
 164 JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable;
 165 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
 166#undef DECLARE_BUILTIN_SOURCE_MEMBERS
 167
 168};
 169
 170#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, length) \\
 171inline JSC::UnlinkedFunctionExecutable* ${objectName}BuiltinsWrapper::name##Executable() \\
 172{\\
 173 if (!m_##name##Executable)\\
 174 m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\\
 175 return m_##name##Executable.get();\\
 176}
 177${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
 178#undef DEFINE_BUILTIN_EXECUTABLES
 179
 180inline void ${objectName}BuiltinsWrapper::exportNames()
 181{
 182#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName());
 183 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME)
 184#undef EXPORT_FUNCTION_NAME
 185}
 186
 187class ${objectName}BuiltinFunctions {
 188public:
 189 explicit ${objectName}BuiltinFunctions(JSC::VM& vm) : m_vm(vm) { }
 190
 191 void init(JSC::JSGlobalObject&);
 192 void visit(JSC::SlotVisitor&);
 193
 194public:
 195 JSC::VM& m_vm;
 196
 197#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \\
 198 JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function;
 199 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS)
 200#undef DECLARE_BUILTIN_SOURCE_MEMBERS
 201};
 202
 203inline void ${objectName}BuiltinFunctions::init(JSC::JSGlobalObject& globalObject)
 204{
 205#define EXPORT_FUNCTION(codeName, functionName, length)\\
 206 m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::createBuiltinFunction(m_vm, codeName##Generator(m_vm), &globalObject));
 207 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(EXPORT_FUNCTION)
 208#undef EXPORT_FUNCTION
 209}
 210
 211inline void ${objectName}BuiltinFunctions::visit(JSC::SlotVisitor& visitor)
 212{
 213#define VISIT_FUNCTION(name) visitor.append(&m_##name##Function);
 214 ${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION)
 215#undef VISIT_FUNCTION
 216}
 217""")

Source/JavaScriptCore/Scripts/builtins/generate_builtins_combined_header.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27
 28import logging
 29import re
 30import string
 31from string import Template
 32
 33from builtins_generator import BuiltinsGenerator
 34from builtins_templates import BuiltinsGeneratorTemplates as Templates
 35
 36log = logging.getLogger('global')
 37
 38
 39class BuiltinsCombinedHeaderGenerator(BuiltinsGenerator):
 40 def __init__(self, model):
 41 BuiltinsGenerator.__init__(self, model)
 42
 43 def output_filename(self):
 44 return "%sBuiltins.h" % self.model().framework.setting('namespace')
 45
 46 def generate_output(self):
 47 args = {
 48 'namespace': self.model().framework.setting('namespace'),
 49 'headerGuard': self.output_filename().replace('.', '_'),
 50 'macroPrefix': self.model().framework.setting('macro_prefix'),
 51 }
 52
 53 sections = []
 54 sections.append(self.generate_license())
 55 sections.append(Template(Templates.DoNotEditWarning).substitute(args))
 56 sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
 57 sections.append(self.generate_forward_declarations())
 58 sections.append(Template(Templates.NamespaceTop).substitute(args))
 59 for object in self.model().objects:
 60 sections.append(self.generate_section_for_object(object))
 61 sections.append(self.generate_section_for_code_table_macro())
 62 sections.append(self.generate_section_for_code_name_macro())
 63 sections.append(Template(Templates.CombinedHeaderStaticMacros).substitute(args))
 64 sections.append(Template(Templates.NamespaceBottom).substitute(args))
 65 sections.append(Template(Templates.HeaderIncludeGuardBottom).substitute(args))
 66
 67 return "\n\n".join(sections)
 68
 69 def generate_forward_declarations(self):
 70 return """namespace JSC {
 71class FunctionExecutable;
 72class VM;
 73
 74enum class ConstructAbility : unsigned;
 75}"""
 76
 77 def generate_section_for_object(self, object):
 78 lines = []
 79 lines.append('/* %s */' % object.object_name)
 80 lines.extend(self.generate_externs_for_object(object))
 81 lines.append("")
 82 lines.extend(self.generate_macros_for_object(object))
 83 lines.append("")
 84 lines.extend(self.generate_defines_for_object(object))
 85 return '\n'.join(lines)
 86
 87 def generate_externs_for_object(self, object):
 88 lines = []
 89
 90 for function in object.functions:
 91 function_args = {
 92 'codeName': function.mangledNameForCode()
 93 }
 94
 95 lines.append("""extern const char* s_%(codeName)s;
 96extern const int s_%(codeName)sLength;
 97extern const JSC::ConstructAbility s_%(codeName)sConstructAbility;""" % function_args)
 98
 99 return lines
 100
 101 def generate_macros_for_object(self, object):
 102 args = {
 103 'macroPrefix': self.model().framework.setting('macro_prefix'),
 104 'objectMacro': object.object_name.replace('.', '').upper()
 105 }
 106
 107 lines = []
 108 lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_DATA(macro) \\" % args)
 109 for function in object.functions:
 110 function_args = {
 111 'funcName': function.function_name,
 112 'mangledName': function.mangledName(),
 113 'paramCount': len(function.parameters)
 114 }
 115
 116 lines.append(" macro(%(funcName)s, %(mangledName)s, %(paramCount)d) \\" % function_args)
 117 return lines
 118
 119 def generate_defines_for_object(self, object):
 120 lines = []
 121 for function in object.functions:
 122 args = {
 123 'macroPrefix': self.model().framework.setting('macro_prefix'),
 124 'objectMacro': object.object_name.replace('.', '').upper(),
 125 'functionMacro': function.function_name.upper()
 126 }
 127 lines.append("#define %(macroPrefix)s_BUILTIN_%(objectMacro)s_%(functionMacro)s 1" % args)
 128
 129 return lines
 130
 131 def generate_section_for_code_table_macro(self):
 132 args = {
 133 'macroPrefix': self.model().framework.setting('macro_prefix'),
 134 }
 135
 136 lines = []
 137 lines.append("#define %(macroPrefix)s_FOREACH_BUILTIN_CODE(macro) \\" % args)
 138 for function in self.model().all_functions():
 139 function_args = {
 140 'funcName': function.function_name,
 141 'codeName': function.mangledNameForCode()
 142 }
 143
 144 lines.append(" macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)
 145 return '\n'.join(lines)
 146
 147 def generate_section_for_code_name_macro(self):
 148 args = {
 149 'macroPrefix': self.model().framework.setting('macro_prefix'),
 150 }
 151
 152 lines = []
 153 lines.append("#define %(macroPrefix)s_FOREACH_BUILTIN_FUNCTION_NAME(macro) \\" % args)
 154 unique_names = list(set([function.function_name for function in self.model().all_functions()]))
 155 unique_names.sort()
 156 for function_name in unique_names:
 157 function_args = {
 158 'funcName': function_name,
 159 }
 160
 161 lines.append(" macro(%(funcName)s) \\" % function_args)
 162 return '\n'.join(lines)

Source/JavaScriptCore/Scripts/builtins/generate_builtins_combined_implementation.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27
 28import logging
 29import re
 30import string
 31from string import Template
 32import json
 33
 34from builtins_generator import BuiltinsGenerator, ucfirst
 35from builtins_model import Framework, Frameworks
 36from builtins_templates import BuiltinsGeneratorTemplates as Templates
 37
 38log = logging.getLogger('global')
 39
 40
 41class BuiltinsCombinedImplementationGenerator(BuiltinsGenerator):
 42 def __init__(self, model):
 43 BuiltinsGenerator.__init__(self, model)
 44
 45 def output_filename(self):
 46 return "%sBuiltins.cpp" % self.model().framework.setting('namespace')
 47
 48 def generate_output(self):
 49 args = {
 50 'namespace': self.model().framework.setting('namespace'),
 51 'macroPrefix': self.model().framework.setting('macro_prefix'),
 52 }
 53
 54 sections = []
 55 sections.append(self.generate_license())
 56 sections.append(Template(Templates.DoNotEditWarning).substitute(args))
 57 sections.append(self.generate_header_includes())
 58 sections.append(Template(Templates.NamespaceTop).substitute(args))
 59 sections.extend(self.generate_embedded_code_string_sections())
 60 if self.model().framework is Frameworks.JavaScriptCore:
 61 sections.append(Template(Templates.CombinedJSCImplementationStaticMacros).substitute(args))
 62 elif self.model().framework is Frameworks.WebCore:
 63 sections.append(Template(Templates.CombinedWebCoreImplementationStaticMacros).substitute(args))
 64 sections.append(Template(Templates.NamespaceBottom).substitute(args))
 65
 66 return "\n\n".join(sections)
 67
 68 def generate_header_includes(self):
 69 header_includes = [
 70 (["JavaScriptCore"],
 71 ("JavaScriptCore", "builtins/BuiltinExecutables.h")
 72 ),
 73 (["JavaScriptCore", "WebCore"],
 74 ("JavaScriptCore", "runtime/Executable.h")
 75 ),
 76 (["JavaScriptCore", "WebCore"],
 77 ("JavaScriptCore", "runtime/JSCellInlines.h")
 78 ),
 79 (["WebCore"],
 80 ("JavaScriptCore", "runtime/StructureInlines.h")
 81 ),
 82 (["WebCore"],
 83 ("JavaScriptCore", "runtime/JSCJSValueInlines.h")
 84 ),
 85 (["JavaScriptCore", "WebCore"],
 86 ("JavaScriptCore", "runtime/VM.h")
 87 ),
 88 ];
 89
 90 return '\n'.join(self.generate_includes_from_entries(header_includes))
 91
 92 def generate_embedded_code_string_sections(self):
 93 subsections = []
 94 for function in self.model().all_functions():
 95 text = function.function_source
 96 # Wrap it in parens to avoid adding to global scope.
 97 text = "(function " + text[text.index("("):] + ")"
 98 # Lazy way to escape quotes, I think?
 99 textLines = json.dumps(text)[1:-1].split("\\n")
 100 # This looks scary because we need the JS source itself to have newlines.
 101 embeddedSource = '\n'.join([' "%s\\n" \\' % line for line in textLines])
 102
 103 constructAbility = "CannotConstruct"
 104 if function.is_constructor:
 105 constructAbility = "CanConstruct"
 106
 107 args = {
 108 'codeName': function.mangledNameForCode(),
 109 'embeddedSource': embeddedSource,
 110 'embeddedSourceLength': len(embeddedSource) + 1,
 111 'canConstruct': constructAbility
 112 }
 113
 114 lines = []
 115 lines.append("const JSC::ConstructAbility s_%(codeName)sConstructAbility = JSC::ConstructAbility::%(canConstruct)s;" % args);
 116 lines.append("const int s_%(codeName)sLength = %(embeddedSourceLength)d;" % args);
 117 lines.append("const char* s_%(codeName)s =\n%(embeddedSource)s\n;" % args);
 118 subsections.append('\n'.join(lines))
 119
 120 return subsections

Source/JavaScriptCore/Scripts/builtins/generate_builtins_separate_header.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27
 28import logging
 29import re
 30import string
 31from string import Template
 32
 33from builtins_generator import BuiltinsGenerator
 34from builtins_templates import BuiltinsGeneratorTemplates as Templates
 35
 36log = logging.getLogger('global')
 37
 38# These are formatted as ([allowed_frameworks], (framework, header_path)).
 39# The generator can figure out how to format the includes.
 40
 41class BuiltinsSeparateHeaderGenerator(BuiltinsGenerator):
 42 def __init__(self, model, object):
 43 BuiltinsGenerator.__init__(self, model)
 44 self.object = object
 45
 46 def output_filename(self):
 47 return "%sBuiltins.h" % self.object.object_name
 48
 49 def macro_prefix(self):
 50 return self.model().framework.setting('macro_prefix')
 51
 52 def generate_output(self):
 53 args = {
 54 'namespace': self.model().framework.setting('namespace'),
 55 'headerGuard': self.output_filename().replace('.', '_'),
 56 'macroPrefix': self.macro_prefix(),
 57 'objectName': self.object.object_name.upper(),
 58 }
 59
 60 sections = []
 61 sections.append(self.generate_license())
 62 sections.append(Template(Templates.DoNotEditWarning).substitute(args))
 63 sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
 64 sections.append(self.generate_header_includes())
 65 sections.append(self.generate_forward_declarations())
 66 sections.append(Template(Templates.NamespaceTop).substitute(args))
 67 sections.append(self.generate_section_for_object(self.object))
 68 sections.append(self.generate_section_for_code_table_macro())
 69 sections.append(self.generate_section_for_code_name_macro())
 70 sections.append(Template(Templates.SeparateHeaderStaticMacros).substitute(args))
 71 sections.append(Template(Templates.NamespaceBottom).substitute(args))
 72 sections.append(Template(Templates.HeaderIncludeGuardBottom).substitute(args))
 73
 74 return "\n\n".join(sections)
 75
 76 def generate_forward_declarations(self):
 77 return """namespace JSC {
 78class FunctionExecutable;
 79}"""
 80
 81 def generate_header_includes(self):
 82 header_includes = [
 83 (["WebCore"],
 84 ("JavaScriptCore", "builtins/BuiltinUtils.h")
 85 ),
 86 ];
 87
 88 return '\n'.join(self.generate_includes_from_entries(header_includes))
 89
 90 def generate_section_for_object(self, object):
 91 lines = []
 92 lines.append('/* %s */' % object.object_name)
 93 lines.extend(self.generate_externs_for_object(object))
 94 lines.append("")
 95 lines.extend(self.generate_macros_for_object(object))
 96 lines.append("")
 97 lines.extend(self.generate_defines_for_object(object))
 98 return '\n'.join(lines)
 99
 100 def generate_externs_for_object(self, object):
 101 lines = []
 102
 103 for function in object.functions:
 104 function_args = {
 105 'codeName': function.mangledNameForCode(),
 106 }
 107
 108 lines.append("""extern const char* s_%(codeName)s;
 109extern const int s_%(codeName)sLength;
 110extern const JSC::ConstructAbility s_%(codeName)sConstructAbility;""" % function_args)
 111
 112 return lines
 113
 114 def generate_macros_for_object(self, object):
 115 args = {
 116 'macroPrefix': self.macro_prefix(),
 117 'objectMacro': object.object_name.replace('.', '_').upper(),
 118 }
 119
 120 lines = []
 121 lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_DATA(macro) \\" % args)
 122 for function in object.functions:
 123 function_args = {
 124 'funcName': function.function_name,
 125 'mangledName': function.mangledName(),
 126 'paramCount': len(function.parameters),
 127 }
 128
 129 lines.append(" macro(%(funcName)s, %(mangledName)s, %(paramCount)d) \\" % function_args)
 130 return lines
 131
 132 def generate_defines_for_object(self, object):
 133 lines = []
 134 for function in object.functions:
 135 args = {
 136 'macroPrefix': self.macro_prefix(),
 137 'objectMacro': object.object_name.replace('.', '_').upper(),
 138 'functionMacro': function.function_name.upper()
 139 }
 140 lines.append("#define %(macroPrefix)s_BUILTIN_%(objectMacro)s_%(functionMacro)s 1" % args)
 141
 142 return lines
 143
 144 def generate_section_for_code_table_macro(self):
 145 args = {
 146 'macroPrefix': self.model().framework.setting('macro_prefix'),
 147 'objectMacro': self.object.object_name.upper(),
 148 }
 149
 150 lines = []
 151 lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_CODE(macro) \\" % args)
 152 for function in self.object.functions:
 153 function_args = {
 154 'funcName': function.function_name,
 155 'codeName': function.mangledNameForCode(),
 156 }
 157
 158 lines.append(" macro(%(codeName)s, %(funcName)s, s_%(codeName)sLength) \\" % function_args)
 159 return '\n'.join(lines)
 160
 161 def generate_section_for_code_name_macro(self):
 162 args = {
 163 'macroPrefix': self.macro_prefix(),
 164 'objectMacro': self.object.object_name.upper(),
 165 }
 166
 167 lines = []
 168 lines.append("#define %(macroPrefix)s_FOREACH_%(objectMacro)s_BUILTIN_FUNCTION_NAME(macro) \\" % args)
 169 unique_names = list(set([function.function_name for function in self.object.functions]))
 170 unique_names.sort()
 171 for function_name in unique_names:
 172 function_args = {
 173 'funcName': function_name,
 174 }
 175
 176 lines.append(" macro(%(funcName)s) \\" % function_args)
 177 return '\n'.join(lines)

Source/JavaScriptCore/Scripts/builtins/generate_builtins_separate_implementation.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27
 28import logging
 29import re
 30import string
 31from string import Template
 32import json
 33
 34from builtins_generator import BuiltinsGenerator, ucfirst
 35from builtins_model import Framework, Frameworks
 36from builtins_templates import BuiltinsGeneratorTemplates as Templates
 37
 38log = logging.getLogger('global')
 39
 40
 41class BuiltinsSeparateImplementationGenerator(BuiltinsGenerator):
 42 def __init__(self, model, object):
 43 BuiltinsGenerator.__init__(self, model)
 44 self.object = object
 45
 46 def output_filename(self):
 47 return "%sBuiltins.cpp" % self.object.object_name
 48
 49 def macro_prefix(self):
 50 return self.model().framework.setting('macro_prefix')
 51
 52 def generate_output(self):
 53 args = {
 54 'namespace': self.model().framework.setting('namespace'),
 55 'macroPrefix': self.macro_prefix(),
 56 'objectMacro': self.object.object_name.upper(),
 57 }
 58
 59 sections = []
 60 sections.append(self.generate_license())
 61 sections.append(Template(Templates.DoNotEditWarning).substitute(args))
 62 sections.append(self.generate_header_includes())
 63 sections.append(Template(Templates.NamespaceTop).substitute(args))
 64 sections.extend(self.generate_embedded_code_string_sections())
 65 if self.model().framework is Frameworks.JavaScriptCore:
 66 sections.append(Template(Templates.SeparateJSCImplementationStaticMacros).substitute(args))
 67 elif self.model().framework is Frameworks.WebCore:
 68 sections.append(Template(Templates.SeparateWebCoreImplementationStaticMacros).substitute(args))
 69 sections.append(Template(Templates.NamespaceBottom).substitute(args))
 70
 71 return "\n\n".join(sections)
 72
 73 def generate_header_includes(self):
 74 header_includes = [
 75 (["JavaScriptCore"],
 76 ("JavaScriptCore", "builtins/BuiltinExecutables.h")
 77 ),
 78 (["JavaScriptCore", "WebCore"],
 79 ("JavaScriptCore", "runtime/Executable.h")
 80 ),
 81 (["JavaScriptCore", "WebCore"],
 82 ("JavaScriptCore", "runtime/JSCellInlines.h")
 83 ),
 84 (["WebCore"],
 85 ("JavaScriptCore", "runtime/StructureInlines.h")
 86 ),
 87 (["WebCore"],
 88 ("JavaScriptCore", "runtime/JSCJSValueInlines.h")
 89 ),
 90 (["JavaScriptCore", "WebCore"],
 91 ("JavaScriptCore", "runtime/VM.h")
 92 ),
 93 (["WebCore"],
 94 ("WebCore", "bindings/js/WebCoreJSClientData.h")
 95 ),
 96 ];
 97
 98 return '\n'.join(self.generate_includes_from_entries(header_includes))
 99
 100 def generate_embedded_code_string_sections(self):
 101 subsections = []
 102 for function in self.object.functions:
 103 text = function.function_source
 104 # Wrap it in parens to avoid adding to global scope.
 105 text = "(function " + text[text.index("("):] + ")"
 106 # Lazy way to escape quotes, I think?
 107 textLines = json.dumps(text)[1:-1].split("\\n")
 108 # This looks scary because we need the JS source itself to have newlines.
 109 embeddedSource = '\n'.join([' "%s\\n" \\' % line for line in textLines])
 110
 111 constructAbility = "CannotConstruct"
 112 if function.is_constructor:
 113 constructAbility = "CanConstruct"
 114
 115 args = {
 116 'codeName': function.mangledNameForCode(),
 117 'embeddedSource': embeddedSource,
 118 'embeddedSourceLength': len(embeddedSource) + 1,
 119 'canConstruct': constructAbility
 120 }
 121
 122 lines = []
 123 lines.append("const JSC::ConstructAbility s_%(codeName)sConstructAbility = JSC::ConstructAbility::%(canConstruct)s;" % args);
 124 lines.append("const int s_%(codeName)sLength = %(embeddedSourceLength)d;" % args);
 125 lines.append("const char* s_%(codeName)s =\n%(embeddedSource)s\n;" % args);
 126 subsections.append('\n'.join(lines))
 127
 128 return subsections

Source/JavaScriptCore/Scripts/builtins/generate_builtins_separate_wrapper.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27
 28import logging
 29import re
 30import string
 31from string import Template
 32
 33from builtins_generator import BuiltinsGenerator
 34from builtins_templates import BuiltinsGeneratorTemplates as Templates
 35
 36log = logging.getLogger('global')
 37
 38
 39class BuiltinsSeparateWrapperGenerator(BuiltinsGenerator):
 40 def __init__(self, model, object):
 41 BuiltinsGenerator.__init__(self, model)
 42 self.object = object
 43
 44 def output_filename(self):
 45 return "%sBuiltinsWrapper.h" % self.object.object_name
 46
 47 def macro_prefix(self):
 48 return self.model().framework.setting('macro_prefix')
 49
 50 def generate_output(self):
 51 args = {
 52 'namespace': self.model().framework.setting('namespace'),
 53 'headerGuard': self.output_filename().replace('.', '_'),
 54 'macroPrefix': self.macro_prefix(),
 55 'objectName': self.object.object_name,
 56 'objectMacro': self.object.object_name.upper(),
 57 }
 58
 59 sections = []
 60 sections.append(self.generate_license())
 61 sections.append(Template(Templates.DoNotEditWarning).substitute(args))
 62 sections.append(Template(Templates.HeaderIncludeGuardTop).substitute(args))
 63 sections.append(self.generate_header_includes())
 64 sections.append(Template(Templates.NamespaceTop).substitute(args))
 65 sections.append(Template(Templates.SeparateWrapperHeaderBoilerplate).substitute(args))
 66 sections.append(Template(Templates.NamespaceBottom).substitute(args))
 67 sections.append(Template(Templates.HeaderIncludeGuardBottom).substitute(args))
 68
 69 return "\n\n".join(sections)
 70
 71 def generate_header_includes(self):
 72 header_includes = [
 73 (["WebCore"],
 74 ("WebCore", "%sBuiltins.h" % self.object.object_name)
 75 ),
 76
 77 (["WebCore"],
 78 ("JavaScriptCore", "bytecode/UnlinkedFunctionExecutable.h")
 79 ),
 80
 81 (["WebCore"],
 82 ("JavaScriptCore", "builtins/BuiltinUtils.h")
 83 ),
 84
 85 (["WebCore"],
 86 ("JavaScriptCore", "runtime/Identifier.h")
 87 ),
 88
 89 (["WebCore"],
 90 ("JavaScriptCore", "runtime/JSFunction.h")
 91 ),
 92 ];
 93
 94 return '\n'.join(self.generate_includes_from_entries(header_includes))

Source/JavaScriptCore/Scripts/generate-js-builtins.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2014 University of Washington. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27# This script generates C++ bindings for JavaScript builtins.
 28# Generators for individual files are located in the builtins/ directory.
 29
 30import fnmatch
 31import logging
 32import optparse
 33import os
 34
 35logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR)
 36log = logging.getLogger('global')
 37
 38from lazywriter import LazyFileWriter
 39
 40import builtins
 41from builtins import *
 42
 43# FIXME: if this script is used from WebCore, we will need to duplicate
 44# the imports of builtins/__init__.py to here since scripts copied to
 45# private headers have their directories flattened.
 46
 47def generate_bindings_for_builtins_files(builtins_files=[],
 48 output_path=None,
 49 combined_output=False,
 50 framework_name="",
 51 force_output=False):
 52
 53 generators = []
 54
 55 model = BuiltinsCollection(framework_name=framework_name)
 56
 57 for filepath in builtins_files:
 58 with open(filepath, "r") as file:
 59 file_text = file.read()
 60 file_name = os.path.basename(filepath)
 61 model.parse_builtins_file(file_name, file_text)
 62
 63 if combined_output:
 64 log.debug("Using generator style: combined files for all builtins.")
 65 generators.append(BuiltinsCombinedHeaderGenerator(model))
 66 generators.append(BuiltinsCombinedImplementationGenerator(model))
 67 else:
 68 log.debug("Using generator style: single files for each builtin.")
 69 for object in model.objects:
 70 generators.append(BuiltinsSeparateHeaderGenerator(model, object))
 71 generators.append(BuiltinsSeparateImplementationGenerator(model, object))
 72
 73 if model.framework is Frameworks.WebCore:
 74 generators.append(BuiltinsSeparateWrapperGenerator(model, object))
 75
 76 log.debug("")
 77 log.debug("Generating bindings for builtins.")
 78
 79 for generator in generators:
 80 output_filepath = os.path.join(output_path, generator.output_filename())
 81 log.debug("Generating output file: %s" % output_filepath)
 82 output = generator.generate_output()
 83
 84 log.debug("---")
 85 log.debug("\n" + output)
 86 log.debug("---")
 87 output_file = LazyFileWriter(output_filepath, force_output)
 88 output_file.write(output)
 89 output_file.close()
 90
 91
 92if __name__ == '__main__':
 93 allowed_framework_names = ['JavaScriptCore', 'WebCore', 'Test']
 94 cli_parser = optparse.OptionParser(usage="usage: %prog [options] Builtin1.js [, Builtin2.js, ...]")
 95 cli_parser.add_option("-i", "--input-directory", help="If specified, generates builtins from all JavaScript files in the specified directory in addition to specific files passed as arguments.")
 96 cli_parser.add_option("-o", "--output-directory", help="Directory where generated files should be written.")
 97 cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="Destination framework for generated files.")
 98 cli_parser.add_option("--force", action="store_true", help="Force output of generated scripts, even if nothing changed.")
 99 cli_parser.add_option("--combined", action="store_true", help="Produce one .h/.cpp file instead of producing one per builtin object.")
 100 cli_parser.add_option("-v", "--debug", action="store_true", help="Log extra output for debugging the generator itself.")
 101 cli_parser.add_option("-t", "--test", action="store_true", help="Enable test mode.")
 102
 103 arg_options, arg_values = cli_parser.parse_args()
 104 if len(arg_values) is 0 and not arg_options.input_directory:
 105 raise ParseException("At least one input file or directory expected.")
 106
 107 if not arg_options.output_directory:
 108 raise ParseException("Missing output directory.")
 109
 110 if arg_options.debug:
 111 log.setLevel(logging.DEBUG)
 112
 113 input_filepaths = arg_values[:]
 114 if arg_options.input_directory:
 115 for filepath in os.listdir(arg_options.input_directory):
 116 input_filepaths.append(os.path.join(arg_options.input_directory, filepath))
 117
 118 input_filepaths = filter(lambda name: fnmatch.fnmatch(name, '*.js'), input_filepaths);
 119
 120 options = {
 121 'output_path': arg_options.output_directory,
 122 'framework_name': arg_options.framework,
 123 'combined_output': arg_options.combined,
 124 }
 125
 126 log.debug("Generating code for builtins.")
 127 log.debug("Parsed options:")
 128 for option, value in options.items():
 129 log.debug(" %s: %s" % (option, value))
 130 log.debug("")
 131 log.debug("Input files:")
 132 for filepath in input_filepaths:
 133 log.debug(" %s" % filepath)
 134 log.debug("")
 135
 136 try:
 137 generate_bindings_for_builtins_files(builtins_files=input_filepaths, **options)
 138 except ParseException as e:
 139 if arg_options.test:
 140 log.error(e.message)
 141 else:
 142 raise # Force the build to fail.

Source/JavaScriptCore/Scripts/lazywriter.py

 1#!/usr/bin/env python
 2#
 3# Copyright (c) 2015 Apple Inc. All rights reserved.
 4# Copyright (c) 2009 Google Inc. All rights reserved.
 5#
 6# Redistribution and use in source and binary forms, with or without
 7# modification, are permitted provided that the following conditions
 8# are met:
 9# 1. Redistributions of source code must retain the above copyright
 10# notice, this list of conditions and the following disclaimer.
 11# 2. Redistributions in binary form must reproduce the above copyright
 12# notice, this list of conditions and the following disclaimer in the
 13# documentation and/or other materials provided with the distribution.
 14#
 15# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 16# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 17# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 18# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 25# THE POSSIBILITY OF SUCH DAMAGE.
 26
 27# A writer that only updates file if it actually changed.
 28class LazyFileWriter:
 29 def __init__(self, filepath, force_output):
 30 self._filepath = filepath
 31 self._output = ""
 32 self.force_output = force_output
 33
 34 def write(self, text):
 35 self._output += text
 36
 37 def close(self):
 38 text_changed = True
 39 self._output = self._output.rstrip() + "\n"
 40
 41 try:
 42 if self.force_output:
 43 raise
 44
 45 read_file = open(self._filepath, "r")
 46 old_text = read_file.read()
 47 read_file.close()
 48 text_changed = old_text != self._output
 49 except:
 50 # Ignore, just overwrite by default
 51 pass
 52
 53 if text_changed or self.force_output:
 54 out_file = open(self._filepath, "w")
 55 out_file.write(self._output)
 56 out_file.close()

Source/JavaScriptCore/UpdateContents.py

1 #!/usr/bin/python
2 
3 # Copyright (C) 2015 Apple Inc. All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 #
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. Neither the name of Apple puter, Inc. ("Apple") nor the names of
15 # its contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 import sys
30 import os
31 
32 assert(len(sys.argv) == 3)
33 
34 comp = sys.argv[1]
35 filename = sys.argv[2]
36 
37 t = False
38 
39 if os.path.isfile(filename):
40  f = open(filename, 'r')
41  comparator = f.read()
42  f.close()
43  t = True
44 
45 if (not t or comp != comparator):
46  f = open(filename, 'w')
47  f.write(comp)
48  f.close()

Source/JavaScriptCore/builtins/BuiltinExecutables.cpp

@@static UnlinkedFunctionExecutable* createExecutableInternal(VM&, const SourceCod
4040BuiltinExecutables::BuiltinExecutables(VM& vm)
4141 : m_vm(vm)
4242#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, length) , m_##name##Source(makeSource(StringImpl::createFromLiteral(s_##name, length)))
43  JSC_FOREACH_BUILTIN(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
 43 JSC_FOREACH_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
4444#undef EXPOSE_BUILTIN_STRINGS
4545{
4646}

@@UnlinkedFunctionExecutable* BuiltinExecutables::name##Executable() \
132132 m_##name##Executable = Weak<UnlinkedFunctionExecutable>(createBuiltinExecutable(m_##name##Source, m_vm.propertyNames->builtinNames().functionName##PublicName(), s_##name##ConstructAbility), this, &m_##name##Executable);\
133133 return m_##name##Executable.get();\
134134}
135 JSC_FOREACH_BUILTIN(DEFINE_BUILTIN_EXECUTABLES)
 135JSC_FOREACH_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES)
136136#undef EXPOSE_BUILTIN_SOURCES
137137
138138}

Source/JavaScriptCore/builtins/BuiltinExecutables.h

@@public:
4747UnlinkedFunctionExecutable* name##Executable(); \
4848const SourceCode& name##Source() { return m_##name##Source; }
4949
50  JSC_FOREACH_BUILTIN(EXPOSE_BUILTIN_EXECUTABLES)
 50 JSC_FOREACH_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES)
5151#undef EXPOSE_BUILTIN_SOURCES
5252
5353 UnlinkedFunctionExecutable* createDefaultConstructor(ConstructorKind, const Identifier& name);

@@private:
6262#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, length)\
6363 SourceCode m_##name##Source; \
6464 Weak<UnlinkedFunctionExecutable> m_##name##Executable;
65  JSC_FOREACH_BUILTIN(DECLARE_BUILTIN_SOURCE_MEMBERS)
 65 JSC_FOREACH_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS)
6666#undef DECLARE_BUILTIN_SOURCE_MEMBERS
6767};
6868

Source/JavaScriptCore/create_hash_table

@@sub output() {
319319 if ($values[$i]{"type"} eq "Function") {
320320 my $tableHead = $name;
321321 $tableHead =~ s/Table$//;
322  print " #if JSC_BUILTIN_EXISTS(" . uc($tableHead . $key) .")\n";
 322 print " #if JSC_BUILTIN_EXISTS(" . uc($tableHead) . ", " . uc($key) .")\n";
323323 print " { \"$key\", (($attrs[$i]) & ~Function) | Builtin, $intrinsic, { (intptr_t)static_cast<BuiltinGenerator>(" . $tableHead . ucfirst($key) . "CodeGenerator), (intptr_t)$secondValue } },\n";
324324 print " #else\n"
325325 }

Source/WebCore/DerivedSources.make

@@all : \
792792 $(WORKERGLOBALSCOPE_CONSTRUCTORS_FILE) \
793793 $(JS_DOM_HEADERS) \
794794 $(WEB_DOM_HEADERS) \
795  $(WEBCORE_JS_BUILTINS) \
796795 \
797796 CSSGrammar.cpp \
798797 CSSPropertyNames.cpp \

@@WebReplayInputs.h : $(INPUT_GENERATOR_SPECIFICATIONS) $(INPUT_GENERATOR_SCRIPTS)
12511250
12521251# WebCore JS Builtins
12531252
1254 WEBCORE_JS_BUILTINS = \
 1253WebCore_BUILTINS_SOURCES = \
12551254 $(WebCore)/Modules/streams/ByteLengthQueuingStrategy.js \
12561255 $(WebCore)/Modules/streams/CountQueuingStrategy.js \
12571256 $(WebCore)/Modules/streams/ReadableStream.js \

@@WEBCORE_JS_BUILTINS = \
12601259 $(WebCore)/Modules/streams/ReadableStreamReader.js \
12611260#
12621261
1263 all : $(WEBCORE_JS_BUILTINS:%.js=%Builtins.cpp)
 1262BUILTINS_GENERATOR_SCRIPTS = \
 1263 $(JavaScriptCore_SCRIPTS)/builtins_generator.py \
 1264 $(JavaScriptCore_SCRIPTS)/builtins_model.py \
 1265 $(JavaScriptCore_SCRIPTS)/builtins_templates.py \
 1266 $(JavaScriptCore_SCRIPTS)/generate_builtins_combined_header.py \
 1267 $(JavaScriptCore_SCRIPTS)/generate_builtins_combined_implementation.py \
 1268 $(JavaScriptCore_SCRIPTS)/generate_builtins_separate_header.py \
 1269 $(JavaScriptCore_SCRIPTS)/generate_builtins_separate_implementation.py \
 1270 $(JavaScriptCore_SCRIPTS)/generate_builtins_separate_wrapper.py \
 1271 $(JavaScriptCore_SCRIPTS)/generate-js-builtins.py \
 1272 $(JavaScriptCore_SCRIPTS)/lazywriter.py \
 1273#
 1274
 1275.PHONY: force
 1276WebCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS)/UpdateContents.py force
 1277 $(PYTHON) $(JavaScriptCore_SCRIPTS)/UpdateContents.py '$(WebCore_BUILTINS_SOURCES) $(BUILTINS_GENERATOR_SCRIPTS)' $@
 1278
 1279%Builtins.h: %.js $(BUILTINS_GENERATOR_SCRIPTS) $(WebCore_BUILTINS_SOURCES) WebCore_BUILTINS_DEPENDENCIES_LIST
 1280 $(PYTHON) $(JavaScriptCore_SCRIPTS)/generate-js-builtins.py --output-directory . --framework WebCore $(WebCore_BUILTINS_SOURCES)
 1281
 1282all : $(WebCore_BUILTINS_SOURCES:%.js=%Builtins.h)
12641283
1265 %Builtins.cpp: %.js
1266  $(PYTHON) $(WebCore)/generate-js-builtins --input $< --generate_js_builtins_path $(GenerateJSBuiltinsScripts)
12671284
12681285# ------------------------
12691286

Source/WebCore/WebCore.xcodeproj/project.pbxproj

14921492 4129DF861BB5B80C00322A16 /* JSReadableStreamPrivateConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = 4129DF841BB5B7F700322A16 /* JSReadableStreamPrivateConstructors.h */; settings = {ATTRIBUTES = (Private, ); }; };
14931493 4138D3351244054800323D33 /* EventContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138D3331244054800323D33 /* EventContext.h */; };
14941494 4138D3361244054800323D33 /* EventContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4138D3341244054800323D33 /* EventContext.cpp */; };
1495  413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 413C2C331BC29A7B0075204C /* JSDOMConstructor.h */; settings = {ASSET_TAGS = (); }; };
 1495 413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 413C2C331BC29A7B0075204C /* JSDOMConstructor.h */; };
14961496 415071571685067300C3C7B3 /* SelectorFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415071551685067300C3C7B3 /* SelectorFilter.cpp */; };
14971497 415071581685067300C3C7B3 /* SelectorFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 415071561685067300C3C7B3 /* SelectorFilter.h */; };
14981498 4150F9F112B6E0E70008C860 /* SliderThumbElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */; };

15251525 419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419BC2DC1685329900D64D6D /* VisitedLinkState.cpp */; };
15261526 419BC2DF1685329900D64D6D /* VisitedLinkState.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BC2DD1685329900D64D6D /* VisitedLinkState.h */; };
15271527 419BE7561BC7F41B00E1C85B /* WebCoreJSBuiltinInternals.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7531BC7F3DB00E1C85B /* WebCoreJSBuiltinInternals.h */; settings = {ATTRIBUTES = (Private, ); }; };
1528  419BE7571BC7F42100E1C85B /* WebCoreJSBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419BE7541BC7F3DB00E1C85B /* WebCoreJSBuiltins.cpp */; settings = {ASSET_TAGS = (); }; };
1529  419BE7581BC7F42700E1C85B /* WebCoreJSBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7551BC7F3DB00E1C85B /* WebCoreJSBuiltins.h */; settings = {ASSET_TAGS = (); }; };
1530  419BE7591BC7F42B00E1C85B /* WebCoreBuiltinNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7521BC7F3DB00E1C85B /* WebCoreBuiltinNames.h */; settings = {ASSET_TAGS = (); }; };
 1528 419BE7571BC7F42100E1C85B /* WebCoreJSBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 419BE7541BC7F3DB00E1C85B /* WebCoreJSBuiltins.cpp */; };
 1529 419BE7581BC7F42700E1C85B /* WebCoreJSBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7551BC7F3DB00E1C85B /* WebCoreJSBuiltins.h */; };
 1530 419BE7591BC7F42B00E1C85B /* WebCoreBuiltinNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7521BC7F3DB00E1C85B /* WebCoreBuiltinNames.h */; };
15311531 41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */; };
15321532 41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */; };
15331533 41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };

63586358 E1FF8F681807460800132674 /* JSSubtleCryptoCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F661807460800132674 /* JSSubtleCryptoCustom.cpp */; };
63596359 E1FF8F6C180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */; };
63606360 E1FF8F6D180DB5BE00132674 /* CryptoAlgorithmRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */; };
6361  E38838981BAD145F00D62EE3 /* JSModuleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38838941BAD145F00D62EE3 /* JSModuleLoader.cpp */; settings = {ASSET_TAGS = (); }; };
6362  E38838991BAD145F00D62EE3 /* JSModuleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = E38838951BAD145F00D62EE3 /* JSModuleLoader.h */; settings = {ASSET_TAGS = (); }; };
 6361 E38838981BAD145F00D62EE3 /* JSModuleLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38838941BAD145F00D62EE3 /* JSModuleLoader.cpp */; };
 6362 E38838991BAD145F00D62EE3 /* JSModuleLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = E38838951BAD145F00D62EE3 /* JSModuleLoader.h */; };
63636363 E401C27517CE53EC00C41A35 /* ElementIteratorAssertions.h in Headers */ = {isa = PBXBuildFile; fileRef = E401C27417CE53EC00C41A35 /* ElementIteratorAssertions.h */; settings = {ATTRIBUTES = (Private, ); }; };
63646364 E424A39E1330DF0100CF6DC9 /* LegacyTileGridTile.h in Headers */ = {isa = PBXBuildFile; fileRef = E424A39D1330DF0100CF6DC9 /* LegacyTileGridTile.h */; };
63656365 E424A3A01330DF1E00CF6DC9 /* LegacyTileGridTile.mm in Sources */ = {isa = PBXBuildFile; fileRef = E424A39F1330DF1E00CF6DC9 /* LegacyTileGridTile.mm */; };

2808728087 );
2808828088 runOnlyForDeploymentPostprocessing = 0;
2808928089 shellPath = /bin/sh;
28090  shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\n\n/bin/ln -sfh \"${SRCROOT}\" WebCore\nexport WebCore=\"WebCore\"\nexport InspectorScripts=\"${JAVASCRIPTCORE_PRIVATE_HEADERS_DIR}\"\nexport WebReplayScripts=\"${JAVASCRIPTCORE_PRIVATE_HEADERS_DIR}\"\nexport GenerateJSBuiltinsScripts=\"${JAVASCRIPTCORE_PRIVATE_HEADERS_DIR}\"\n\nif [ ! $CC ]; then\n export CC=\"`xcrun -find clang`\"\nfi\n\nif [ ! $GPERF ]; then\n export GPERF=\"`xcrun -find gperf`\"\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"WebCore/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.activecpu` SDKROOT=\"${SDKROOT}\"\nfi\n";
 28090 shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\n\n/bin/ln -sfh \"${SRCROOT}\" WebCore\nexport WebCore=\"WebCore\"\nexport InspectorScripts=\"${JAVASCRIPTCORE_PRIVATE_HEADERS_DIR}\"\nexport WebReplayScripts=\"${JAVASCRIPTCORE_PRIVATE_HEADERS_DIR}\"\nexport JavaScriptCore_SCRIPTS=\"${JAVASCRIPTCORE_PRIVATE_HEADERS_DIR}\"\n\nif [ ! $CC ]; then\n export CC=\"`xcrun -find clang`\"\nfi\n\nif [ ! $GPERF ]; then\n export GPERF=\"`xcrun -find gperf`\"\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"WebCore/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.activecpu` SDKROOT=\"${SDKROOT}\"\nfi\n";
2809128091 };
2809228092/* End PBXShellScriptBuildPhase section */
2809328093