Source code

Revision control

Other Tools

1
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2
# vim: set filetype=python:
3
# This Source Code Form is subject to the terms of the Mozilla Public
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
include('js-config.mozbuild')
8
include('js-cxxflags.mozbuild')
9
10
# Directory metadata
11
component_engine = ('Core', 'JavaScript Engine')
12
component_gc = ('Core', 'JavaScript: GC')
13
component_intl = ('Core', 'JavaScript: Internationalization API')
14
component_jit = ('Core', 'JavaScript Engine: JIT')
15
component_stl = ('Core', 'JavaScript: Standard Library')
16
component_wasm = ('Core', 'Javascript: Web Assembly')
17
18
FILES_PER_UNIFIED_FILE = 6
19
20
# Prevent redefining FILES_PER_UNIFIED_FILE in each sub-directory of js. This
21
# will not escape this directory.
22
export('FILES_PER_UNIFIED_FILE')
23
24
with Files('*'):
25
BUG_COMPONENT = component_engine
26
27
with Files('wasm/**'):
28
BUG_COMPONENT = component_wasm
29
with Files('builtin/**'):
30
BUG_COMPONENT = component_stl
31
with Files('ctypes/**'):
32
BUG_COMPONENT = ('Core', 'js-ctypes')
33
with Files('gc/**'):
34
BUG_COMPONENT = component_gc
35
with Files('jit/**'):
36
BUG_COMPONENT = component_jit
37
38
# File-specific metadata
39
for gcfile in ['devtools/rootAnalysis', 'devtools/gc-ubench', 'devtools/gctrace']:
40
with Files(gcfile):
41
BUG_COMPONENT = component_gc
42
43
for stlfile in ['jsdate.*', 'jsnum.*']:
44
with Files(stlfile):
45
BUG_COMPONENT = component_stl
46
47
with Files('builtin/intl/*'):
48
BUG_COMPONENT = component_intl
49
50
if CONFIG['ENABLE_WASM_CRANELIFT']:
51
CONFIGURE_SUBST_FILES += ['rust/extra-bindgen-flags']
52
53
if not CONFIG['JS_DISABLE_SHELL']:
54
DIRS += [
55
'rust',
56
'shell',
57
]
58
59
TEST_DIRS += [
60
'gdb',
61
'jsapi-tests',
62
'tests',
63
]
64
65
if CONFIG['FUZZING_INTERFACES']:
66
TEST_DIRS += [
67
'fuzz-tests',
68
]
69
70
if CONFIG['FUZZING_INTERFACES'] and CONFIG['LIBFUZZER']:
71
# In addition to regular coverage provided by trace-pc-guard,
72
# LibFuzzer can use trace-cmp to instrument various compare instructions.
73
# Only use this feature on source files that do a lot of constant
74
# comparisons that would otherwise be hard to guess by LibFuzzer,
75
# as it comes with a larger overhead (requires -use_value_profile=1).
76
include('/tools/fuzzing/libfuzzer-flags.mozbuild')
77
78
# Any files that are targeted by LibFuzzer should be added here so they can
79
# be built with the necessary instrumentation flags, rather than just building
80
# the whole JS engine with instrumentation, to reduce the amount of noise.
81
SOURCES += [
82
'vm/StructuredClone.cpp',
83
]
84
SOURCES['vm/StructuredClone.cpp'].flags += libfuzzer_flags
85
else:
86
UNIFIED_SOURCES += [
87
'vm/StructuredClone.cpp',
88
]
89
90
CONFIGURE_SUBST_FILES += [
91
'devtools/rootAnalysis/Makefile',
92
]
93
CONFIGURE_DEFINE_FILES += [
94
'js-confdefs.h',
95
]
96
97
if not CONFIG['JS_STANDALONE']:
98
CONFIGURE_SUBST_FILES += [
99
'../../config/autoconf-js.mk',
100
'../../config/emptyvars-js.mk',
101
]
102
103
CONFIGURE_DEFINE_FILES += [
104
'js-config.h',
105
]
106
107
if CONFIG['HAVE_DTRACE']:
108
GeneratedFile('javascript-trace.h')
109
EXPORTS += ['!javascript-trace.h']
110
111
# Changes to internal header files, used externally, massively slow down
112
# browser builds. Don't add new files here unless you know what you're
113
# doing!
114
EXPORTS += [
115
'!js-config.h',
116
'js.msg',
117
'jsapi.h',
118
'jsfriendapi.h',
119
'jspubtd.h',
120
'jstypes.h',
121
]
122
123
EXPORTS.js += [
124
'../public/AllocationRecording.h',
125
'../public/AllocPolicy.h',
126
'../public/ArrayBuffer.h',
127
'../public/BuildId.h',
128
'../public/CallArgs.h',
129
'../public/CallNonGenericMethod.h',
130
'../public/CharacterEncoding.h',
131
'../public/Class.h',
132
'../public/CompilationAndEvaluation.h',
133
'../public/CompileOptions.h',
134
'../public/ContextOptions.h',
135
'../public/Conversions.h',
136
'../public/Date.h',
137
'../public/Debug.h',
138
'../public/Equality.h',
139
'../public/ErrorReport.h',
140
'../public/ForOfIterator.h',
141
'../public/GCAnnotations.h',
142
'../public/GCAPI.h',
143
'../public/GCHashTable.h',
144
'../public/GCPolicyAPI.h',
145
'../public/GCVariant.h',
146
'../public/GCVector.h',
147
'../public/HashTable.h',
148
'../public/HeapAPI.h',
149
'../public/Id.h',
150
'../public/Initialization.h',
151
'../public/JSON.h',
152
'../public/LocaleSensitive.h',
153
'../public/MemoryFunctions.h',
154
'../public/MemoryMetrics.h',
155
'../public/Modules.h',
156
'../public/OffThreadScriptCompilation.h',
157
'../public/Principals.h',
158
'../public/Printf.h',
159
'../public/ProfilingCategory.h',
160
'../public/ProfilingFrameIterator.h',
161
'../public/ProfilingStack.h',
162
'../public/Promise.h',
163
'../public/PropertyDescriptor.h',
164
'../public/PropertySpec.h',
165
'../public/ProtoKey.h',
166
'../public/Proxy.h',
167
'../public/Realm.h',
168
'../public/RealmOptions.h',
169
'../public/RefCounted.h',
170
'../public/RegExp.h',
171
'../public/RegExpFlags.h',
172
'../public/RequiredDefines.h',
173
'../public/Result.h',
174
'../public/RootingAPI.h',
175
'../public/SavedFrameAPI.h',
176
'../public/SharedArrayBuffer.h',
177
'../public/SliceBudget.h',
178
'../public/SourceText.h',
179
'../public/StableStringChars.h',
180
'../public/Stream.h',
181
'../public/StructuredClone.h',
182
'../public/SweepingAPI.h',
183
'../public/Symbol.h',
184
'../public/TraceKind.h',
185
'../public/TraceLoggerAPI.h',
186
'../public/TracingAPI.h',
187
'../public/TrackedOptimizationInfo.h',
188
'../public/Transcoding.h',
189
'../public/TypeDecls.h',
190
'../public/UbiNode.h',
191
'../public/UbiNodeBreadthFirst.h',
192
'../public/UbiNodeCensus.h',
193
'../public/UbiNodeDominatorTree.h',
194
'../public/UbiNodePostOrder.h',
195
'../public/UbiNodeShortestPaths.h',
196
'../public/UbiNodeUtils.h',
197
'../public/UniquePtr.h',
198
'../public/Utility.h',
199
'../public/Value.h',
200
'../public/Vector.h',
201
'../public/Warnings.h',
202
'../public/WeakMapPtr.h',
203
'../public/Wrapper.h',
204
]
205
206
EXPORTS.js.experimental += [
207
'../public/experimental/SourceHook.h',
208
]
209
210
UNIFIED_SOURCES += [
211
'builtin/Array.cpp',
212
'builtin/AtomicsObject.cpp',
213
'builtin/BigInt.cpp',
214
'builtin/Boolean.cpp',
215
'builtin/DataViewObject.cpp',
216
'builtin/Eval.cpp',
217
'builtin/FinalizationGroupObject.cpp',
218
'builtin/JSON.cpp',
219
'builtin/MapObject.cpp',
220
'builtin/ModuleObject.cpp',
221
'builtin/Object.cpp',
222
'builtin/Profilers.cpp',
223
'builtin/Promise.cpp',
224
'builtin/Reflect.cpp',
225
'builtin/ReflectParse.cpp',
226
'builtin/Stream.cpp',
227
'builtin/streams/MiscellaneousOperations.cpp',
228
'builtin/streams/PullIntoDescriptor.cpp',
229
'builtin/streams/QueueingStrategies.cpp',
230
'builtin/streams/QueueWithSizes.cpp',
231
'builtin/streams/ReadableStream.cpp',
232
'builtin/streams/ReadableStreamDefaultController.cpp',
233
'builtin/streams/ReadableStreamDefaultControllerOperations.cpp',
234
'builtin/streams/ReadableStreamDefaultReader.cpp',
235
'builtin/streams/ReadableStreamInternals.cpp',
236
'builtin/streams/ReadableStreamOperations.cpp',
237
'builtin/streams/ReadableStreamReader.cpp',
238
'builtin/streams/StreamAPI.cpp',
239
'builtin/streams/TeeState.cpp',
240
'builtin/streams/WritableStream.cpp',
241
'builtin/streams/WritableStreamDefaultController.cpp',
242
'builtin/streams/WritableStreamDefaultControllerOperations.cpp',
243
'builtin/streams/WritableStreamDefaultWriter.cpp',
244
'builtin/streams/WritableStreamOperations.cpp',
245
'builtin/streams/WritableStreamWriterOperations.cpp',
246
'builtin/String.cpp',
247
'builtin/Symbol.cpp',
248
'builtin/TestingFunctions.cpp',
249
'builtin/TypedObject.cpp',
250
'builtin/WeakMapObject.cpp',
251
'builtin/WeakSetObject.cpp',
252
'ds/Bitmap.cpp',
253
'ds/LifoAlloc.cpp',
254
'ds/MemoryProtectionExceptionHandler.cpp',
255
'irregexp/NativeRegExpMacroAssembler.cpp',
256
'irregexp/RegExpAST.cpp',
257
'irregexp/RegExpCharacters.cpp',
258
'irregexp/RegExpEngine.cpp',
259
'irregexp/RegExpInterpreter.cpp',
260
'irregexp/RegExpMacroAssembler.cpp',
261
'irregexp/RegExpParser.cpp',
262
'irregexp/RegExpStack.cpp',
263
'jsapi.cpp',
264
'jsdate.cpp',
265
'jsexn.cpp',
266
'jsfriendapi.cpp',
267
'jsnum.cpp',
268
'proxy/BaseProxyHandler.cpp',
269
'proxy/CrossCompartmentWrapper.cpp',
270
'proxy/DeadObjectProxy.cpp',
271
'proxy/OpaqueCrossCompartmentWrapper.cpp',
272
'proxy/Proxy.cpp',
273
'proxy/ScriptedProxyHandler.cpp',
274
'proxy/SecurityWrapper.cpp',
275
'proxy/Wrapper.cpp',
276
'threading/Mutex.cpp',
277
'threading/ProtectedData.cpp',
278
'threading/Thread.cpp',
279
'util/AllocPolicy.cpp',
280
'util/CompleteFile.cpp',
281
'util/NativeStack.cpp',
282
'util/Printf.cpp',
283
'util/StringBuffer.cpp',
284
'util/StructuredSpewer.cpp',
285
'util/Text.cpp',
286
'util/Unicode.cpp',
287
'vm/Activation.cpp',
288
'vm/ArgumentsObject.cpp',
289
'vm/ArrayBufferObject.cpp',
290
'vm/ArrayBufferViewObject.cpp',
291
'vm/AsyncFunction.cpp',
292
'vm/AsyncIteration.cpp',
293
'vm/BigIntType.cpp',
294
'vm/BuildId.cpp',
295
'vm/BytecodeUtil.cpp',
296
'vm/Caches.cpp',
297
'vm/CallNonGenericMethod.cpp',
298
'vm/CharacterEncoding.cpp',
299
'vm/CodeCoverage.cpp',
300
'vm/Compartment.cpp',
301
'vm/CompilationAndEvaluation.cpp',
302
'vm/Compression.cpp',
303
'vm/DateTime.cpp',
304
'vm/EnvironmentObject.cpp',
305
'vm/EqualityOperations.cpp',
306
'vm/ErrorObject.cpp',
307
'vm/ErrorReporting.cpp',
308
'vm/ForOfIterator.cpp',
309
'vm/FrameIter.cpp',
310
'vm/GeckoProfiler.cpp',
311
'vm/GeneratorObject.cpp',
312
'vm/GlobalObject.cpp',
313
'vm/HelperThreads.cpp',
314
'vm/Id.cpp',
315
'vm/Initialization.cpp',
316
'vm/Instrumentation.cpp',
317
'vm/Iteration.cpp',
318
'vm/JitActivation.cpp',
319
'vm/JSAtom.cpp',
320
'vm/JSContext.cpp',
321
'vm/JSFunction.cpp',
322
'vm/JSObject.cpp',
323
'vm/JSONParser.cpp',
324
'vm/JSONPrinter.cpp',
325
'vm/JSScript.cpp',
326
'vm/List.cpp',
327
'vm/MemoryMetrics.cpp',
328
'vm/Modules.cpp',
329
'vm/NativeObject.cpp',
330
'vm/ObjectGroup.cpp',
331
'vm/OffThreadScriptCompilation.cpp',
332
'vm/PIC.cpp',
333
'vm/Printer.cpp',
334
'vm/Probes.cpp',
335
'vm/ProxyObject.cpp',
336
'vm/Realm.cpp',
337
'vm/ReceiverGuard.cpp',
338
'vm/RegExpObject.cpp',
339
'vm/RegExpStatics.cpp',
340
'vm/Runtime.cpp',
341
'vm/SavedStacks.cpp',
342
'vm/Scope.cpp',
343
'vm/SelfHosting.cpp',
344
'vm/Shape.cpp',
345
'vm/SharedArrayObject.cpp',
346
'vm/SharedImmutableStringsCache.cpp',
347
'vm/SourceHook.cpp',
348
'vm/Stack.cpp',
349
'vm/StringType.cpp',
350
'vm/SymbolType.cpp',
351
'vm/TaggedProto.cpp',
352
'vm/Time.cpp',
353
'vm/TypedArrayObject.cpp',
354
'vm/TypeInference.cpp',
355
'vm/UbiNode.cpp',
356
'vm/UbiNodeCensus.cpp',
357
'vm/UbiNodeShortestPaths.cpp',
358
'vm/Value.cpp',
359
'vm/Warnings.cpp',
360
'vm/Xdr.cpp',
361
]
362
363
# builtin/RegExp.cpp cannot be built in unified mode because it causes huge
364
# win32 test slowdowns
365
# jsmath.cpp cannot be built in unified mode because it needs to re-#define the
366
# RtlGenRandom declaration's calling convention in <ntsecapi.h> on Windows.
367
# util/DoubleToString.cpp cannot be built in unified mode because we want to
368
# suppress compiler warnings in third-party dtoa.c.
369
# util/Utility.cpp cannot be built in unified mode because it is needed for
370
# check-vanilla-allocations.
371
# vm/Interpreter.cpp is gigantic and destroys incremental build times for any
372
# files unlucky enough to be unified with it.
373
SOURCES += [
374
'builtin/RegExp.cpp',
375
'jsmath.cpp',
376
'util/DoubleToString.cpp',
377
'util/Utility.cpp',
378
'vm/Interpreter.cpp',
379
'vm/ProfilingStack.cpp',
380
]
381
382
if CONFIG['ENABLE_INTL_API']:
383
UNIFIED_SOURCES += [
384
'builtin/intl/Collator.cpp',
385
'builtin/intl/CommonFunctions.cpp',
386
'builtin/intl/DateTimeFormat.cpp',
387
'builtin/intl/IntlObject.cpp',
388
'builtin/intl/LanguageTag.cpp',
389
'builtin/intl/LanguageTagGenerated.cpp',
390
'builtin/intl/ListFormat.cpp',
391
'builtin/intl/Locale.cpp',
392
'builtin/intl/NumberFormat.cpp',
393
'builtin/intl/PluralRules.cpp',
394
'builtin/intl/RelativeTimeFormat.cpp',
395
'builtin/intl/SharedIntlData.cpp',
396
]
397
398
if CONFIG['MOZ_INSTRUMENTS']:
399
SOURCES += [
400
'devtools/Instruments.cpp',
401
]
402
403
if CONFIG['ENABLE_TRACE_LOGGING']:
404
SOURCES += [
405
'vm/TraceLogging.cpp',
406
'vm/TraceLoggingGraph.cpp',
407
'vm/TraceLoggingTypes.cpp',
408
]
409
410
if CONFIG['OS_ARCH'] == 'WINNT':
411
UNIFIED_SOURCES += [
412
'threading/windows/CpuCount.cpp',
413
'threading/windows/WindowsThread.cpp',
414
]
415
else:
416
UNIFIED_SOURCES += [
417
'threading/posix/CpuCount.cpp',
418
'threading/posix/PosixThread.cpp',
419
]
420
421
if CONFIG['JS_HAS_CTYPES']:
422
SOURCES += [
423
'ctypes/CTypes.cpp',
424
'ctypes/Library.cpp',
425
]
426
if not CONFIG['MOZ_SYSTEM_FFI']:
427
LOCAL_INCLUDES += [
428
'!ctypes/libffi/include',
429
'ctypes/libffi/src/%s' % CONFIG['FFI_TARGET_DIR'],
430
]
431
432
if CONFIG['MOZ_VTUNE']:
433
SOURCES += [
434
'vtune/ittnotify_static.c',
435
'vtune/jitprofiling.c',
436
'vtune/VTuneWrapper.cpp',
437
]
438
SOURCES['vtune/ittnotify_static.c'].flags += ['-Wno-varargs', '-Wno-unknown-pragmas']
439
440
DIRS += [
441
'build',
442
'debugger',
443
'frontend',
444
'gc',
445
'jit',
446
'wasm',
447
]
448
449
if CONFIG['JS_JITSPEW']:
450
DIRS += ['zydis']
451
452
FINAL_LIBRARY = 'js'
453
454
selfhosted_inputs = [
455
'js.msg',
456
'builtin/TypedObjectConstants.h',
457
'builtin/SelfHostingDefines.h',
458
'builtin/Utilities.js',
459
'builtin/Array.js',
460
'builtin/AsyncFunction.js',
461
'builtin/AsyncIteration.js',
462
'builtin/BigInt.js',
463
'builtin/Classes.js',
464
'builtin/Date.js',
465
'builtin/Error.js',
466
'builtin/Function.js',
467
'builtin/Generator.js',
468
'builtin/Iterator.js',
469
'builtin/Map.js',
470
'builtin/Module.js',
471
'builtin/Number.js',
472
'builtin/Object.js',
473
'builtin/Promise.js',
474
'builtin/Reflect.js',
475
'builtin/RegExp.js',
476
'builtin/RegExpGlobalReplaceOpt.h.js',
477
'builtin/RegExpLocalReplaceOpt.h.js',
478
'builtin/String.js',
479
'builtin/Set.js',
480
'builtin/Sorting.js',
481
'builtin/TypedArray.js',
482
'builtin/TypedObject.js',
483
'builtin/WeakMap.js',
484
'builtin/WeakSet.js'
485
] + ([
486
'builtin/intl/Collator.js',
487
'builtin/intl/CommonFunctions.js',
488
'builtin/intl/CurrencyDataGenerated.js',
489
'builtin/intl/DateTimeFormat.js',
490
'builtin/intl/IntlObject.js',
491
'builtin/intl/ListFormat.js',
492
'builtin/intl/NumberFormat.js',
493
'builtin/intl/PluralRules.js',
494
'builtin/intl/RelativeTimeFormat.js',
495
] if CONFIG['ENABLE_INTL_API'] else [])
496
497
# Prepare self-hosted JS code for embedding
498
GeneratedFile('selfhosted.out.h', 'selfhosted.js',
499
script='builtin/embedjs.py',
500
entry_point='generate_selfhosted',
501
inputs=selfhosted_inputs)
502
503
if CONFIG['JS_HAS_CTYPES']:
504
if CONFIG['MOZ_SYSTEM_FFI']:
505
CXXFLAGS += CONFIG['MOZ_FFI_CFLAGS']
506
507
# Suppress warnings in third-party code.
508
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
509
SOURCES['util/DoubleToString.cpp'].flags += ['-Wno-implicit-fallthrough']