Create a super rough prototype of B3
[WebKit-https.git] / Source / JavaScriptCore / DerivedSources.make
1 # Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013, 2015 Apple Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 #
7 # 1.  Redistributions of source code must retain the above copyright
8 #     notice, this list of conditions and the following disclaimer.
9 # 2.  Redistributions in binary form must reproduce the above copyright
10 #     notice, this list of conditions and the following disclaimer in the
11 #     documentation and/or other materials provided with the distribution.
12 # 3.  Neither the name of Apple Inc. ("Apple") nor the names of
13 #     its contributors may be used to endorse or promote products derived
14 #     from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
17 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
20 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27 VPATH = \
28     $(JavaScriptCore) \
29     $(JavaScriptCore)/parser \
30     $(JavaScriptCore)/runtime \
31         $(JavaScriptCore)/interpreter \
32         $(JavaScriptCore)/jit \
33         $(JavaScriptCore)/builtins \
34 #
35
36 PYTHON = python
37 PERL = perl
38 RUBY = ruby
39
40 JavaScriptCore_SCRIPTS_DIR = $(JavaScriptCore)/Scripts
41
42 ifeq ($(OS),Windows_NT)
43     DELETE = cmd //C del
44 else
45     DELETE = rm -f
46 endif
47
48 # --------
49
50 .PHONY : all
51 all : \
52     udis86_itab.h \
53     Bytecodes.h \
54     CombinedDomains.json \
55     InitBytecodes.asm \
56     InjectedScriptSource.h \
57     InspectorFrontendDispatchers.h \
58     JSReplayInputs.h \
59     JSCBuiltins.h \
60     Lexer.lut.h \
61     KeywordLookup.h \
62     RegExpJitTables.h \
63     B3LoweringMatcher.h \
64     B3AddressMatcher.h \
65     AirOpcode.h \
66 #
67
68 # JavaScript builtins.
69
70 BUILTINS_GENERATOR_SCRIPTS = \
71     $(JavaScriptCore_SCRIPTS_DIR)/builtins/__init__.py \
72     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins.py \
73     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generator.py \
74     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_model.py \
75     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_templates.py \
76     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_combined_header.py \
77     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_combined_implementation.py \
78     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_header.py \
79     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_implementation.py \
80     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_wrapper.py \
81     $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py \
82     $(JavaScriptCore_SCRIPTS_DIR)/lazywriter.py \
83 #
84
85 JavaScriptCore_BUILTINS_SOURCES = \
86     $(JavaScriptCore)/builtins/ArrayConstructor.js \
87     $(JavaScriptCore)/builtins/ArrayIterator.prototype.js \
88     $(JavaScriptCore)/builtins/Array.prototype.js \
89     $(JavaScriptCore)/builtins/Function.prototype.js \
90     $(JavaScriptCore)/builtins/GlobalObject.js \
91     $(JavaScriptCore)/builtins/InspectorInstrumentationObject.js \
92     $(JavaScriptCore)/builtins/InternalPromiseConstructor.js \
93     $(JavaScriptCore)/builtins/Iterator.prototype.js \
94     $(JavaScriptCore)/builtins/ModuleLoaderObject.js \
95     $(JavaScriptCore)/builtins/ObjectConstructor.js \
96     $(JavaScriptCore)/builtins/Operations.Promise.js \
97     $(JavaScriptCore)/builtins/PromiseConstructor.js \
98     $(JavaScriptCore)/builtins/Promise.prototype.js \
99     $(JavaScriptCore)/builtins/ReflectObject.js \
100     $(JavaScriptCore)/builtins/StringConstructor.js \
101     $(JavaScriptCore)/builtins/StringIterator.prototype.js \
102     $(JavaScriptCore)/builtins/TypedArrayConstructor.js \
103     $(JavaScriptCore)/builtins/TypedArray.prototype.js \
104 #
105
106 # The combined output file depends on the contents of builtins and generator scripts, so
107 # adding, modifying, or removing builtins or scripts will trigger regeneration of files.
108
109 .PHONY: force
110 JavaScriptCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
111         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(JavaScriptCore_BUILTINS_SOURCES) $(BUILTINS_GENERATOR_SCRIPTS)' $@
112
113 JSCBuiltins.h: $(BUILTINS_GENERATOR_SCRIPTS) $(JavaScriptCore_BUILTINS_SOURCES) JavaScriptCore_BUILTINS_DEPENDENCIES_LIST
114         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py --combined --output-directory . --framework JavaScriptCore $(JavaScriptCore_BUILTINS_SOURCES)
115
116 # Perfect hash lookup tables for JavaScript classes.
117
118 NATIVE_OBJECT_LUT_HEADERS = \
119     BooleanPrototype.lut.h \
120     DateConstructor.lut.h \
121     DatePrototype.lut.h \
122     ErrorPrototype.lut.h \
123     IntlCollatorConstructor.lut.h \
124     IntlCollatorPrototype.lut.h \
125     IntlDateTimeFormatConstructor.lut.h \
126     IntlDateTimeFormatPrototype.lut.h \
127     IntlNumberFormatConstructor.lut.h \
128     IntlNumberFormatPrototype.lut.h \
129     JSDataViewPrototype.lut.h \
130     JSONObject.lut.h \
131     NumberConstructor.lut.h \
132     NumberPrototype.lut.h \
133     RegExpConstructor.lut.h \
134     RegExpPrototype.lut.h \
135     SymbolConstructor.lut.h \
136     SymbolPrototype.lut.h \
137 #
138
139 # If an object's implementation contains at least one builtin, then it must
140 # be added to this section so it is generated with builtin-specific includes.
141
142 BUILTIN_OBJECT_LUT_HEADERS = \
143     ArrayConstructor.lut.h \
144     ArrayIteratorPrototype.lut.h \
145     InspectorInstrumentationObject.lut.h \
146     JSGlobalObject.lut.h \
147     JSInternalPromiseConstructor.lut.h \
148     JSPromisePrototype.lut.h \
149     JSPromiseConstructor.lut.h \
150     ModuleLoaderObject.lut.h \
151     ObjectConstructor.lut.h \
152     ReflectObject.lut.h \
153     StringConstructor.lut.h \
154     StringIteratorPrototype.lut.h \
155 #
156
157 $(NATIVE_OBJECT_LUT_HEADERS): %.lut.h : %.cpp $(JavaScriptCore)/create_hash_table
158         $(PERL) $(JavaScriptCore)/create_hash_table -i $< > $@
159 $(BUILTIN_OBJECT_LUT_HEADERS): %.lut.h : %.cpp $(JavaScriptCore)/create_hash_table
160         $(PERL) $(JavaScriptCore)/create_hash_table -i -b $< > $@
161
162 Lexer.lut.h: Keywords.table $(JavaScriptCore)/create_hash_table
163         $(PERL) $(JavaScriptCore)/create_hash_table -i $< > $@
164
165 # character tables for Yarr
166
167 RegExpJitTables.h: create_regex_tables
168         $(PYTHON) $^ > $@
169
170 KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
171         $(PYTHON) $^ > $@
172
173 # udis86 instruction tables
174
175 udis86_itab.h: $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
176         $(PYTHON) $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
177
178 # Bytecode files
179
180 Bytecodes.h: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
181         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --bytecodes_h Bytecodes.h $(JavaScriptCore)/bytecode/BytecodeList.json
182
183 InitBytecodes.asm: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
184         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --init_bytecodes_asm InitBytecodes.asm $(JavaScriptCore)/bytecode/BytecodeList.json
185
186 # Inspector interfaces
187
188 INSPECTOR_DOMAINS = \
189     $(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
190     $(JavaScriptCore)/inspector/protocol/CSS.json \
191     $(JavaScriptCore)/inspector/protocol/Console.json \
192     $(JavaScriptCore)/inspector/protocol/DOM.json \
193     $(JavaScriptCore)/inspector/protocol/DOMDebugger.json \
194     $(JavaScriptCore)/inspector/protocol/DOMStorage.json \
195     $(JavaScriptCore)/inspector/protocol/Database.json \
196     $(JavaScriptCore)/inspector/protocol/Debugger.json \
197     $(JavaScriptCore)/inspector/protocol/GenericTypes.json \
198     $(JavaScriptCore)/inspector/protocol/Heap.json \
199     $(JavaScriptCore)/inspector/protocol/Inspector.json \
200     $(JavaScriptCore)/inspector/protocol/LayerTree.json \
201     $(JavaScriptCore)/inspector/protocol/Network.json \
202     $(JavaScriptCore)/inspector/protocol/OverlayTypes.json \
203     $(JavaScriptCore)/inspector/protocol/Page.json \
204     $(JavaScriptCore)/inspector/protocol/Runtime.json \
205     $(JavaScriptCore)/inspector/protocol/Timeline.json \
206     $(JavaScriptCore)/inspector/protocol/Worker.json \
207 #
208
209 ifeq ($(findstring ENABLE_INDEXED_DATABASE,$(FEATURE_DEFINES)), ENABLE_INDEXED_DATABASE)
210     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/IndexedDB.json
211 endif
212
213 ifeq ($(findstring ENABLE_WEB_REPLAY,$(FEATURE_DEFINES)), ENABLE_WEB_REPLAY)
214     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/Replay.json
215 endif
216
217 INSPECTOR_GENERATOR_SCRIPTS = \
218         $(JavaScriptCore)/inspector/scripts/codegen/__init__.py \
219         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator_templates.py \
220         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator.py \
221         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py \
222         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py \
223         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py \
224         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py \
225         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_header.py \
226         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py \
227         $(JavaScriptCore)/inspector/scripts/codegen/generate_js_backend_commands.py \
228         $(JavaScriptCore)/inspector/scripts/codegen/generator_templates.py \
229         $(JavaScriptCore)/inspector/scripts/codegen/generator.py \
230         $(JavaScriptCore)/inspector/scripts/codegen/models.py \
231         $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py \
232         $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py \
233 #
234
235 # The combined JSON file depends on the actual set of domains and their file contents, so that
236 # adding, modifying, or removing domains will trigger regeneration of inspector files.
237
238 .PHONY: force
239 EnabledInspectorDomains : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
240         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
241
242 CombinedDomains.json : $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
243         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
244
245 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
246 InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS)
247         $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir . ./CombinedDomains.json
248
249 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
250         echo "//# sourceURL=__WebInspectorInjectedScript__" > ./InjectedScriptSource.min.js
251         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py < $(JavaScriptCore)/inspector/InjectedScriptSource.js >> ./InjectedScriptSource.min.js
252         $(PERL) $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl InjectedScriptSource_js ./InjectedScriptSource.min.js InjectedScriptSource.h
253         $(DELETE) InjectedScriptSource.min.js
254
255 # Web Replay inputs generator
256
257 INPUT_GENERATOR_SCRIPTS = \
258     $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py \
259     $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputsTemplates.py \
260 #
261
262 INPUT_GENERATOR_SPECIFICATIONS = \
263     $(JavaScriptCore)/replay/JSInputs.json \
264 #
265
266 JSReplayInputs.h : $(INPUT_GENERATOR_SPECIFICATIONS) $(INPUT_GENERATOR_SCRIPTS)
267         $(PYTHON) $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py --outputDir . --framework JavaScriptCore $(INPUT_GENERATOR_SPECIFICATIONS)
268
269 B3LoweringMatcher.h: $(JavaScriptCore)/b3/generate_pattern_matcher.rb $(JavaScriptCore)/b3/B3LoweringMatcher.patterns
270         $(RUBY) $^ 
271 B3AddressMatcher.h: $(JavaScriptCore)/b3/generate_pattern_matcher.rb $(JavaScriptCore)/b3/B3AddressMatcher.patterns
272         $(RUBY) $^
273
274 AirOpcode.h: $(JavaScriptCore)/b3/air/opcode_generator.rb $(JavaScriptCore)/b3/air/AirOpcode.opcodes
275         $(RUBY) $^
276
277 # Dynamically-defined targets are listed below. Static targets belong up top.
278
279 all : \
280     $(BUILTIN_OBJECT_LUT_HEADERS) \
281     $(NATIVE_OBJECT_LUT_HEADERS) \
282 #