1c74c72f85f4aca00f174acf014445d7d829e549
[WebKit-https.git] / Source / JavaScriptCore / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.12)
2 include(WebKitCommon)
3
4 set(JavaScriptCore_INCLUDE_DIRECTORIES
5     "${CMAKE_BINARY_DIR}"
6     "${JAVASCRIPTCORE_DIR}"
7     "${JAVASCRIPTCORE_DIR}/.."
8     "${JAVASCRIPTCORE_DIR}/API"
9     "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
10     "${JAVASCRIPTCORE_DIR}/assembler"
11     "${JAVASCRIPTCORE_DIR}/bindings"
12     "${JAVASCRIPTCORE_DIR}/builtins"
13     "${JAVASCRIPTCORE_DIR}/bytecode"
14     "${JAVASCRIPTCORE_DIR}/bytecompiler"
15     "${JAVASCRIPTCORE_DIR}/dfg"
16     "${JAVASCRIPTCORE_DIR}/disassembler"
17     "${JAVASCRIPTCORE_DIR}/ftl"
18     "${JAVASCRIPTCORE_DIR}/heap"
19     "${JAVASCRIPTCORE_DIR}/debugger"
20     "${JAVASCRIPTCORE_DIR}/inspector"
21     "${JAVASCRIPTCORE_DIR}/inspector/agents"
22     "${JAVASCRIPTCORE_DIR}/inspector/augmentable"
23     "${JAVASCRIPTCORE_DIR}/inspector/remote"
24     "${JAVASCRIPTCORE_DIR}/interpreter"
25     "${JAVASCRIPTCORE_DIR}/jit"
26     "${JAVASCRIPTCORE_DIR}/llint"
27     "${JAVASCRIPTCORE_DIR}/llvm"
28     "${JAVASCRIPTCORE_DIR}/parser"
29     "${JAVASCRIPTCORE_DIR}/profiler"
30     "${JAVASCRIPTCORE_DIR}/replay"
31     "${JAVASCRIPTCORE_DIR}/runtime"
32     "${JAVASCRIPTCORE_DIR}/tools"
33     "${JAVASCRIPTCORE_DIR}/wasm"
34     "${JAVASCRIPTCORE_DIR}/yarr"
35     "${DERIVED_SOURCES_DIR}"
36     "${DERIVED_SOURCES_DIR}/ForwardingHeaders"
37     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
38     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector"
39 )
40
41 set(JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES
42     "${ICU_INCLUDE_DIRS}"
43 )
44
45 set(JavaScriptCore_SOURCES
46     API/JSBase.cpp
47     API/JSCTestRunnerUtils.cpp
48     API/JSCallbackConstructor.cpp
49     API/JSCallbackFunction.cpp
50     API/JSCallbackObject.cpp
51     API/JSClassRef.cpp
52     API/JSContextRef.cpp
53     API/JSObjectRef.cpp
54     API/JSProfilerPrivate.cpp
55     API/JSScriptRef.cpp
56     API/JSStringRef.cpp
57     API/JSValueRef.cpp
58     API/JSWeakObjectMapRefPrivate.cpp
59     API/OpaqueJSString.cpp
60
61     assembler/ARMAssembler.cpp
62     assembler/LinkBuffer.cpp
63     assembler/MacroAssembler.cpp
64     assembler/MacroAssemblerARM.cpp
65     assembler/MacroAssemblerARMv7.cpp
66     assembler/MacroAssemblerPrinter.cpp
67     assembler/MacroAssemblerX86Common.cpp
68
69     bindings/ScriptFunctionCall.cpp
70     bindings/ScriptObject.cpp
71     bindings/ScriptValue.cpp
72
73     builtins/BuiltinExecutables.cpp
74
75     bytecode/ArrayAllocationProfile.cpp
76     bytecode/ArrayProfile.cpp
77     bytecode/BytecodeBasicBlock.cpp
78     bytecode/BytecodeIntrinsicRegistry.cpp
79     bytecode/BytecodeLivenessAnalysis.cpp
80     bytecode/CallEdge.cpp
81     bytecode/CallLinkInfo.cpp
82     bytecode/CallLinkStatus.cpp
83     bytecode/CallMode.cpp
84     bytecode/CallVariant.cpp
85     bytecode/CodeBlock.cpp
86     bytecode/CodeBlockHash.cpp
87     bytecode/CodeBlockJettisoningWatchpoint.cpp
88     bytecode/CodeOrigin.cpp
89     bytecode/CodeType.cpp
90     bytecode/ComplexGetStatus.cpp
91     bytecode/DataFormat.cpp
92     bytecode/DFGExitProfile.cpp
93     bytecode/DeferredCompilationCallback.cpp
94     bytecode/DeferredSourceDump.cpp
95     bytecode/ExecutionCounter.cpp
96     bytecode/ExitKind.cpp
97     bytecode/ExitingJITType.cpp
98     bytecode/GetByIdStatus.cpp
99     bytecode/GetByIdVariant.cpp
100     bytecode/InlineCallFrame.cpp
101     bytecode/InlineCallFrameSet.cpp
102     bytecode/JumpTable.cpp
103     bytecode/LazyOperandValueProfile.cpp
104     bytecode/MethodOfGettingAValueProfile.cpp
105     bytecode/ObjectPropertyCondition.cpp
106     bytecode/ObjectPropertyConditionSet.cpp
107     bytecode/Opcode.cpp
108     bytecode/PolymorphicAccess.cpp
109     bytecode/PreciseJumpTargets.cpp
110     bytecode/PropertyCondition.cpp
111     bytecode/PutByIdFlags.cpp
112     bytecode/PutByIdStatus.cpp
113     bytecode/PutByIdVariant.cpp
114     bytecode/ReduceWhitespace.cpp
115     bytecode/SamplingTool.cpp
116     bytecode/SpecialPointer.cpp
117     bytecode/SpeculatedType.cpp
118     bytecode/StructureSet.cpp
119     bytecode/StructureStubClearingWatchpoint.cpp
120     bytecode/StructureStubInfo.cpp
121     bytecode/ToThisStatus.cpp
122     bytecode/TrackedReferences.cpp
123     bytecode/UnlinkedCodeBlock.cpp
124     bytecode/UnlinkedFunctionExecutable.cpp
125     bytecode/UnlinkedInstructionStream.cpp
126     bytecode/ValueRecovery.cpp
127     bytecode/VariableWriteFireDetail.cpp
128     bytecode/VirtualRegister.cpp
129     bytecode/Watchpoint.cpp
130
131     bytecompiler/BytecodeGenerator.cpp
132     bytecompiler/NodesCodegen.cpp
133
134     debugger/Debugger.cpp
135     debugger/DebuggerCallFrame.cpp
136     debugger/DebuggerScope.cpp
137
138     dfg/DFGAbstractHeap.cpp
139     dfg/DFGAbstractValue.cpp
140     dfg/DFGAdaptiveInferredPropertyValueWatchpoint.cpp
141     dfg/DFGAdaptiveStructureWatchpoint.cpp
142     dfg/DFGArgumentsEliminationPhase.cpp
143     dfg/DFGArgumentsUtilities.cpp
144     dfg/DFGArithMode.cpp
145     dfg/DFGArrayMode.cpp
146     dfg/DFGAtTailAbstractState.cpp
147     dfg/DFGAvailability.cpp
148     dfg/DFGAvailabilityMap.cpp
149     dfg/DFGBackwardsPropagationPhase.cpp
150     dfg/DFGBasicBlock.cpp
151     dfg/DFGBlockInsertionSet.cpp
152     dfg/DFGBlockSet.cpp
153     dfg/DFGByteCodeParser.cpp
154     dfg/DFGCFAPhase.cpp
155     dfg/DFGCFGSimplificationPhase.cpp
156     dfg/DFGCPSRethreadingPhase.cpp
157     dfg/DFGCSEPhase.cpp
158     dfg/DFGCapabilities.cpp
159     dfg/DFGCleanUpPhase.cpp
160     dfg/DFGClobberSet.cpp
161     dfg/DFGClobberize.cpp
162     dfg/DFGClobbersExitState.cpp
163     dfg/DFGCombinedLiveness.cpp
164     dfg/DFGCommon.cpp
165     dfg/DFGCommonData.cpp
166     dfg/DFGCompilationKey.cpp
167     dfg/DFGCompilationMode.cpp
168     dfg/DFGConstantFoldingPhase.cpp
169     dfg/DFGConstantHoistingPhase.cpp
170     dfg/DFGCopyBarrierOptimizationPhase.cpp
171     dfg/DFGCriticalEdgeBreakingPhase.cpp
172     dfg/DFGDCEPhase.cpp
173     dfg/DFGDesiredIdentifiers.cpp
174     dfg/DFGDesiredTransitions.cpp
175     dfg/DFGDesiredWatchpoints.cpp
176     dfg/DFGDesiredWeakReferences.cpp
177     dfg/DFGDisassembler.cpp
178     dfg/DFGDoesGC.cpp
179     dfg/DFGDominators.cpp
180     dfg/DFGDriver.cpp
181     dfg/DFGEdge.cpp
182     dfg/DFGEpoch.cpp
183     dfg/DFGFailedFinalizer.cpp
184     dfg/DFGFinalizer.cpp
185     dfg/DFGFixupPhase.cpp
186     dfg/DFGFlushFormat.cpp
187     dfg/DFGFlushedAt.cpp
188     dfg/DFGLiveCatchVariablePreservationPhase.cpp
189     dfg/DFGFrozenValue.cpp
190     dfg/DFGFunctionWhitelist.cpp
191     dfg/DFGGraph.cpp
192     dfg/DFGGraphSafepoint.cpp
193     dfg/DFGHeapLocation.cpp
194     dfg/DFGInPlaceAbstractState.cpp
195     dfg/DFGInferredTypeCheck.cpp
196     dfg/DFGInsertionSet.cpp
197     dfg/DFGIntegerCheckCombiningPhase.cpp
198     dfg/DFGIntegerRangeOptimizationPhase.cpp
199     dfg/DFGInvalidationPointInjectionPhase.cpp
200     dfg/DFGJITCode.cpp
201     dfg/DFGJITCompiler.cpp
202     dfg/DFGJITFinalizer.cpp
203     dfg/DFGJumpReplacement.cpp
204     dfg/DFGLICMPhase.cpp
205     dfg/DFGLazyJSValue.cpp
206     dfg/DFGLazyNode.cpp
207     dfg/DFGLivenessAnalysisPhase.cpp
208     dfg/DFGLongLivedState.cpp
209     dfg/DFGLoopPreHeaderCreationPhase.cpp
210     dfg/DFGMaximalFlushInsertionPhase.cpp
211     dfg/DFGMayExit.cpp
212     dfg/DFGMinifiedGraph.cpp
213     dfg/DFGMinifiedNode.cpp
214     dfg/DFGMovHintRemovalPhase.cpp
215     dfg/DFGMultiGetByOffsetData.cpp
216     dfg/DFGNaiveDominators.cpp
217     dfg/DFGNaturalLoops.cpp
218     dfg/DFGNode.cpp
219     dfg/DFGNodeFlags.cpp
220     dfg/DFGNodeOrigin.cpp
221     dfg/DFGOSRAvailabilityAnalysisPhase.cpp
222     dfg/DFGOSREntry.cpp
223     dfg/DFGOSREntrypointCreationPhase.cpp
224     dfg/DFGOSRExit.cpp
225     dfg/DFGOSRExitBase.cpp
226     dfg/DFGOSRExitCompiler.cpp
227     dfg/DFGOSRExitCompiler32_64.cpp
228     dfg/DFGOSRExitCompiler64.cpp
229     dfg/DFGOSRExitCompilerCommon.cpp
230     dfg/DFGOSRExitFuzz.cpp
231     dfg/DFGOSRExitJumpPlaceholder.cpp
232     dfg/DFGOSRExitPreparation.cpp
233     dfg/DFGObjectAllocationSinkingPhase.cpp
234     dfg/DFGObjectMaterializationData.cpp
235     dfg/DFGOperations.cpp
236     dfg/DFGPhantomInsertionPhase.cpp
237     dfg/DFGPhase.cpp
238     dfg/DFGPhiChildren.cpp
239     dfg/DFGPlan.cpp
240     dfg/DFGPrePostNumbering.cpp
241     dfg/DFGPredictionInjectionPhase.cpp
242     dfg/DFGPredictionPropagationPhase.cpp
243     dfg/DFGPromotedHeapLocation.cpp
244     dfg/DFGPureValue.cpp
245     dfg/DFGPutStackSinkingPhase.cpp
246     dfg/DFGSSACalculator.cpp
247     dfg/DFGSSAConversionPhase.cpp
248     dfg/DFGSSALoweringPhase.cpp
249     dfg/DFGSafepoint.cpp
250     dfg/DFGSpeculativeJIT.cpp
251     dfg/DFGSpeculativeJIT32_64.cpp
252     dfg/DFGSpeculativeJIT64.cpp
253     dfg/DFGStackLayoutPhase.cpp
254     dfg/DFGStaticExecutionCountEstimationPhase.cpp
255     dfg/DFGStoreBarrierInsertionPhase.cpp
256     dfg/DFGStrengthReductionPhase.cpp
257     dfg/DFGStructureAbstractValue.cpp
258     dfg/DFGStructureRegistrationPhase.cpp
259     dfg/DFGThreadData.cpp
260     dfg/DFGThunks.cpp
261     dfg/DFGTierUpCheckInjectionPhase.cpp
262     dfg/DFGTransition.cpp
263     dfg/DFGTypeCheckHoistingPhase.cpp
264     dfg/DFGUnificationPhase.cpp
265     dfg/DFGUseKind.cpp
266     dfg/DFGValidate.cpp
267     dfg/DFGValueSource.cpp
268     dfg/DFGValueStrength.cpp
269     dfg/DFGVarargsForwardingPhase.cpp
270     dfg/DFGVariableAccessData.cpp
271     dfg/DFGVariableAccessDataDump.cpp
272     dfg/DFGVariableEvent.cpp
273     dfg/DFGVariableEventStream.cpp
274     dfg/DFGVirtualRegisterAllocationPhase.cpp
275     dfg/DFGWatchpointCollectionPhase.cpp
276     dfg/DFGWorklist.cpp
277
278     disassembler/ARM64Disassembler.cpp
279     disassembler/ARMv7Disassembler.cpp
280     disassembler/Disassembler.cpp
281     disassembler/LLVMDisassembler.cpp
282     disassembler/X86Disassembler.cpp
283
284     disassembler/ARM64/A64DOpcode.cpp
285
286     disassembler/ARMv7/ARMv7DOpcode.cpp
287
288     heap/CodeBlockSet.cpp
289     heap/ConservativeRoots.cpp
290     heap/CopiedBlock.cpp
291     heap/CopiedSpace.cpp
292     heap/CopyVisitor.cpp
293     heap/DeferGC.cpp
294     heap/EdenGCActivityCallback.cpp
295     heap/FullGCActivityCallback.cpp
296     heap/GCActivityCallback.cpp
297     heap/GCLogging.cpp
298     heap/HandleSet.cpp
299     heap/HandleStack.cpp
300     heap/Heap.cpp
301     heap/HeapHelperPool.cpp
302     heap/HeapStatistics.cpp
303     heap/HeapTimer.cpp
304     heap/HeapVerifier.cpp
305     heap/IncrementalSweeper.cpp
306     heap/JITStubRoutineSet.cpp
307     heap/LiveObjectList.cpp
308     heap/MachineStackMarker.cpp
309     heap/MarkStack.cpp
310     heap/MarkedAllocator.cpp
311     heap/MarkedBlock.cpp
312     heap/MarkedSpace.cpp
313     heap/SlotVisitor.cpp
314     heap/Weak.cpp
315     heap/WeakBlock.cpp
316     heap/WeakHandleOwner.cpp
317     heap/WeakSet.cpp
318     heap/WriteBarrierBuffer.cpp
319     heap/WriteBarrierSupport.cpp
320
321     inspector/ConsoleMessage.cpp
322     inspector/ContentSearchUtilities.cpp
323     inspector/EventLoop.cpp
324     inspector/IdentifiersFactory.cpp
325     inspector/InjectedScript.cpp
326     inspector/InjectedScriptBase.cpp
327     inspector/InjectedScriptHost.cpp
328     inspector/InjectedScriptManager.cpp
329     inspector/InjectedScriptModule.cpp
330     inspector/InspectorAgentRegistry.cpp
331     inspector/InspectorFrontendRouter.cpp
332     inspector/InspectorBackendDispatcher.cpp
333     inspector/InspectorValues.cpp
334     inspector/JSGlobalObjectConsoleClient.cpp
335     inspector/JSGlobalObjectInspectorController.cpp
336     inspector/JSGlobalObjectScriptDebugServer.cpp
337     inspector/JSInjectedScriptHost.cpp
338     inspector/JSInjectedScriptHostPrototype.cpp
339     inspector/JSJavaScriptCallFrame.cpp
340     inspector/JSJavaScriptCallFramePrototype.cpp
341     inspector/JavaScriptCallFrame.cpp
342     inspector/ScriptArguments.cpp
343     inspector/ScriptCallFrame.cpp
344     inspector/ScriptCallStack.cpp
345     inspector/ScriptCallStackFactory.cpp
346     inspector/ScriptDebugServer.cpp
347
348     inspector/agents/InspectorAgent.cpp
349     inspector/agents/InspectorConsoleAgent.cpp
350     inspector/agents/InspectorDebuggerAgent.cpp
351     inspector/agents/InspectorHeapAgent.cpp
352     inspector/agents/InspectorRuntimeAgent.cpp
353     inspector/agents/JSGlobalObjectConsoleAgent.cpp
354     inspector/agents/JSGlobalObjectDebuggerAgent.cpp
355     inspector/agents/JSGlobalObjectRuntimeAgent.cpp
356
357     interpreter/AbstractPC.cpp
358     interpreter/CallFrame.cpp
359     interpreter/Interpreter.cpp
360     interpreter/JSStack.cpp
361     interpreter/ProtoCallFrame.cpp
362     interpreter/StackVisitor.cpp
363
364     jit/AssemblyHelpers.cpp
365     jit/BinarySwitch.cpp
366     jit/CachedRecovery.cpp
367     jit/CallFrameShuffleData.cpp
368     jit/CallFrameShuffler.cpp
369     jit/CallFrameShuffler32_64.cpp
370     jit/CallFrameShuffler64.cpp
371     jit/ExecutableAllocationFuzz.cpp
372     jit/ExecutableAllocator.cpp
373     jit/ExecutableAllocatorFixedVMPool.cpp
374     jit/GCAwareJITStubRoutine.cpp
375     jit/HostCallReturnValue.cpp
376     jit/IntrinsicEmitter.cpp
377     jit/JIT.cpp
378     jit/JITArithmetic.cpp
379     jit/JITArithmetic32_64.cpp
380     jit/JITCall.cpp
381     jit/JITCall32_64.cpp
382     jit/JITCode.cpp
383     jit/JITDisassembler.cpp
384     jit/JITExceptions.cpp
385     jit/JITInlineCacheGenerator.cpp
386     jit/JITOpcodes.cpp
387     jit/JITOpcodes32_64.cpp
388     jit/JITOperations.cpp
389     jit/JITPropertyAccess.cpp
390     jit/JITPropertyAccess32_64.cpp
391     jit/JITStubRoutine.cpp
392     jit/JITThunks.cpp
393     jit/JITToDFGDeferredCompilationCallback.cpp
394     jit/PolymorphicCallStubRoutine.cpp
395     jit/Reg.cpp
396     jit/RegisterAtOffset.cpp
397     jit/RegisterAtOffsetList.cpp
398     jit/RegisterSet.cpp
399     jit/Repatch.cpp
400     jit/ScratchRegisterAllocator.cpp
401     jit/SetupVarargsFrame.cpp
402     jit/TempRegisterSet.cpp
403     jit/ThunkGenerators.cpp
404
405     parser/Lexer.cpp
406     parser/ModuleAnalyzer.cpp
407     parser/Nodes.cpp
408     parser/NodesAnalyzeModule.cpp
409     parser/Parser.cpp
410     parser/ParserArena.cpp
411     parser/SourceCode.cpp
412     parser/SourceProvider.cpp
413     parser/SourceProviderCache.cpp
414     parser/VariableEnvironment.cpp
415
416     profiler/LegacyProfiler.cpp
417     profiler/Profile.cpp
418     profiler/ProfileGenerator.cpp
419     profiler/ProfileNode.cpp
420     profiler/ProfilerBytecode.cpp
421     profiler/ProfilerBytecodeSequence.cpp
422     profiler/ProfilerBytecodes.cpp
423     profiler/ProfilerCompilation.cpp
424     profiler/ProfilerCompilationKind.cpp
425     profiler/ProfilerCompiledBytecode.cpp
426     profiler/ProfilerDatabase.cpp
427     profiler/ProfilerJettisonReason.cpp
428     profiler/ProfilerOSRExit.cpp
429     profiler/ProfilerOSRExitSite.cpp
430     profiler/ProfilerOrigin.cpp
431     profiler/ProfilerOriginStack.cpp
432     profiler/ProfilerProfiledBytecodes.cpp
433
434     tools/CodeProfile.cpp
435     tools/CodeProfiling.cpp
436     tools/FunctionOverrides.cpp
437     tools/JSDollarVM.cpp
438     tools/JSDollarVMPrototype.cpp
439
440     wasm/JSWASMModule.cpp
441     wasm/WASMFunctionParser.cpp
442     wasm/WASMModuleParser.cpp
443     wasm/WASMReader.cpp
444
445     yarr/RegularExpression.cpp
446     yarr/YarrCanonicalizeUCS2.cpp
447     yarr/YarrInterpreter.cpp
448     yarr/YarrJIT.cpp
449     yarr/YarrPattern.cpp
450     yarr/YarrSyntaxChecker.cpp
451 )
452
453 set(JavaScriptCore_RUNTIME_SOURCES
454     runtime/ArgList.cpp
455     runtime/ArrayBuffer.cpp
456     runtime/ArrayBufferNeuteringWatchpoint.cpp
457     runtime/ArrayBufferView.cpp
458     runtime/ArrayConstructor.cpp
459     runtime/ArrayIteratorPrototype.cpp
460     runtime/ArrayPrototype.cpp
461     runtime/BasicBlockLocation.cpp
462     runtime/BooleanConstructor.cpp
463     runtime/BooleanObject.cpp
464     runtime/BooleanPrototype.cpp
465     runtime/CallData.cpp
466     runtime/ClonedArguments.cpp
467     runtime/CodeCache.cpp
468     runtime/CodeSpecializationKind.cpp
469     runtime/CommonIdentifiers.cpp
470     runtime/CommonSlowPaths.cpp
471     runtime/CommonSlowPathsExceptions.cpp
472     runtime/CompilationResult.cpp
473     runtime/Completion.cpp
474     runtime/ConsoleClient.cpp
475     runtime/ConsolePrototype.cpp
476     runtime/ConstantMode.cpp
477     runtime/ConstructData.cpp
478     runtime/ControlFlowProfiler.cpp
479     runtime/CustomGetterSetter.cpp
480     runtime/DataView.cpp
481     runtime/DateConstructor.cpp
482     runtime/DateConversion.cpp
483     runtime/DateInstance.cpp
484     runtime/DatePrototype.cpp
485     runtime/DirectArguments.cpp
486     runtime/DirectArgumentsOffset.cpp
487     runtime/DumpContext.cpp
488     runtime/Error.cpp
489     runtime/ErrorConstructor.cpp
490     runtime/ErrorHandlingScope.cpp
491     runtime/ErrorInstance.cpp
492     runtime/ErrorPrototype.cpp
493     runtime/Exception.cpp
494     runtime/ExceptionFuzz.cpp
495     runtime/ExceptionHelpers.cpp
496     runtime/Executable.cpp
497     runtime/FunctionConstructor.cpp
498     runtime/FunctionExecutableDump.cpp
499     runtime/FunctionHasExecutedCache.cpp
500     runtime/FunctionPrototype.cpp
501     runtime/FunctionRareData.cpp
502     runtime/GetterSetter.cpp
503     runtime/Identifier.cpp
504     runtime/IndexingType.cpp
505     runtime/InferredType.cpp
506     runtime/InferredTypeTable.cpp
507     runtime/InferredValue.cpp
508     runtime/InitializeThreading.cpp
509     runtime/InspectorInstrumentationObject.cpp
510     runtime/InternalFunction.cpp
511     runtime/IntlCollator.cpp
512     runtime/IntlCollatorConstructor.cpp
513     runtime/IntlCollatorPrototype.cpp
514     runtime/IntlDateTimeFormat.cpp
515     runtime/IntlDateTimeFormatConstructor.cpp
516     runtime/IntlDateTimeFormatPrototype.cpp
517     runtime/IntlNumberFormat.cpp
518     runtime/IntlNumberFormatConstructor.cpp
519     runtime/IntlNumberFormatPrototype.cpp
520     runtime/IntlObject.cpp
521     runtime/IteratorOperations.cpp
522     runtime/IteratorPrototype.cpp
523     runtime/JSAPIValueWrapper.cpp
524     runtime/JSArray.cpp
525     runtime/JSArrayBuffer.cpp
526     runtime/JSArrayBufferConstructor.cpp
527     runtime/JSArrayBufferPrototype.cpp
528     runtime/JSArrayBufferView.cpp
529     runtime/JSArrayIterator.cpp
530     runtime/JSArrowFunction.cpp
531     runtime/JSBoundFunction.cpp
532     runtime/JSCJSValue.cpp
533     runtime/JSCallee.cpp
534     runtime/JSCell.cpp
535     runtime/JSConsole.cpp
536     runtime/JSDataView.cpp
537     runtime/JSDataViewPrototype.cpp
538     runtime/JSDateMath.cpp
539     runtime/JSEnvironmentRecord.cpp
540     runtime/JSFunction.cpp
541     runtime/JSGlobalLexicalEnvironment.cpp
542     runtime/JSGlobalObject.cpp
543     runtime/JSGlobalObjectDebuggable.cpp
544     runtime/JSGlobalObjectFunctions.cpp
545     runtime/JSInternalPromise.cpp
546     runtime/JSInternalPromiseConstructor.cpp
547     runtime/JSInternalPromiseDeferred.cpp
548     runtime/JSInternalPromisePrototype.cpp
549     runtime/JSJob.cpp
550     runtime/JSLexicalEnvironment.cpp
551     runtime/JSLock.cpp
552     runtime/JSMap.cpp
553     runtime/JSMapIterator.cpp
554     runtime/JSModuleEnvironment.cpp
555     runtime/JSModuleNamespaceObject.cpp
556     runtime/JSModuleRecord.cpp
557     runtime/JSNativeStdFunction.cpp
558     runtime/JSNotAnObject.cpp
559     runtime/JSONObject.cpp
560     runtime/JSObject.cpp
561     runtime/JSPromise.cpp
562     runtime/JSPromiseConstructor.cpp
563     runtime/JSPromiseDeferred.cpp
564     runtime/JSPromisePrototype.cpp
565     runtime/JSPropertyNameEnumerator.cpp
566     runtime/JSPropertyNameIterator.cpp
567     runtime/JSProxy.cpp
568     runtime/JSScope.cpp
569     runtime/JSSegmentedVariableObject.cpp
570     runtime/JSSet.cpp
571     runtime/JSSetIterator.cpp
572     runtime/JSString.cpp
573     runtime/JSStringIterator.cpp
574     runtime/JSStringJoiner.cpp
575     runtime/JSSymbolTableObject.cpp
576     runtime/JSTemplateRegistryKey.cpp
577     runtime/JSTypedArrayConstructors.cpp
578     runtime/JSTypedArrayPrototypes.cpp
579     runtime/JSTypedArrayViewConstructor.cpp
580     runtime/JSTypedArrayViewPrototype.cpp
581     runtime/JSTypedArrays.cpp
582     runtime/JSWeakMap.cpp
583     runtime/JSWeakSet.cpp
584     runtime/JSWithScope.cpp
585     runtime/JSWrapperObject.cpp
586     runtime/LiteralParser.cpp
587     runtime/Lookup.cpp
588     runtime/MapConstructor.cpp
589     runtime/MapIteratorPrototype.cpp
590     runtime/MapPrototype.cpp
591     runtime/MathCommon.cpp
592     runtime/MathObject.cpp
593     runtime/MemoryStatistics.cpp
594     runtime/ModuleLoaderObject.cpp
595     runtime/NativeErrorConstructor.cpp
596     runtime/NativeErrorPrototype.cpp
597     runtime/NativeStdFunctionCell.cpp
598     runtime/NullGetterFunction.cpp
599     runtime/NullSetterFunction.cpp
600     runtime/NumberConstructor.cpp
601     runtime/NumberObject.cpp
602     runtime/NumberPrototype.cpp
603     runtime/ObjectConstructor.cpp
604     runtime/ObjectPrototype.cpp
605     runtime/Operations.cpp
606     runtime/Options.cpp
607     runtime/PropertyDescriptor.cpp
608     runtime/PropertySlot.cpp
609     runtime/PropertyTable.cpp
610     runtime/PrototypeMap.cpp
611     runtime/ReflectObject.cpp
612     runtime/RegExp.cpp
613     runtime/RegExpCache.cpp
614     runtime/RegExpCachedResult.cpp
615     runtime/RegExpConstructor.cpp
616     runtime/RegExpMatchesArray.cpp
617     runtime/RegExpObject.cpp
618     runtime/RegExpPrototype.cpp
619     runtime/RuntimeType.cpp
620     runtime/SamplingCounter.cpp
621     runtime/ScopeOffset.cpp
622     runtime/ScopedArguments.cpp
623     runtime/ScopedArgumentsTable.cpp
624     runtime/SetConstructor.cpp
625     runtime/SetIteratorPrototype.cpp
626     runtime/SetPrototype.cpp
627     runtime/SimpleTypedArrayController.cpp
628     runtime/SmallStrings.cpp
629     runtime/SparseArrayValueMap.cpp
630     runtime/StrictEvalActivation.cpp
631     runtime/StringConstructor.cpp
632     runtime/StringIteratorPrototype.cpp
633     runtime/StringObject.cpp
634     runtime/StringPrototype.cpp
635     runtime/StringRecursionChecker.cpp
636     runtime/Structure.cpp
637     runtime/StructureChain.cpp
638     runtime/StructureIDTable.cpp
639     runtime/StructureRareData.cpp
640     runtime/Symbol.cpp
641     runtime/SymbolConstructor.cpp
642     runtime/SymbolObject.cpp
643     runtime/SymbolPrototype.cpp
644     runtime/SymbolTable.cpp
645     runtime/TemplateRegistry.cpp
646     runtime/TestRunnerUtils.cpp
647     runtime/TypeLocationCache.cpp
648     runtime/TypeProfiler.cpp
649     runtime/TypeProfilerLog.cpp
650     runtime/TypeSet.cpp
651     runtime/TypedArrayController.cpp
652     runtime/TypedArrayType.cpp
653     runtime/TypeofType.cpp
654     runtime/VM.cpp
655     runtime/VMEntryScope.cpp
656     runtime/VarOffset.cpp
657     runtime/Watchdog.cpp
658     runtime/WeakMapConstructor.cpp
659     runtime/WeakMapData.cpp
660     runtime/WeakMapPrototype.cpp
661     runtime/WeakSetConstructor.cpp
662     runtime/WeakSetPrototype.cpp
663 )
664
665 list(APPEND JavaScriptCore_SOURCES
666     ${JavaScriptCore_RUNTIME_SOURCES}
667 )
668
669 set(JavaScriptCore_NATIVE_OBJECT_LUT_SOURCES
670     runtime/BooleanPrototype.cpp
671     runtime/DateConstructor.cpp
672     runtime/DatePrototype.cpp
673     runtime/ErrorPrototype.cpp
674     runtime/IntlCollatorConstructor.cpp
675     runtime/IntlCollatorPrototype.cpp
676     runtime/IntlDateTimeFormatConstructor.cpp
677     runtime/IntlDateTimeFormatPrototype.cpp
678     runtime/IntlNumberFormatConstructor.cpp
679     runtime/IntlNumberFormatPrototype.cpp
680     runtime/JSDataViewPrototype.cpp
681     runtime/JSONObject.cpp
682     runtime/NumberConstructor.cpp
683     runtime/NumberPrototype.cpp
684     runtime/RegExpConstructor.cpp
685     runtime/RegExpPrototype.cpp
686     runtime/SymbolConstructor.cpp
687     runtime/SymbolPrototype.cpp
688 )
689
690 # If an object's implementation contains at least one builtin, then it must
691 # be added to this section so it is generated with builtin-specific includes.
692
693 set(JavaScriptCore_BUILTIN_OBJECT_LUT_SOURCES
694     runtime/ArrayConstructor.cpp
695     runtime/ArrayIteratorPrototype.cpp
696     runtime/InspectorInstrumentationObject.cpp
697     runtime/JSGlobalObject.cpp
698     runtime/JSInternalPromiseConstructor.cpp
699     runtime/JSPromiseConstructor.cpp
700     runtime/JSPromisePrototype.cpp
701     runtime/ModuleLoaderObject.cpp
702     runtime/ObjectConstructor.cpp
703     runtime/ReflectObject.cpp
704     runtime/StringConstructor.cpp
705     runtime/StringIteratorPrototype.cpp
706 )
707
708 set(JavaScriptCore_LIBRARIES
709     WTF${DEBUG_SUFFIX}
710     ${ICU_I18N_LIBRARIES}
711 )
712
713 set(JavaScriptCore_SCRIPTS_SOURCES_DIR "${JAVASCRIPTCORE_DIR}/Scripts")
714
715 # Globbing relies on the fact that generator-specific file names are prefixed with their directory.
716 # Top-level scripts should have a file extension, since they are invoked during the build.
717
718 set(JavaScriptCore_SCRIPTS_SOURCES_PATHS
719     ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/*.pl
720     ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/*.py
721     ${JavaScriptCore_SCRIPTS_SOURCES_DIR}/builtins/builtins*.py
722 )
723
724 # Force JavaScriptCore to run scripts from the same staging path as WebCore.
725 set(JavaScriptCore_SCRIPTS_DIR "${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore/Scripts")
726
727 file(MAKE_DIRECTORY ${JavaScriptCore_SCRIPTS_DIR})
728
729 # The directory flattening performed below mirrors what the Mac port does with private headers.
730
731 file(GLOB JavaScriptCore_SCRIPTS_SOURCES ${JavaScriptCore_SCRIPTS_SOURCES_PATHS})
732
733 foreach (_file ${JavaScriptCore_SCRIPTS_SOURCES})
734     get_filename_component(_script "${_file}" NAME)
735     add_custom_command(
736         OUTPUT ${JavaScriptCore_SCRIPTS_DIR}/${_script}
737         MAIN_DEPENDENCY ${_file}
738         WORKING_DIRECTORY ${DERIVED_SOURCES_DIR}
739         COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_file} ${JavaScriptCore_SCRIPTS_DIR}/${_script}
740         VERBATIM)
741     list(APPEND JavaScriptCore_SCRIPTS ${JavaScriptCore_SCRIPTS_DIR}/${_script})
742 endforeach ()
743
744 if (USE_UDIS86)
745     set(UDIS_GEN_DEP
746         disassembler/udis86/ud_opcode.py
747         disassembler/udis86/ud_optable.py
748     )
749
750     add_custom_command(
751         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/udis86_itab.c ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/udis86_itab.h
752         DEPENDS ${UDIS_GEN_DEP}
753         WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
754         COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/disassembler/udis86/itab.py ${JAVASCRIPTCORE_DIR}/disassembler/udis86/optable.xml
755         VERBATIM)
756
757     list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
758         ${JAVASCRIPTCORE_DIR}/disassembler/udis86
759     )
760     list(APPEND JavaScriptCore_HEADERS
761         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/udis86_itab.h
762     )
763     list(APPEND JavaScriptCore_SOURCES
764         disassembler/UDis86Disassembler.cpp
765
766         disassembler/udis86/udis86.c
767         disassembler/udis86/udis86_decode.c
768         disassembler/udis86/udis86_input.c
769         disassembler/udis86/udis86_itab_holder.c
770         disassembler/udis86/udis86_syn-att.c
771         disassembler/udis86/udis86_syn-intel.c
772         disassembler/udis86/udis86_syn.c
773     )
774 endif ()
775
776 set(LLINT_ASM
777     llint/LowLevelInterpreter.asm
778     llint/LowLevelInterpreter32_64.asm
779     llint/LowLevelInterpreter64.asm
780 )
781
782 set(OFFLINE_ASM
783     offlineasm/arm.rb
784     offlineasm/arm64.rb
785     offlineasm/ast.rb
786     offlineasm/backends.rb
787     offlineasm/cloop.rb
788     offlineasm/config.rb
789     offlineasm/instructions.rb
790     offlineasm/mips.rb
791     offlineasm/offsets.rb
792     offlineasm/opt.rb
793     offlineasm/parser.rb
794     offlineasm/registers.rb
795     offlineasm/risc.rb
796     offlineasm/self_hash.rb
797     offlineasm/settings.rb
798     offlineasm/sh4.rb
799     offlineasm/transform.rb
800     offlineasm/x86.rb
801 )
802
803 add_custom_command(
804     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Bytecodes.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
805     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/generate-bytecode-files
806     DEPENDS ${JAVASCRIPTCORE_DIR}/generate-bytecode-files bytecode/BytecodeList.json
807     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/generate-bytecode-files --bytecodes_h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Bytecodes.h --init_bytecodes_asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm ${JAVASCRIPTCORE_DIR}/bytecode/BytecodeList.json
808     VERBATIM)
809
810 add_custom_command(
811     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
812     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
813     DEPENDS ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
814     COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
815     VERBATIM)
816
817 # We add the header files directly to the ADD_EXECUTABLE call instead of setting the
818 # OBJECT_DEPENDS property in LLIntOffsetsExtractor.cpp because generate_offset_extractor.rb and
819 # generate-bytecode-files may not regenerate the .h files in case the hash it calculates does not change.
820 # In this case, if some of the dependencies specified in the ADD_CUSTOM_COMMANDs above have
821 # changed the command will always be called because the mtime of the .h files will
822 # always be older than that of their dependencies.
823 # Additionally, setting the OBJECT_DEPENDS property will make the .h files a Makefile
824 # dependency of both LLIntOffsetsExtractor and LLIntOffsetsExtractor.cpp, so the command will
825 # actually be run multiple times!
826 add_executable(LLIntOffsetsExtractor
827     ${JAVASCRIPTCORE_DIR}/llint/LLIntOffsetsExtractor.cpp
828     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Bytecodes.h
829 )
830 target_link_libraries(LLIntOffsetsExtractor WTF)
831
832 # The build system will execute asm.rb every time LLIntOffsetsExtractor's mtime is newer than
833 # LLIntAssembly.h's mtime. The problem we have here is: asm.rb has some built-in optimization
834 # that generates a checksum of the LLIntOffsetsExtractor binary, if the checksum of the new
835 # LLIntOffsetsExtractor matches, no output is generated. To make this target consistent and avoid
836 # running this command for every build, we artificially update LLIntAssembly.h's mtime (using touch)
837 # after every asm.rb run.
838 if (MSVC)
839     set(LLIntOutput LowLevelInterpreterWin.asm)
840 else ()
841     set(LLIntOutput LLIntAssembly.h)
842 endif ()
843
844 add_custom_command(
845     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
846     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
847     DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
848     COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
849     COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
850     WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
851     VERBATIM)
852
853 # The explanation for not making LLIntAssembly.h part of the OBJECT_DEPENDS property of some of
854 # the .cpp files below is similar to the one in the previous comment. However, since these .cpp
855 # files are used to build JavaScriptCore itself, we can just add LLIntAssembly.h to JSC_HEADERS
856 # since it is used in the add_library() call at the end of this file.
857 if (MSVC)
858     enable_language(ASM_MASM)
859     list(APPEND JavaScriptCore_SOURCES
860         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LowLevelInterpreterWin.asm
861     )
862     # Win32 needs /safeseh with assembly, but Win64 does not.
863     if (CMAKE_SIZEOF_VOID_P EQUAL 4)
864         set_source_files_properties(${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LowLevelInterpreterWin.asm
865             PROPERTIES COMPILE_FLAGS  "/safeseh"
866         )
867     endif ()
868 else ()
869     list(APPEND JavaScriptCore_HEADERS
870         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
871     )
872 endif ()
873
874 list(APPEND JavaScriptCore_SOURCES
875     llint/LLIntCLoop.cpp
876     llint/LLIntData.cpp
877     llint/LLIntEntrypoint.cpp
878     llint/LLIntExceptions.cpp
879     llint/LLIntSlowPaths.cpp
880     llint/LLIntThunks.cpp
881     llint/LowLevelInterpreter.cpp
882 )
883
884
885 if (ENABLE_FTL_JIT)
886     if (NOT LLVM_STATIC_LIBRARIES)
887         message(FATAL_ERROR "No LLVM libs found, but FTL is enabled. Stopping build.")
888     endif ()
889
890     # Configure llvmForJSC.so
891     set(llvmForJSC_SOURCES
892         llvm/library/LLVMAnchor.cpp
893         llvm/library/LLVMExports.cpp
894         llvm/library/LLVMOverrides.cpp
895     )
896     set(llvmForJSC_INCLUDE_DIRECTORIES
897         ${LLVM_INCLUDE_DIRS}
898         "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
899     )
900
901     add_custom_command(
902         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/WebKitLLVMLibraryToken.h
903         DEPENDS ${LLVM_STATIC_LIBRARIES}
904         COMMAND ${CMAKE_COMMAND} -E touch ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/WebKitLLVMLibraryToken.h
905         VERBATIM)
906
907     WEBKIT_WRAP_SOURCELIST(${llvmForJSC_SOURCES})
908     add_library(llvmForJSC SHARED ${llvmForJSC_SOURCES} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/WebKitLLVMLibraryToken.h)
909     target_link_libraries(llvmForJSC ${LLVM_STATIC_LIBRARIES} "pthread" "dl" -Wl,--version-script=${JAVASCRIPTCORE_DIR}/llvm/library/libllvmForJSC.version)
910
911     # Added extra items for JavaScriptCore
912     list(APPEND JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES
913         ${LLVM_INCLUDE_DIRS}
914     )
915
916     list(APPEND JavaScriptCore_SOURCES
917         dfg/DFGToFTLDeferredCompilationCallback.cpp
918         dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp
919
920         disassembler/LLVMDisassembler.cpp
921         disassembler/X86Disassembler.cpp
922
923         ftl/FTLAbstractHeap.cpp
924         ftl/FTLAbstractHeapRepository.cpp
925         ftl/FTLAvailableRecovery.cpp
926         ftl/FTLCapabilities.cpp
927         ftl/FTLCommonValues.cpp
928         ftl/FTLCompile.cpp
929         ftl/FTLDWARFDebugLineInfo.cpp
930         ftl/FTLDWARFRegister.cpp
931         ftl/FTLDataSection.cpp
932         ftl/FTLExitArgument.cpp
933         ftl/FTLExitArgumentForOperand.cpp
934         ftl/FTLExitPropertyValue.cpp
935         ftl/FTLExitThunkGenerator.cpp
936         ftl/FTLExitTimeObjectMaterialization.cpp
937         ftl/FTLExitValue.cpp
938         ftl/FTLFail.cpp
939         ftl/FTLForOSREntryJITCode.cpp
940         ftl/FTLInlineCacheSize.cpp
941         ftl/FTLIntrinsicRepository.cpp
942         ftl/FTLJITCode.cpp
943         ftl/FTLJITFinalizer.cpp
944         ftl/FTLJSCall.cpp
945         ftl/FTLJSCallBase.cpp
946         ftl/FTLJSCallVarargs.cpp
947         ftl/FTLJSTailCall.cpp
948         ftl/FTLLazySlowPath.cpp
949         ftl/FTLLink.cpp
950         ftl/FTLLocation.cpp
951         ftl/FTLLowerDFGToLLVM.cpp
952         ftl/FTLOSREntry.cpp
953         ftl/FTLOSRExit.cpp
954         ftl/FTLOSRExitCompiler.cpp
955         ftl/FTLOperations.cpp
956         ftl/FTLOutput.cpp
957         ftl/FTLRecoveryOpcode.cpp
958         ftl/FTLSaveRestore.cpp
959         ftl/FTLSlowPathCall.cpp
960         ftl/FTLSlowPathCallKey.cpp
961         ftl/FTLStackMaps.cpp
962         ftl/FTLState.cpp
963         ftl/FTLThunks.cpp
964         ftl/FTLUnwindInfo.cpp
965         ftl/FTLValueRange.cpp
966
967         llvm/InitializeLLVM.cpp
968         llvm/InitializeLLVMLinux.cpp
969         llvm/InitializeLLVMPOSIX.cpp
970         llvm/LLVMAPI.cpp
971     )
972 endif ()
973
974 set(HASH_LUT_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/create_hash_table)
975 set(LUT_GENERATOR_FLAGS "")
976 macro(GENERATE_HASH_LUT _input _output)
977     add_custom_command(
978         OUTPUT ${_output}
979         MAIN_DEPENDENCY ${HASH_LUT_GENERATOR}
980         DEPENDS ${_input}
981         COMMAND ${PERL_EXECUTABLE} ${HASH_LUT_GENERATOR} ${LUT_GENERATOR_FLAGS} ${_input} > ${_output}
982         VERBATIM)
983     list(APPEND JavaScriptCore_HEADERS ${_output})
984     ADD_SOURCE_DEPENDENCIES(${_input} ${_output})
985 endmacro()
986
987 # GENERATOR 1-A: LUT creator
988
989 foreach (_file ${JavaScriptCore_NATIVE_OBJECT_LUT_SOURCES})
990     get_filename_component(_name ${_file} NAME_WE)
991     set(LUT_GENERATOR_FLAGS -i)
992     GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
993 endforeach ()
994
995 foreach (_file ${JavaScriptCore_BUILTIN_OBJECT_LUT_SOURCES})
996     get_filename_component(_name ${_file} NAME_WE)
997     set(LUT_GENERATOR_FLAGS -i -b)
998     GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
999 endforeach ()
1000
1001 set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
1002     API
1003     assembler
1004     bindings
1005     builtins
1006     bytecode
1007     debugger
1008     dfg
1009     disassembler
1010     heap
1011     inspector
1012     interpreter
1013     jit
1014     llint
1015     parser
1016     profiler
1017     replay
1018     runtime
1019     yarr
1020
1021     collector/handles
1022
1023     inspector/agents
1024     inspector/augmentable
1025     inspector/remote
1026 )
1027
1028 # GENERATOR 1-B: particular LUT creator (for 1 file only)
1029 set(LUT_GENERATOR_FLAGS )
1030 GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
1031
1032 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
1033 add_custom_command(
1034     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
1035     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
1036     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
1037     VERBATIM)
1038 ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
1039
1040
1041 #GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
1042 add_custom_command(
1043     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
1044     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py
1045     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table
1046     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py ${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
1047     VERBATIM)
1048 ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/parser/Lexer.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h)
1049
1050
1051 # Inspector Interfaces
1052
1053 set(JavaScriptCore_INSPECTOR_SCRIPTS_DIR "${JAVASCRIPTCORE_DIR}/inspector/scripts")
1054
1055 set(JavaScriptCore_INSPECTOR_PROTOCOL_SCRIPTS
1056     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-inspector-protocol-bindings.py
1057     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/cpp_generator.py
1058     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/cpp_generator_templates.py
1059     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_js_backend_commands.py
1060     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_cpp_backend_dispatcher_header.py
1061     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_cpp_backend_dispatcher_implementation.py
1062     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_cpp_frontend_dispatcher_header.py
1063     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_cpp_frontend_dispatcher_implementation.py
1064     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_cpp_protocol_types_header.py
1065     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generate_cpp_protocol_types_implementation.py
1066     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generator.py
1067     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/generator_templates.py
1068     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/__init__.py
1069     ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/codegen/models.py
1070 )
1071
1072 set(JavaScriptCore_INSPECTOR_DOMAINS
1073     ${JAVASCRIPTCORE_DIR}/inspector/protocol/ApplicationCache.json
1074     ${JAVASCRIPTCORE_DIR}/inspector/protocol/CSS.json
1075     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Console.json
1076     ${JAVASCRIPTCORE_DIR}/inspector/protocol/DOM.json
1077     ${JAVASCRIPTCORE_DIR}/inspector/protocol/DOMDebugger.json
1078     ${JAVASCRIPTCORE_DIR}/inspector/protocol/DOMStorage.json
1079     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Database.json
1080     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Debugger.json
1081     ${JAVASCRIPTCORE_DIR}/inspector/protocol/GenericTypes.json
1082     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Heap.json
1083     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Inspector.json
1084     ${JAVASCRIPTCORE_DIR}/inspector/protocol/LayerTree.json
1085     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Network.json
1086     ${JAVASCRIPTCORE_DIR}/inspector/protocol/OverlayTypes.json
1087     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Page.json
1088     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Runtime.json
1089     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Timeline.json
1090     ${JAVASCRIPTCORE_DIR}/inspector/protocol/Worker.json
1091 )
1092
1093 if (ENABLE_INDEXED_DATABASE)
1094     list(APPEND JavaScriptCore_INSPECTOR_DOMAINS
1095         ${JAVASCRIPTCORE_DIR}/inspector/protocol/IndexedDB.json
1096     )
1097 endif ()
1098
1099 if (ENABLE_WEB_REPLAY)
1100     list(APPEND JavaScriptCore_INSPECTOR_DOMAINS
1101         ${JAVASCRIPTCORE_DIR}/inspector/protocol/Replay.json
1102     )
1103 endif ()
1104
1105 add_custom_command(
1106     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/CombinedDomains.json
1107     MAIN_DEPENDENCY ${JavaScriptCore_SCRIPTS_DIR}/generate-combined-inspector-json.py
1108     DEPENDS ${JavaScriptCore_INSPECTOR_DOMAINS}
1109     COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/generate-combined-inspector-json.py ${JavaScriptCore_INSPECTOR_DOMAINS} > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/CombinedDomains.json
1110     VERBATIM)
1111
1112 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
1113 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol)
1114 file(MAKE_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector)
1115 add_custom_command(
1116     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.cpp
1117            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.h
1118            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.cpp
1119            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.h
1120            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorProtocolObjects.cpp
1121            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorProtocolObjects.h
1122            ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js
1123     MAIN_DEPENDENCY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/CombinedDomains.json
1124     DEPENDS ${JavaScriptCore_INSPECTOR_PROTOCOL_SCRIPTS}
1125     COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-inspector-protocol-bindings.py --outputDir "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector" --framework JavaScriptCore ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/CombinedDomains.json
1126     VERBATIM)
1127
1128 # JSCBuiltins
1129
1130 set(BUILTINS_GENERATOR_SCRIPTS
1131     ${JavaScriptCore_SCRIPTS_DIR}/builtins.py
1132     ${JavaScriptCore_SCRIPTS_DIR}/builtins_generator.py
1133     ${JavaScriptCore_SCRIPTS_DIR}/builtins_model.py
1134     ${JavaScriptCore_SCRIPTS_DIR}/builtins_templates.py
1135     ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_combined_header.py
1136     ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_combined_implementation.py
1137     ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_header.py
1138     ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_implementation.py
1139     ${JavaScriptCore_SCRIPTS_DIR}/builtins_generate_separate_wrapper.py
1140     ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
1141     ${JavaScriptCore_SCRIPTS_DIR}/lazywriter.py
1142 )
1143
1144 set(JavaScriptCore_BUILTINS_SOURCES
1145     ${JAVASCRIPTCORE_DIR}/builtins/ArrayConstructor.js
1146     ${JAVASCRIPTCORE_DIR}/builtins/ArrayIterator.prototype.js
1147     ${JAVASCRIPTCORE_DIR}/builtins/Array.prototype.js
1148     ${JAVASCRIPTCORE_DIR}/builtins/Function.prototype.js
1149     ${JAVASCRIPTCORE_DIR}/builtins/GlobalObject.js
1150     ${JAVASCRIPTCORE_DIR}/builtins/InspectorInstrumentationObject.js
1151     ${JAVASCRIPTCORE_DIR}/builtins/InternalPromiseConstructor.js
1152     ${JAVASCRIPTCORE_DIR}/builtins/Iterator.prototype.js
1153     ${JAVASCRIPTCORE_DIR}/builtins/ModuleLoaderObject.js
1154     ${JAVASCRIPTCORE_DIR}/builtins/ObjectConstructor.js
1155     ${JAVASCRIPTCORE_DIR}/builtins/Operations.Promise.js
1156     ${JAVASCRIPTCORE_DIR}/builtins/PromiseConstructor.js
1157     ${JAVASCRIPTCORE_DIR}/builtins/Promise.prototype.js
1158     ${JAVASCRIPTCORE_DIR}/builtins/ReflectObject.js
1159     ${JAVASCRIPTCORE_DIR}/builtins/StringConstructor.js
1160     ${JAVASCRIPTCORE_DIR}/builtins/StringIterator.prototype.js
1161     ${JAVASCRIPTCORE_DIR}/builtins/TypedArray.prototype.js
1162     ${JAVASCRIPTCORE_DIR}/builtins/TypedArrayConstructor.js
1163 )
1164
1165 add_custom_command(
1166    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp
1167           ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
1168    MAIN_DEPENDENCY ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
1169    DEPENDS ${JavaScriptCore_BUILTINS_SOURCES} ${BUILTINS_GENERATOR_SCRIPTS}
1170    COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py --framework JavaScriptCore --output-directory ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} --combined ${JavaScriptCore_BUILTINS_SOURCES}
1171    VERBATIM)
1172
1173 list(APPEND JavaScriptCore_SOURCES
1174     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.cpp
1175     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.cpp
1176     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorProtocolObjects.cpp
1177     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp
1178 )
1179
1180 list(APPEND JavaScriptCore_HEADERS
1181     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.h
1182     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.h
1183     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorProtocolObjects.h
1184     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
1185 )
1186
1187 add_custom_command(
1188     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.min.js
1189     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/inspector/InjectedScriptSource.js
1190     DEPENDS ${JavaScriptCore_SCRIPTS_DIR}/xxd.pl ${JavaScriptCore_SCRIPTS_DIR}/jsmin.py
1191     COMMAND echo "//# sourceURL=__WebInspectorInjectedScript__" > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.min.js
1192     COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/jsmin.py < ${JAVASCRIPTCORE_DIR}/inspector/InjectedScriptSource.js >> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.min.js
1193     COMMAND ${PERL_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/xxd.pl InjectedScriptSource_js ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.min.js ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.h
1194     VERBATIM)
1195
1196 list(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.h)
1197
1198 # Web Replay inputs generator
1199 if (ENABLE_WEB_REPLAY)
1200     set(JavaScript_WEB_REPLAY_INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/replay/JSInputs.json)
1201     add_custom_command(
1202         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSReplayInputs.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSReplayInputs.cpp
1203         MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/replay/scripts/CodeGeneratorReplayInputs.py
1204         DEPENDS ${JavaScript_WEB_REPLAY_INPUTS}
1205         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/replay/scripts/CodeGeneratorReplayInputs.py --outputDir ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ --framework JavaScriptCore ${JavaScript_WEB_REPLAY_INPUTS}
1206         VERBATIM)
1207
1208     list(APPEND JavaScriptCore_SOURCES
1209         replay/EncodedValue.cpp
1210         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSReplayInputs.cpp
1211     )
1212     list(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSReplayInputs.h)
1213 endif ()
1214
1215 if (WTF_CPU_ARM)
1216 elseif (WTF_CPU_ARM64)
1217 elseif (WTF_CPU_HPPA)
1218 elseif (WTF_CPU_PPC)
1219 elseif (WTF_CPU_PPC64)
1220 elseif (WTF_CPU_PPC64LE)
1221 elseif (WTF_CPU_S390)
1222 elseif (WTF_CPU_S390X)
1223 elseif (WTF_CPU_MIPS)
1224 elseif (WTF_CPU_SH4)
1225 elseif (WTF_CPU_X86)
1226 elseif (WTF_CPU_X86_64)
1227     if (MSVC AND ENABLE_JIT)
1228         add_custom_command(
1229             OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
1230             MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
1231             COMMAND ml64 -nologo -c -Fo ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
1232             VERBATIM)
1233
1234         list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj)
1235     endif ()
1236 else ()
1237     message(FATAL_ERROR "Unknown CPU")
1238 endif ()
1239
1240
1241 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
1242
1243 WEBKIT_CREATE_FORWARDING_HEADERS(JavaScriptCore DIRECTORIES ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES} FILES ${JavaScriptCore_FORWARDING_HEADERS_FILES})
1244
1245
1246 add_subdirectory(shell)
1247
1248 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
1249 include_directories(${JavaScriptCore_INCLUDE_DIRECTORIES})
1250 include_directories(SYSTEM ${JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES})
1251 add_library(JavaScriptCore ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
1252 target_link_libraries(JavaScriptCore ${JavaScriptCore_LIBRARIES})
1253 set_target_properties(JavaScriptCore PROPERTIES COMPILE_DEFINITIONS "BUILDING_JavaScriptCore")
1254 set_target_properties(JavaScriptCore PROPERTIES FOLDER "JavaScriptCore")
1255
1256 if (JavaScriptCore_POST_BUILD_COMMAND)
1257     add_custom_command(TARGET JavaScriptCore POST_BUILD COMMAND ${JavaScriptCore_POST_BUILD_COMMAND} VERBATIM)
1258 endif ()
1259
1260 if (JavaScriptCore_OUTPUT_NAME)
1261     set_target_properties(JavaScriptCore PROPERTIES OUTPUT_NAME ${JavaScriptCore_OUTPUT_NAME})
1262 endif ()
1263
1264 if (${JavaScriptCore_LIBRARY_TYPE} STREQUAL "SHARED")
1265     POPULATE_LIBRARY_VERSION(JAVASCRIPTCORE)
1266     set_target_properties(JavaScriptCore PROPERTIES VERSION ${JAVASCRIPTCORE_VERSION} SOVERSION ${JAVASCRIPTCORE_VERSION_MAJOR})
1267     install(TARGETS JavaScriptCore DESTINATION "${LIB_INSTALL_DIR}")
1268 endif ()
1269
1270 if (ENABLE_FTL_JIT)
1271     add_dependencies(JavaScriptCore llvmForJSC)
1272 endif ()
1273
1274 # Force staging of shared scripts, even if they aren't directly used to build JavaScriptCore.
1275
1276 add_custom_target(stageSharedScripts DEPENDS ${JavaScriptCore_SCRIPTS})
1277 add_dependencies(JavaScriptCore stageSharedScripts)