Source code

Revision control

Other Tools

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include('js-config.mozbuild')
include('js-cxxflags.mozbuild')
# Directory metadata
component_engine = ('Core', 'JavaScript Engine')
component_gc = ('Core', 'JavaScript: GC')
component_intl = ('Core', 'JavaScript: Internationalization API')
component_jit = ('Core', 'JavaScript Engine: JIT')
component_stl = ('Core', 'JavaScript: Standard Library')
component_wasm = ('Core', 'Javascript: Web Assembly')
FILES_PER_UNIFIED_FILE = 6
# Prevent redefining FILES_PER_UNIFIED_FILE in each sub-directory of js. This
# will not escape this directory.
export('FILES_PER_UNIFIED_FILE')
with Files('*'):
BUG_COMPONENT = component_engine
with Files('wasm/**'):
BUG_COMPONENT = component_wasm
with Files('builtin/**'):
BUG_COMPONENT = component_stl
with Files('ctypes/**'):
BUG_COMPONENT = ('Core', 'js-ctypes')
with Files('gc/**'):
BUG_COMPONENT = component_gc
with Files('jit/**'):
BUG_COMPONENT = component_jit
# File-specific metadata
for gcfile in ['devtools/rootAnalysis', 'devtools/gc-ubench', 'devtools/gctrace']:
with Files(gcfile):
BUG_COMPONENT = component_gc
for stlfile in ['jsdate.*', 'jsnum.*']:
with Files(stlfile):
BUG_COMPONENT = component_stl
with Files('builtin/intl/*'):
BUG_COMPONENT = component_intl
if CONFIG['ENABLE_WASM_CRANELIFT']:
CONFIGURE_SUBST_FILES += ['rust/extra-bindgen-flags']
if not CONFIG['JS_DISABLE_SHELL']:
DIRS += [
'rust',
'shell',
]
TEST_DIRS += [
'gdb',
'jsapi-tests',
'tests',
]
if CONFIG['FUZZING_INTERFACES']:
TEST_DIRS += [
'fuzz-tests',
]
if CONFIG['FUZZING_INTERFACES'] and CONFIG['LIBFUZZER']:
# In addition to regular coverage provided by trace-pc-guard,
# LibFuzzer can use trace-cmp to instrument various compare instructions.
# Only use this feature on source files that do a lot of constant
# comparisons that would otherwise be hard to guess by LibFuzzer,
# as it comes with a larger overhead (requires -use_value_profile=1).
include('/tools/fuzzing/libfuzzer-flags.mozbuild')
# Any files that are targeted by LibFuzzer should be added here so they can
# be built with the necessary instrumentation flags, rather than just building
# the whole JS engine with instrumentation, to reduce the amount of noise.
SOURCES += [
'vm/StructuredClone.cpp',
]
SOURCES['vm/StructuredClone.cpp'].flags += libfuzzer_flags
else:
UNIFIED_SOURCES += [
'vm/StructuredClone.cpp',
]
CONFIGURE_SUBST_FILES += [
'devtools/rootAnalysis/Makefile',
]
CONFIGURE_DEFINE_FILES += [
'js-confdefs.h',
]
if not CONFIG['JS_STANDALONE']:
CONFIGURE_SUBST_FILES += [
'../../config/autoconf-js.mk',
'../../config/emptyvars-js.mk',
]
CONFIGURE_DEFINE_FILES += [
'js-config.h',
]
if CONFIG['HAVE_DTRACE']:
GeneratedFile('javascript-trace.h')
EXPORTS += ['!javascript-trace.h']
# Changes to internal header files, used externally, massively slow down
# browser builds. Don't add new files here unless you know what you're
# doing!
EXPORTS += [
'!js-config.h',
'js.msg',
'jsapi.h',
'jsfriendapi.h',
'jspubtd.h',
'jstypes.h',
]
EXPORTS.js += [
'../public/AllocationRecording.h',
'../public/AllocPolicy.h',
'../public/Array.h',
'../public/ArrayBuffer.h',
'../public/ArrayBufferMaybeShared.h',
'../public/BinASTFormat.h',
'../public/BuildId.h',
'../public/CallArgs.h',
'../public/CallNonGenericMethod.h',
'../public/CharacterEncoding.h',
'../public/Class.h',
'../public/ComparisonOperators.h',
'../public/CompilationAndEvaluation.h',
'../public/CompileOptions.h',
'../public/ContextOptions.h',
'../public/Conversions.h',
'../public/Date.h',
'../public/Debug.h',
'../public/Equality.h',
'../public/ErrorReport.h',
'../public/Exception.h',
'../public/ForOfIterator.h',
'../public/GCAnnotations.h',
'../public/GCAPI.h',
'../public/GCHashTable.h',
'../public/GCPolicyAPI.h',
'../public/GCTypeMacros.h',
'../public/GCVariant.h',
'../public/GCVector.h',
'../public/HashTable.h',
'../public/HeapAPI.h',
'../public/Id.h',
'../public/Initialization.h',
'../public/JSON.h',
'../public/LocaleSensitive.h',
'../public/MemoryFunctions.h',
'../public/MemoryMetrics.h',
'../public/Modules.h',
'../public/OffThreadScriptCompilation.h',
'../public/Principals.h',
'../public/Printf.h',
'../public/ProfilingCategory.h',
'../public/ProfilingFrameIterator.h',
'../public/ProfilingStack.h',
'../public/Promise.h',
'../public/PropertyDescriptor.h',
'../public/PropertySpec.h',
'../public/ProtoKey.h',
'../public/Proxy.h',
'../public/Realm.h',
'../public/RealmOptions.h',
'../public/RefCounted.h',
'../public/RegExp.h',
'../public/RegExpFlags.h',
'../public/RequiredDefines.h',
'../public/Result.h',
'../public/RootingAPI.h',
'../public/SavedFrameAPI.h',
'../public/SharedArrayBuffer.h',
'../public/SliceBudget.h',
'../public/SourceText.h',
'../public/StableStringChars.h',
'../public/Stream.h',
'../public/StructuredClone.h',
'../public/SweepingAPI.h',
'../public/Symbol.h',
'../public/TraceKind.h',
'../public/TraceLoggerAPI.h',
'../public/TracingAPI.h',
'../public/Transcoding.h',
'../public/TypeDecls.h',
'../public/UbiNode.h',
'../public/UbiNodeBreadthFirst.h',
'../public/UbiNodeCensus.h',
'../public/UbiNodeDominatorTree.h',
'../public/UbiNodePostOrder.h',
'../public/UbiNodeShortestPaths.h',
'../public/UbiNodeUtils.h',
'../public/UniquePtr.h',
'../public/Utility.h',
'../public/Value.h',
'../public/ValueArray.h',
'../public/Vector.h',
'../public/Warnings.h',
'../public/WeakMapPtr.h',
'../public/Wrapper.h',
]
EXPORTS.js.experimental += [
'../public/experimental/SourceHook.h',
]
UNIFIED_SOURCES += [
'builtin/Array.cpp',
'builtin/AtomicsObject.cpp',
'builtin/BigInt.cpp',
'builtin/Boolean.cpp',
'builtin/DataViewObject.cpp',
'builtin/Eval.cpp',
'builtin/FinalizationRegistryObject.cpp',
'builtin/JSON.cpp',
'builtin/MapObject.cpp',
'builtin/ModuleObject.cpp',
'builtin/Object.cpp',
'builtin/Profilers.cpp',
'builtin/Promise.cpp',
'builtin/Reflect.cpp',
'builtin/ReflectParse.cpp',
'builtin/Stream.cpp',
'builtin/streams/MiscellaneousOperations.cpp',
'builtin/streams/PipeToState.cpp',
'builtin/streams/PullIntoDescriptor.cpp',
'builtin/streams/QueueingStrategies.cpp',
'builtin/streams/QueueWithSizes.cpp',
'builtin/streams/ReadableStream.cpp',
'builtin/streams/ReadableStreamBYOBReader.cpp',
'builtin/streams/ReadableStreamDefaultController.cpp',
'builtin/streams/ReadableStreamDefaultControllerOperations.cpp',
'builtin/streams/ReadableStreamDefaultReader.cpp',
'builtin/streams/ReadableStreamInternals.cpp',
'builtin/streams/ReadableStreamOperations.cpp',
'builtin/streams/ReadableStreamReader.cpp',
'builtin/streams/StreamAPI.cpp',
'builtin/streams/TeeState.cpp',
'builtin/streams/WritableStream.cpp',
'builtin/streams/WritableStreamDefaultController.cpp',
'builtin/streams/WritableStreamDefaultControllerOperations.cpp',
'builtin/streams/WritableStreamDefaultWriter.cpp',
'builtin/streams/WritableStreamOperations.cpp',
'builtin/streams/WritableStreamWriterOperations.cpp',
'builtin/String.cpp',
'builtin/Symbol.cpp',
'builtin/TestingFunctions.cpp',
'builtin/TypedObject.cpp',
'builtin/WeakMapObject.cpp',
'builtin/WeakRefObject.cpp',
'builtin/WeakSetObject.cpp',
'ds/Bitmap.cpp',
'ds/LifoAlloc.cpp',
'ds/MemoryProtectionExceptionHandler.cpp',
'jsapi.cpp',
'jsdate.cpp',
'jsexn.cpp',
'jsfriendapi.cpp',
'jsnum.cpp',
'proxy/BaseProxyHandler.cpp',
'proxy/CrossCompartmentWrapper.cpp',
'proxy/DeadObjectProxy.cpp',
'proxy/OpaqueCrossCompartmentWrapper.cpp',
'proxy/Proxy.cpp',
'proxy/ScriptedProxyHandler.cpp',
'proxy/SecurityWrapper.cpp',
'proxy/Wrapper.cpp',
'threading/Mutex.cpp',
'threading/ProtectedData.cpp',
'threading/Thread.cpp',
'util/AllocPolicy.cpp',
'util/CompleteFile.cpp',
'util/NativeStack.cpp',
'util/Printf.cpp',
'util/StringBuffer.cpp',
'util/StructuredSpewer.cpp',
'util/Text.cpp',
'util/Unicode.cpp',
'vm/Activation.cpp',
'vm/ArgumentsObject.cpp',
'vm/ArrayBufferObject.cpp',
'vm/ArrayBufferObjectMaybeShared.cpp',
'vm/ArrayBufferViewObject.cpp',
'vm/AsyncFunction.cpp',
'vm/AsyncIteration.cpp',
'vm/BigIntType.cpp',
'vm/BuildId.cpp',
'vm/BytecodeLocation.cpp',
'vm/BytecodeUtil.cpp',
'vm/Caches.cpp',
'vm/CallNonGenericMethod.cpp',
'vm/CharacterEncoding.cpp',
'vm/CodeCoverage.cpp',
'vm/Compartment.cpp',
'vm/CompilationAndEvaluation.cpp',
'vm/Compression.cpp',
'vm/DateTime.cpp',
'vm/EnvironmentObject.cpp',
'vm/EqualityOperations.cpp',
'vm/ErrorObject.cpp',
'vm/ErrorReporting.cpp',
'vm/Exception.cpp',
'vm/ForOfIterator.cpp',
'vm/FrameIter.cpp',
'vm/FunctionFlags.cpp',
'vm/GeckoProfiler.cpp',
'vm/GeneratorObject.cpp',
'vm/GlobalObject.cpp',
'vm/HelperThreads.cpp',
'vm/Id.cpp',
'vm/Initialization.cpp',
'vm/Instrumentation.cpp',
'vm/Iteration.cpp',
'vm/JitActivation.cpp',
'vm/JSAtom.cpp',
'vm/JSContext.cpp',
'vm/JSFunction.cpp',
'vm/JSObject.cpp',
'vm/JSONParser.cpp',
'vm/JSONPrinter.cpp',
'vm/JSScript.cpp',
'vm/List.cpp',
'vm/MemoryMetrics.cpp',
'vm/Modules.cpp',
'vm/NativeObject.cpp',
'vm/ObjectGroup.cpp',
'vm/OffThreadPromiseRuntimeState.cpp',
'vm/OffThreadScriptCompilation.cpp',
'vm/PIC.cpp',
'vm/PlainObject.cpp',
'vm/Printer.cpp',
'vm/Probes.cpp',
'vm/PromiseLookup.cpp',
'vm/ProxyObject.cpp',
'vm/Realm.cpp',
'vm/ReceiverGuard.cpp',
'vm/RegExpObject.cpp',
'vm/RegExpStatics.cpp',
'vm/Runtime.cpp',
'vm/SavedStacks.cpp',
'vm/Scope.cpp',
'vm/SelfHosting.cpp',
'vm/Shape.cpp',
'vm/SharedArrayObject.cpp',
'vm/SharedImmutableStringsCache.cpp',
'vm/SourceHook.cpp',
'vm/Stack.cpp',
'vm/StringType.cpp',
'vm/SymbolType.cpp',
'vm/TaggedProto.cpp',
'vm/ThrowMsgKind.cpp',
'vm/Time.cpp',
'vm/ToSource.cpp',
'vm/TypedArrayObject.cpp',
'vm/TypeInference.cpp',
'vm/UbiNode.cpp',
'vm/UbiNodeCensus.cpp',
'vm/UbiNodeShortestPaths.cpp',
'vm/Value.cpp',
'vm/Warnings.cpp',
'vm/Xdr.cpp',
]
# builtin/RegExp.cpp cannot be built in unified mode because it causes huge
# win32 test slowdowns
# jsmath.cpp cannot be built in unified mode because it needs to re-#define the
# RtlGenRandom declaration's calling convention in <ntsecapi.h> on Windows.
# util/DoubleToString.cpp cannot be built in unified mode because we want to
# suppress compiler warnings in third-party dtoa.c.
# util/Utility.cpp cannot be built in unified mode because it is needed for
# check-vanilla-allocations.
# vm/Interpreter.cpp is gigantic and destroys incremental build times for any
# files unlucky enough to be unified with it.
SOURCES += [
'builtin/RegExp.cpp',
'jsmath.cpp',
'util/DoubleToString.cpp',
'util/Utility.cpp',
'vm/Interpreter.cpp',
'vm/ProfilingStack.cpp',
]
if CONFIG['JS_HAS_INTL_API']:
UNIFIED_SOURCES += [
'builtin/intl/Collator.cpp',
'builtin/intl/CommonFunctions.cpp',
'builtin/intl/DateTimeFormat.cpp',
'builtin/intl/DisplayNames.cpp',
'builtin/intl/IntlObject.cpp',
'builtin/intl/LanguageTag.cpp',
'builtin/intl/LanguageTagGenerated.cpp',
'builtin/intl/ListFormat.cpp',
'builtin/intl/Locale.cpp',
'builtin/intl/NumberFormat.cpp',
'builtin/intl/PluralRules.cpp',
'builtin/intl/RelativeTimeFormat.cpp',
'builtin/intl/SharedIntlData.cpp',
]
if CONFIG['MOZ_INSTRUMENTS']:
SOURCES += [
'devtools/Instruments.cpp',
]
if CONFIG['ENABLE_TRACE_LOGGING']:
SOURCES += [
'vm/TraceLogging.cpp',
'vm/TraceLoggingGraph.cpp',
'vm/TraceLoggingTypes.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
UNIFIED_SOURCES += [
'threading/windows/CpuCount.cpp',
'threading/windows/WindowsThread.cpp',
]
else:
UNIFIED_SOURCES += [
'threading/posix/CpuCount.cpp',
'threading/posix/PosixThread.cpp',
]
if CONFIG['JS_HAS_CTYPES']:
SOURCES += [
'ctypes/CTypes.cpp',
'ctypes/Library.cpp',
]
if not CONFIG['MOZ_SYSTEM_FFI']:
LOCAL_INCLUDES += [
'!ctypes/libffi/include',
'ctypes/libffi/src/%s' % CONFIG['FFI_TARGET_DIR'],
]
if CONFIG['MOZ_VTUNE']:
SOURCES += [
'vtune/ittnotify_static.c',
'vtune/jitprofiling.c',
'vtune/VTuneWrapper.cpp',
]
SOURCES['vtune/ittnotify_static.c'].flags += [
'-Wno-varargs',
'-Wno-unknown-pragmas'
]
if CONFIG['CC_TYPE'] == 'gcc':
SOURCES['vtune/ittnotify_static.c'].flags += [
'-Wno-stringop-overflow'
]
if not CONFIG['ENABLE_NEW_REGEXP']:
UNIFIED_SOURCES += [
'irregexp/NativeRegExpMacroAssembler.cpp',
'irregexp/RegExpAST.cpp',
'irregexp/RegExpCharacters.cpp',
'irregexp/RegExpEngine.cpp',
'irregexp/RegExpInterpreter.cpp',
'irregexp/RegExpMacroAssembler.cpp',
'irregexp/RegExpParser.cpp',
'irregexp/RegExpStack.cpp',
]
DIRS += [
'build',
'debugger',
'frontend',
'gc',
'jit',
'wasm',
] + (['new-regexp'] if CONFIG['ENABLE_NEW_REGEXP'] else [])
if CONFIG['JS_JITSPEW']:
DIRS += ['zydis']
FINAL_LIBRARY = 'js'
selfhosted_inputs = [
'js.msg',
'builtin/TypedObjectConstants.h',
'builtin/SelfHostingDefines.h',
'builtin/Utilities.js',
'builtin/Array.js',
'builtin/AsyncFunction.js',
'builtin/AsyncIteration.js',
'builtin/BigInt.js',
'builtin/Classes.js',
'builtin/Date.js',
'builtin/Error.js',
'builtin/Function.js',
'builtin/Generator.js',
'builtin/Iterator.js',
'builtin/Map.js',
'builtin/Module.js',
'builtin/Number.js',
'builtin/Object.js',
'builtin/Promise.js',
'builtin/Reflect.js',
'builtin/RegExp.js',
'builtin/RegExpGlobalReplaceOpt.h.js',
'builtin/RegExpLocalReplaceOpt.h.js',
'builtin/String.js',
'builtin/Set.js',
'builtin/Sorting.js',
'builtin/TypedArray.js',
'builtin/TypedObject.js',
'builtin/WeakMap.js',
'builtin/WeakSet.js'
] + ([
'builtin/intl/Collator.js',
'builtin/intl/CommonFunctions.js',
'builtin/intl/CurrencyDataGenerated.js',
'builtin/intl/DateTimeFormat.js',
'builtin/intl/DisplayNames.js',
'builtin/intl/IntlObject.js',
'builtin/intl/ListFormat.js',
'builtin/intl/NumberFormat.js',
'builtin/intl/PluralRules.js',
'builtin/intl/RelativeTimeFormat.js',
'builtin/intl/SanctionedSimpleUnitIdentifiersGenerated.js',
] if CONFIG['JS_HAS_INTL_API'] else [])
# Prepare self-hosted JS code for embedding
GeneratedFile('selfhosted.out.h', 'selfhosted.js',
script='builtin/embedjs.py',
entry_point='generate_selfhosted',
inputs=selfhosted_inputs)
if CONFIG['JS_HAS_CTYPES']:
if CONFIG['MOZ_SYSTEM_FFI']:
CXXFLAGS += CONFIG['MOZ_FFI_CFLAGS']
# Suppress warnings in third-party code.
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
SOURCES['util/DoubleToString.cpp'].flags += ['-Wno-implicit-fallthrough']