Refactor static getter function prototype to include thisValue in addition to the...
[WebKit-https.git] / Source / JavaScriptCore / CMakeLists.txt
1 set(JavaScriptCore_INCLUDE_DIRECTORIES
2     "${CMAKE_BINARY_DIR}"
3     "${JAVASCRIPTCORE_DIR}"
4     "${JAVASCRIPTCORE_DIR}/API"
5     "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
6     "${JAVASCRIPTCORE_DIR}/assembler"
7     "${JAVASCRIPTCORE_DIR}/bytecode"
8     "${JAVASCRIPTCORE_DIR}/bytecompiler"
9     "${JAVASCRIPTCORE_DIR}/dfg"
10     "${JAVASCRIPTCORE_DIR}/disassembler"
11     "${JAVASCRIPTCORE_DIR}/ftl"
12     "${JAVASCRIPTCORE_DIR}/heap"
13     "${JAVASCRIPTCORE_DIR}/debugger"
14     "${JAVASCRIPTCORE_DIR}/inspector"
15     "${JAVASCRIPTCORE_DIR}/interpreter"
16     "${JAVASCRIPTCORE_DIR}/jit"
17     "${JAVASCRIPTCORE_DIR}/llint"
18     "${JAVASCRIPTCORE_DIR}/parser"
19     "${JAVASCRIPTCORE_DIR}/profiler"
20     "${JAVASCRIPTCORE_DIR}/runtime"
21     "${JAVASCRIPTCORE_DIR}/tools"
22     "${JAVASCRIPTCORE_DIR}/yarr"
23     "${WTF_DIR}"
24     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
25     "${CMAKE_SOURCE_DIR}/Source"
26 )
27
28 set(JavaScriptCore_SOURCES
29     API/JSBase.cpp
30     API/JSCTestRunnerUtils.cpp
31     API/JSCallbackConstructor.cpp
32     API/JSCallbackFunction.cpp
33     API/JSCallbackObject.cpp
34     API/JSClassRef.cpp
35     API/JSContextRef.cpp
36     API/JSObjectRef.cpp
37     API/JSProfilerPrivate.cpp
38     API/JSScriptRef.cpp
39     API/JSStringRef.cpp
40     API/JSValueRef.cpp
41     API/JSWeakObjectMapRefPrivate.cpp
42     API/OpaqueJSString.cpp
43
44     assembler/LinkBuffer.cpp
45     assembler/MacroAssembler.cpp
46     assembler/MacroAssemblerX86Common.cpp
47
48     bytecode/ArrayAllocationProfile.cpp
49     bytecode/ArrayProfile.cpp
50     bytecode/BytecodeBasicBlock.cpp
51     bytecode/BytecodeLivenessAnalysis.cpp
52     bytecode/CallLinkInfo.cpp
53     bytecode/CallLinkStatus.cpp
54     bytecode/CodeBlock.cpp
55     bytecode/CodeBlockHash.cpp
56     bytecode/CodeBlockJettisoningWatchpoint.cpp
57     bytecode/CodeOrigin.cpp
58     bytecode/CodeType.cpp
59     bytecode/DFGExitProfile.cpp
60     bytecode/DeferredCompilationCallback.cpp
61     bytecode/ExecutionCounter.cpp
62     bytecode/ExitKind.cpp
63     bytecode/GetByIdStatus.cpp
64     bytecode/InlineCallFrameSet.cpp
65     bytecode/JumpTable.cpp
66     bytecode/LazyOperandValueProfile.cpp
67     bytecode/MethodOfGettingAValueProfile.cpp
68     bytecode/Opcode.cpp
69     bytecode/PolymorphicPutByIdList.cpp
70     bytecode/PreciseJumpTargets.cpp
71     bytecode/ProfiledCodeBlockJettisoningWatchpoint.cpp
72     bytecode/PutByIdStatus.cpp
73     bytecode/ReduceWhitespace.cpp
74     bytecode/SamplingTool.cpp
75     bytecode/SpecialPointer.cpp
76     bytecode/SpeculatedType.cpp
77     bytecode/StructureStubClearingWatchpoint.cpp
78     bytecode/StructureStubInfo.cpp
79     bytecode/UnlinkedCodeBlock.cpp
80     bytecode/ValueRecovery.cpp
81     bytecode/Watchpoint.cpp
82
83     bytecompiler/BytecodeGenerator.cpp
84     bytecompiler/NodesCodegen.cpp
85
86     debugger/Debugger.cpp
87     debugger/DebuggerActivation.cpp
88     debugger/DebuggerCallFrame.cpp
89
90     dfg/DFGAbstractHeap.cpp
91     dfg/DFGAbstractValue.cpp
92     dfg/DFGArgumentsSimplificationPhase.cpp
93     dfg/DFGArrayMode.cpp
94     dfg/DFGAtTailAbstractState.cpp
95     dfg/DFGAvailability.cpp
96     dfg/DFGBackwardsPropagationPhase.cpp
97     dfg/DFGBasicBlock.cpp
98     dfg/DFGBinarySwitch.cpp
99     dfg/DFGBlockInsertionSet.cpp
100     dfg/DFGByteCodeParser.cpp
101     dfg/DFGCFAPhase.cpp
102     dfg/DFGCFGSimplificationPhase.cpp
103     dfg/DFGCPSRethreadingPhase.cpp
104     dfg/DFGCSEPhase.cpp
105     dfg/DFGCapabilities.cpp
106     dfg/DFGClobberSet.cpp
107     dfg/DFGClobberize.cpp
108     dfg/DFGCommon.cpp
109     dfg/DFGCommonData.cpp
110     dfg/DFGCompilationKey.cpp
111     dfg/DFGCompilationMode.cpp
112     dfg/DFGConstantFoldingPhase.cpp
113     dfg/DFGCriticalEdgeBreakingPhase.cpp
114     dfg/DFGDCEPhase.cpp
115     dfg/DFGDesiredIdentifiers.cpp
116     dfg/DFGDesiredStructureChains.cpp
117     dfg/DFGDesiredTransitions.cpp
118     dfg/DFGDesiredWatchpoints.cpp
119     dfg/DFGDesiredWeakReferences.cpp
120     dfg/DFGDesiredWriteBarriers.cpp
121     dfg/DFGDisassembler.cpp
122     dfg/DFGDominators.cpp
123     dfg/DFGDriver.cpp
124     dfg/DFGEdge.cpp
125     dfg/DFGFailedFinalizer.cpp
126     dfg/DFGFinalizer.cpp
127     dfg/DFGFixupPhase.cpp
128     dfg/DFGFlushFormat.cpp
129     dfg/DFGFlushLivenessAnalysisPhase.cpp
130     dfg/DFGFlushedAt.cpp
131     dfg/DFGGraph.cpp
132     dfg/DFGInPlaceAbstractState.cpp
133     dfg/DFGInvalidationPointInjectionPhase.cpp
134     dfg/DFGJITCode.cpp
135     dfg/DFGJITCompiler.cpp
136     dfg/DFGJITFinalizer.cpp
137     dfg/DFGJumpReplacement.cpp
138     dfg/DFGLICMPhase.cpp
139     dfg/DFGLazyJSValue.cpp
140     dfg/DFGLivenessAnalysisPhase.cpp
141     dfg/DFGLongLivedState.cpp
142     dfg/DFGLoopPreHeaderCreationPhase.cpp
143     dfg/DFGMinifiedNode.cpp
144     dfg/DFGNaturalLoops.cpp
145     dfg/DFGNode.cpp
146     dfg/DFGNodeFlags.cpp
147     dfg/DFGOSRAvailabilityAnalysisPhase.cpp
148     dfg/DFGOSREntry.cpp
149     dfg/DFGOSREntrypointCreationPhase.cpp
150     dfg/DFGOSRExit.cpp
151     dfg/DFGOSRExitBase.cpp
152     dfg/DFGOSRExitCompiler.cpp
153     dfg/DFGOSRExitCompiler32_64.cpp
154     dfg/DFGOSRExitCompiler64.cpp
155     dfg/DFGOSRExitCompilerCommon.cpp
156     dfg/DFGOSRExitJumpPlaceholder.cpp
157     dfg/DFGOSRExitPreparation.cpp
158     dfg/DFGOperations.cpp
159     dfg/DFGPhase.cpp
160     dfg/DFGPlan.cpp
161     dfg/DFGPredictionInjectionPhase.cpp
162     dfg/DFGPredictionPropagationPhase.cpp
163     dfg/DFGResurrectionForValidationPhase.cpp
164     dfg/DFGSSAConversionPhase.cpp
165     dfg/DFGSpeculativeJIT.cpp
166     dfg/DFGSpeculativeJIT32_64.cpp
167     dfg/DFGSpeculativeJIT64.cpp
168     dfg/DFGStackLayoutPhase.cpp
169     dfg/DFGThunks.cpp
170     dfg/DFGTierUpCheckInjectionPhase.cpp
171     dfg/DFGTypeCheckHoistingPhase.cpp
172     dfg/DFGUnificationPhase.cpp
173     dfg/DFGUseKind.cpp
174     dfg/DFGValidate.cpp
175     dfg/DFGValueSource.cpp
176     dfg/DFGVariableAccessDataDump.cpp
177     dfg/DFGVariableEvent.cpp
178     dfg/DFGVariableEventStream.cpp
179     dfg/DFGVirtualRegisterAllocationPhase.cpp
180     dfg/DFGWatchpointCollectionPhase.cpp
181     dfg/DFGWorklist.cpp
182
183     disassembler/ARMv7Disassembler.cpp
184     disassembler/Disassembler.cpp
185     disassembler/LLVMDisassembler.cpp
186     disassembler/UDis86Disassembler.cpp
187     disassembler/X86Disassembler.cpp
188
189     heap/BlockAllocator.cpp
190     heap/CodeBlockSet.cpp
191     heap/ConservativeRoots.cpp
192     heap/CopiedSpace.cpp
193     heap/CopyVisitor.cpp
194     heap/DeferGC.cpp
195     heap/GCThread.cpp
196     heap/GCThreadSharedData.cpp
197     heap/HandleSet.cpp
198     heap/HandleStack.cpp
199     heap/Heap.cpp
200     heap/HeapStatistics.cpp
201     heap/HeapTimer.cpp
202     heap/IncrementalSweeper.cpp
203     heap/JITStubRoutineSet.cpp
204     heap/MachineStackMarker.cpp
205     heap/MarkStack.cpp
206     heap/MarkedAllocator.cpp
207     heap/MarkedBlock.cpp
208     heap/MarkedSpace.cpp
209     heap/SlotVisitor.cpp
210     heap/SuperRegion.cpp
211     heap/Weak.cpp
212     heap/WeakBlock.cpp
213     heap/WeakHandleOwner.cpp
214     heap/WeakSet.cpp
215     heap/WriteBarrierSupport.cpp
216
217     interpreter/AbstractPC.cpp
218     interpreter/CallFrame.cpp
219     interpreter/Interpreter.cpp
220     interpreter/JSStack.cpp
221     interpreter/ProtoCallFrame.cpp
222     interpreter/StackVisitor.cpp
223     interpreter/VMInspector.cpp
224
225     jit/AssemblyHelpers.cpp
226     jit/ClosureCallStubRoutine.cpp
227     jit/ExecutableAllocator.cpp
228     jit/ExecutableAllocatorFixedVMPool.cpp
229     jit/GCAwareJITStubRoutine.cpp
230     jit/HostCallReturnValue.cpp
231     jit/JIT.cpp
232     jit/JITArithmetic.cpp
233     jit/JITArithmetic32_64.cpp
234     jit/JITCall.cpp
235     jit/JITCall32_64.cpp
236     jit/JITCode.cpp
237     jit/JITDisassembler.cpp
238     jit/JITExceptions.cpp
239     jit/JITInlineCacheGenerator.cpp
240     jit/JITOpcodes.cpp
241     jit/JITOpcodes32_64.cpp
242     jit/JITOperations.cpp
243     jit/JITPropertyAccess.cpp
244     jit/JITPropertyAccess32_64.cpp
245     jit/JITStubRoutine.cpp
246     jit/JITStubs.cpp
247     jit/JITThunks.cpp
248     jit/JITToDFGDeferredCompilationCallback.cpp
249     jit/RegisterSet.cpp
250     jit/Repatch.cpp
251     jit/TempRegisterSet.cpp
252     jit/ThunkGenerators.cpp
253
254     parser/Lexer.cpp
255     parser/Nodes.cpp
256     parser/Parser.cpp
257     parser/ParserArena.cpp
258     parser/SourceCode.cpp
259     parser/SourceProvider.cpp
260     parser/SourceProviderCache.cpp
261
262     profiler/LegacyProfiler.cpp
263     profiler/Profile.cpp
264     profiler/ProfileGenerator.cpp
265     profiler/ProfileNode.cpp
266     profiler/ProfilerBytecode.cpp
267     profiler/ProfilerBytecodeSequence.cpp
268     profiler/ProfilerBytecodes.cpp
269     profiler/ProfilerCompilation.cpp
270     profiler/ProfilerCompilationKind.cpp
271     profiler/ProfilerCompiledBytecode.cpp
272     profiler/ProfilerDatabase.cpp
273     profiler/ProfilerOSRExit.cpp
274     profiler/ProfilerOSRExitSite.cpp
275     profiler/ProfilerOrigin.cpp
276     profiler/ProfilerOriginStack.cpp
277     profiler/ProfilerProfiledBytecodes.cpp
278
279     runtime/ArgList.cpp
280     runtime/Arguments.cpp
281     runtime/ArgumentsIteratorConstructor.cpp
282     runtime/ArgumentsIteratorPrototype.cpp
283     runtime/ArrayBuffer.cpp
284     runtime/ArrayBufferNeuteringWatchpoint.cpp
285     runtime/ArrayBufferView.cpp
286     runtime/ArrayConstructor.cpp
287     runtime/ArrayIteratorConstructor.cpp
288     runtime/ArrayIteratorPrototype.cpp
289     runtime/ArrayPrototype.cpp
290     runtime/BooleanConstructor.cpp
291     runtime/BooleanObject.cpp
292     runtime/BooleanPrototype.cpp
293     runtime/CallData.cpp
294     runtime/CodeCache.cpp
295     runtime/CodeSpecializationKind.cpp
296     runtime/CommonIdentifiers.cpp
297     runtime/CommonSlowPaths.cpp
298     runtime/CommonSlowPathsExceptions.cpp
299     runtime/CompilationResult.cpp
300     runtime/Completion.cpp
301     runtime/ConstructData.cpp
302     runtime/DataView.cpp
303     runtime/DataView.h
304     runtime/DateConstructor.cpp
305     runtime/DateConversion.cpp
306     runtime/DateInstance.cpp
307     runtime/DatePrototype.cpp
308     runtime/DumpContext.cpp
309     runtime/Error.cpp
310     runtime/ErrorConstructor.cpp
311     runtime/ErrorInstance.cpp
312     runtime/ErrorPrototype.cpp
313     runtime/ExceptionHelpers.cpp
314     runtime/Executable.cpp
315     runtime/FunctionConstructor.cpp
316     runtime/FunctionExecutableDump.cpp
317     runtime/FunctionPrototype.cpp
318     runtime/GCActivityCallback.cpp
319     runtime/GetterSetter.cpp
320     runtime/Identifier.cpp
321     runtime/IndexingType.cpp
322     runtime/InitializeThreading.cpp
323     runtime/IntendedStructureChain.cpp
324     runtime/InternalFunction.cpp
325     runtime/JSAPIValueWrapper.cpp
326     runtime/JSActivation.cpp
327     runtime/JSArgumentsIterator.cpp
328     runtime/JSArray.cpp
329     runtime/JSArrayBuffer.cpp
330     runtime/JSArrayBufferConstructor.cpp
331     runtime/JSArrayBufferPrototype.cpp
332     runtime/JSArrayBufferView.cpp
333     runtime/JSArrayIterator.cpp
334     runtime/JSBoundFunction.cpp
335     runtime/JSCJSValue.cpp
336     runtime/JSCell.cpp
337     runtime/JSDataView.cpp
338     runtime/JSDataViewPrototype.cpp
339     runtime/JSDateMath.cpp
340     runtime/JSFunction.cpp
341     runtime/JSGlobalObject.cpp
342     runtime/JSGlobalObjectFunctions.cpp
343     runtime/JSLock.cpp
344     runtime/JSMap.cpp
345     runtime/JSMapIterator.cpp
346     runtime/JSNameScope.cpp
347     runtime/JSNotAnObject.cpp
348     runtime/JSONObject.cpp
349     runtime/JSObject.cpp
350     runtime/JSPromise.cpp
351     runtime/JSPromiseCallback.cpp
352     runtime/JSPromiseConstructor.cpp
353     runtime/JSPromisePrototype.cpp
354     runtime/JSPromiseResolver.cpp
355     runtime/JSPromiseResolverConstructor.cpp
356     runtime/JSPromiseResolverPrototype.cpp
357     runtime/JSPropertyNameIterator.cpp
358     runtime/JSProxy.cpp
359     runtime/JSScope.cpp
360     runtime/JSSegmentedVariableObject.cpp
361     runtime/JSSet.cpp
362     runtime/JSSetIterator.cpp
363     runtime/JSStaticScopeObject.cpp
364     runtime/JSString.cpp
365     runtime/JSStringJoiner.cpp
366     runtime/JSSymbolTableObject.cpp
367     runtime/JSTypedArrayConstructors.cpp
368     runtime/JSTypedArrayPrototypes.cpp
369     runtime/JSTypedArrays.cpp
370     runtime/JSVariableObject.cpp
371     runtime/JSWeakMap.cpp
372     runtime/JSWithScope.cpp
373     runtime/JSWrapperObject.cpp
374     runtime/LiteralParser.cpp
375     runtime/Lookup.cpp
376     runtime/MapConstructor.cpp
377     runtime/MapData.cpp
378     runtime/MapIteratorConstructor.cpp
379     runtime/MapIteratorPrototype.cpp
380     runtime/MapPrototype.cpp
381     runtime/MathObject.cpp
382     runtime/MemoryStatistics.cpp
383     runtime/NameConstructor.cpp
384     runtime/NameInstance.cpp
385     runtime/NamePrototype.cpp
386     runtime/NativeErrorConstructor.cpp
387     runtime/NativeErrorPrototype.cpp
388     runtime/NumberConstructor.cpp
389     runtime/NumberObject.cpp
390     runtime/NumberPrototype.cpp
391     runtime/ObjectConstructor.cpp
392     runtime/ObjectPrototype.cpp
393     runtime/Operations.cpp
394     runtime/Options.cpp
395     runtime/PropertyDescriptor.cpp
396     runtime/PropertyNameArray.cpp
397     runtime/PropertySlot.cpp
398     runtime/PropertyTable.cpp
399     runtime/PrototypeMap.cpp
400     runtime/RegExp.cpp
401     runtime/RegExpCache.cpp
402     runtime/RegExpCachedResult.cpp
403     runtime/RegExpConstructor.cpp
404     runtime/RegExpMatchesArray.cpp
405     runtime/RegExpObject.cpp
406     runtime/RegExpPrototype.cpp
407     runtime/SamplingCounter.cpp
408     runtime/SetConstructor.cpp
409     runtime/SetIteratorConstructor.cpp
410     runtime/SetIteratorPrototype.cpp
411     runtime/SetPrototype.cpp
412     runtime/SimpleTypedArrayController.cpp
413     runtime/SmallStrings.cpp
414     runtime/SparseArrayValueMap.cpp
415     runtime/StrictEvalActivation.cpp
416     runtime/StringConstructor.cpp
417     runtime/StringObject.cpp
418     runtime/StringPrototype.cpp
419     runtime/StringRecursionChecker.cpp
420     runtime/Structure.cpp
421     runtime/StructureChain.cpp
422     runtime/StructureRareData.cpp
423     runtime/SymbolTable.cpp
424     runtime/TestRunnerUtils.cpp
425     runtime/TypedArrayController.cpp
426     runtime/TypedArrayType.cpp
427     runtime/VM.cpp
428     runtime/VMEntryScope.cpp
429     runtime/Watchdog.cpp
430     runtime/WatchdogNone.cpp
431     runtime/WeakMapConstructor.cpp
432     runtime/WeakMapData.cpp
433     runtime/WeakMapPrototype.cpp
434
435     tools/CodeProfile.cpp
436     tools/CodeProfiling.cpp
437
438     yarr/YarrCanonicalizeUCS2.cpp
439     yarr/YarrInterpreter.cpp
440     yarr/YarrJIT.cpp
441     yarr/YarrPattern.cpp
442     yarr/YarrSyntaxChecker.cpp
443 )
444
445 set(JavaScriptCore_LUT_FILES
446     runtime/ArrayConstructor.cpp
447     runtime/ArrayPrototype.cpp
448     runtime/BooleanPrototype.cpp
449     runtime/DateConstructor.cpp
450     runtime/DatePrototype.cpp
451     runtime/ErrorPrototype.cpp
452     runtime/JSDataViewPrototype.cpp
453     runtime/JSGlobalObject.cpp
454     runtime/JSONObject.cpp
455     runtime/JSPromiseConstructor.cpp
456     runtime/JSPromisePrototype.cpp
457     runtime/JSPromiseResolverPrototype.cpp
458     runtime/NamePrototype.cpp
459     runtime/NumberConstructor.cpp
460     runtime/NumberPrototype.cpp
461     runtime/ObjectConstructor.cpp
462     runtime/RegExpConstructor.cpp
463     runtime/RegExpObject.cpp
464     runtime/RegExpPrototype.cpp
465     runtime/StringConstructor.cpp
466 )
467
468 set(JavaScriptCore_LIBRARIES
469     WTF
470 )
471
472 if (WTF_USE_ICU_UNICODE)
473     list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
474         ${ICU_INCLUDE_DIRS}
475     )
476     list(APPEND JavaScriptCore_LIBRARIES
477         ${ICU_I18N_LIBRARIES}
478     )
479 endif ()
480
481 if (ENABLE_LLINT)
482     # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
483     # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
484     # for finding the only Ruby interpreter.
485     if (NOT RUBY_EXECUTABLE)
486         message(FATAL_ERROR "The Ruby interpreter is needed to generate LLInt files.")
487     endif ()
488
489     set(LLINT_ASM
490         llint/LowLevelInterpreter.asm
491         llint/LowLevelInterpreter32_64.asm
492         llint/LowLevelInterpreter64.asm
493     )
494
495     set(OFFLINE_ASM
496         offlineasm/arm.rb
497         offlineasm/ast.rb
498         offlineasm/backends.rb
499         offlineasm/cloop.rb
500         offlineasm/config.rb
501         offlineasm/instructions.rb
502         offlineasm/offsets.rb
503         offlineasm/opt.rb
504         offlineasm/parser.rb
505         offlineasm/registers.rb
506         offlineasm/risc.rb
507         offlineasm/self_hash.rb
508         offlineasm/settings.rb
509         offlineasm/transform.rb
510         offlineasm/x86.rb
511     )
512
513     add_custom_command(
514         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
515         MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
516         DEPENDS ${LLINT_ASM} ${OFFLINE_ASM}
517         COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
518         VERBATIM)
519
520     # We add the header file directly to the ADD_EXECUTABLE call instead of setting the
521     # OBJECT_DEPENDS property in LLIntOffsetsExtractor.cpp because generate_offset_extractor.rb may
522     # not regenerate it in case the hash it calculates does not change.
523     # In this case, if some of the dependencies specified in the ADD_CUSTOM_COMMAND above have
524     # changed the command will always be called because the mtime of LLIntDesiredOffsets.h will
525     # always be older than that of its dependencies.
526     # Additionally, setting the OBJECT_DEPENDS property will make LLIntDesiredOffsets.h a Makefile
527     # dependency of both LLIntOffsetsExtractor and LLIntOffsetsExtractor.cpp, so the command will
528     # actually be run twice!
529     add_executable(LLIntOffsetsExtractor
530         ${JAVASCRIPTCORE_DIR}/llint/LLIntOffsetsExtractor.cpp
531         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
532     )
533     target_link_libraries(LLIntOffsetsExtractor WTF)
534
535     # The build system will execute asm.rb every time LLIntOffsetsExtractor's mtime is newer than
536     # LLIntAssembly.h's mtime. The problem we have here is: asm.rb has some built-in optimization
537     # that generates a checksum of the LLIntOffsetsExtractor binary, if the checksum of the new
538     # LLIntOffsetsExtractor matches, no output is generated. To make this target consistent and avoid
539     # running this command for every build, we artificially update LLIntAssembly.h's mtime (using touch)
540     # after every asm.rb run.
541     add_custom_command(
542         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
543         MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
544         DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM}
545         COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
546         COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
547         VERBATIM)
548
549     # The explanation for not making LLIntAssembly.h part of the OBJECT_DEPENDS property of some of
550     # the .cpp files below is similar to the one in the previous comment. However, since these .cpp
551     # files are used to build JavaScriptCore itself, we can just add LLIntAssembly.h to JSC_HEADERS
552     # since it is used in the add_library() call at the end of this file.
553     list(APPEND JavaScriptCore_HEADERS
554         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
555     )
556     list(APPEND JavaScriptCore_SOURCES
557         llint/LLIntCLoop.cpp
558         llint/LLIntData.cpp
559         llint/LLIntEntrypoint.cpp
560         llint/LLIntExceptions.cpp
561         llint/LLIntSlowPaths.cpp
562         llint/LLIntThunks.cpp
563         llint/LowLevelInterpreter.cpp
564     )
565 endif ()
566
567 set(HASH_LUT_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/create_hash_table)
568 macro(GENERATE_HASH_LUT _input _output)
569     add_custom_command(
570         OUTPUT ${_output}
571         DEPENDS ${HASH_LUT_GENERATOR} ${_input}
572         COMMAND ${PERL_EXECUTABLE} ${HASH_LUT_GENERATOR} ${_input} -i > ${_output}
573         VERBATIM)
574     list(APPEND JavaScriptCore_HEADERS ${_output})
575 endmacro()
576
577 # GENERATOR 1-A: LUT creator
578 foreach (_file ${JavaScriptCore_LUT_FILES})
579     get_filename_component(_name ${_file} NAME_WE)
580     GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
581 endforeach ()
582
583 set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
584     assembler
585     bytecode
586     collector/handles
587     debugger
588     heap
589     inspector
590     interpreter
591     jit
592     llint
593     parser
594     profiler
595     runtime
596     yarr
597 )
598
599 set(JavaScriptCore_FORWARDING_HEADERS_FILES
600     API/APICast.h
601     API/APIShims.h
602     API/JSBase.h
603     API/JSCTestRunnerUtils.h
604     API/JSContextRef.h
605     API/JSContextRefPrivate.h
606     API/JSObjectRef.h
607     API/JSObjectRefPrivate.h
608     API/JSRetainPtr.h
609     API/JSScriptRefPrivate.h
610     API/JSStringRef.h
611     API/JSStringRefBSTR.h
612     API/JSStringRefCF.h
613     API/JSValueRef.h
614     API/JSWeakObjectMapRefInternal.h
615     API/JSWeakObjectMapRefPrivate.h
616     API/JavaScript.h
617     API/JavaScriptCore.h
618     API/OpaqueJSString.h
619     API/WebKitAvailability.h
620 )
621
622
623 # GENERATOR 1-B: particular LUT creator (for 1 file only)
624 GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
625
626 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
627 add_custom_command(
628     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
629     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
630     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
631     VERBATIM)
632 ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
633
634
635 #GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
636 add_custom_command(
637     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
638     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py
639     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py ${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
640     VERBATIM)
641 ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/parser/Lexer.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h)
642
643 if (WTF_CPU_ARM)
644     list(APPEND JavaScriptCore_SOURCES
645         assembler/ARMAssembler.cpp
646         assembler/ARMv7Assembler.cpp
647         assembler/MacroAssemblerARM.cpp
648     )
649     if (MSVC AND ENABLE_JIT)
650         add_custom_command(
651             OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
652             MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_jit_stubs
653             DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubsARM.h
654             DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp
655             COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_jit_stubs --prefix=MSVC --header ${JAVASCRIPTCORE_DIR}/jit/JITStubsARM.h ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp > ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
656             VERBATIM)
657
658         add_custom_command(
659             OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
660             MAIN_DEPENDENCY ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
661             COMMAND armasm -nologo ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
662             VERBATIM)
663
664         list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj)
665     endif ()
666 elseif (WTF_CPU_MIPS)
667 elseif (WTF_CPU_SH4)
668 elseif (WTF_CPU_X86)
669     list(APPEND JavaScriptCore_SOURCES
670         assembler/MacroAssemblerX86Common.cpp
671     )
672 elseif (WTF_CPU_X86_64)
673     if (MSVC AND ENABLE_JIT)
674         add_custom_command(
675             OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
676             MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
677             COMMAND ml64 -nologo -c -Fo ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
678             VERBATIM)
679
680         list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj)
681     endif ()
682     list(APPEND JavaScriptCore_SOURCES
683         assembler/MacroAssemblerX86Common.cpp
684     )
685 else ()
686     message(FATAL_ERROR "Unknown CPU")
687 endif ()
688
689
690 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
691
692 WEBKIT_CREATE_FORWARDING_HEADERS(JavaScriptCore DIRECTORIES ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES} FILES ${JavaScriptCore_FORWARDING_HEADERS_FILES})
693
694
695 add_subdirectory(shell)
696
697 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
698 include_directories(${JavaScriptCore_INCLUDE_DIRECTORIES})
699 add_definitions(-DSTATICALLY_LINKED_WITH_WTF)
700 add_library(JavaScriptCore ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
701 target_link_libraries(JavaScriptCore ${JavaScriptCore_LIBRARIES})
702 set_target_properties(JavaScriptCore PROPERTIES COMPILE_DEFINITIONS "BUILDING_JavaScriptCore")
703 set_target_properties(JavaScriptCore PROPERTIES FOLDER "JavaScriptCore")
704 set_target_properties(JavaScriptCore PROPERTIES LINK_INTERFACE_LIBRARIES "")
705
706 if (JavaScriptCore_OUTPUT_NAME)
707     set_target_properties(JavaScriptCore PROPERTIES OUTPUT_NAME ${JavaScriptCore_OUTPUT_NAME})
708 endif ()
709
710 if (SHARED_CORE)
711     set_target_properties(JavaScriptCore PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
712     install(TARGETS JavaScriptCore DESTINATION "${LIB_INSTALL_DIR}")
713 endif ()