CMakeLists.txt 22.5 KB
Newer Older
1
set(JavaScriptCore_INCLUDE_DIRECTORIES
2 3 4 5 6 7 8
    "${CMAKE_BINARY_DIR}"
    "${JAVASCRIPTCORE_DIR}"
    "${JAVASCRIPTCORE_DIR}/API"
    "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
    "${JAVASCRIPTCORE_DIR}/assembler"
    "${JAVASCRIPTCORE_DIR}/bytecode"
    "${JAVASCRIPTCORE_DIR}/bytecompiler"
9
    "${JAVASCRIPTCORE_DIR}/dfg"
10
    "${JAVASCRIPTCORE_DIR}/disassembler"
11
    "${JAVASCRIPTCORE_DIR}/ftl"
12
    "${JAVASCRIPTCORE_DIR}/heap"
13 14 15
    "${JAVASCRIPTCORE_DIR}/debugger"
    "${JAVASCRIPTCORE_DIR}/interpreter"
    "${JAVASCRIPTCORE_DIR}/jit"
16
    "${JAVASCRIPTCORE_DIR}/llint"
17 18 19
    "${JAVASCRIPTCORE_DIR}/parser"
    "${JAVASCRIPTCORE_DIR}/profiler"
    "${JAVASCRIPTCORE_DIR}/runtime"
20
    "${JAVASCRIPTCORE_DIR}/tools"
21
    "${JAVASCRIPTCORE_DIR}/yarr"
22
    "${WTF_DIR}"
23
    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
24
    "${CMAKE_SOURCE_DIR}/Source"
25 26
)

27
set(JavaScriptCore_SOURCES
28
    API/JSBase.cpp
29
    API/JSCTestRunnerUtils.cpp
30 31 32 33 34 35 36
    API/JSCallbackConstructor.cpp
    API/JSCallbackFunction.cpp
    API/JSCallbackObject.cpp
    API/JSClassRef.cpp
    API/JSContextRef.cpp
    API/JSObjectRef.cpp
    API/JSProfilerPrivate.cpp
37
    API/JSScriptRef.cpp
38 39 40 41
    API/JSStringRef.cpp
    API/JSValueRef.cpp
    API/JSWeakObjectMapRefPrivate.cpp
    API/OpaqueJSString.cpp
42

43
    assembler/MacroAssembler.cpp
44
    assembler/LinkBuffer.cpp
45
    assembler/MacroAssemblerX86Common.cpp
46

47
    bytecode/ArrayAllocationProfile.cpp
48
    bytecode/ArrayProfile.cpp
49
    bytecode/CallLinkInfo.cpp
50
    bytecode/CallLinkStatus.cpp
51
    bytecode/CodeBlock.cpp
52 53 54
    bytecode/CodeBlockHash.cpp
    bytecode/CodeOrigin.cpp
    bytecode/CodeType.cpp
55
    bytecode/DFGExitProfile.cpp
56
    bytecode/DeferredCompilationCallback.cpp
57
    bytecode/ExecutionCounter.cpp
58
    bytecode/ExitKind.cpp
59
    bytecode/GetByIdStatus.cpp
60
    bytecode/JumpTable.cpp
61 62
    bytecode/LazyOperandValueProfile.cpp
    bytecode/MethodOfGettingAValueProfile.cpp
63
    bytecode/Opcode.cpp
64
    bytecode/PolymorphicPutByIdList.cpp
65
    bytecode/PreciseJumpTargets.cpp
66
    bytecode/PutByIdStatus.cpp
67
    bytecode/ReduceWhitespace.cpp
68
    bytecode/SamplingTool.cpp
69
    bytecode/SpecialPointer.cpp
70
    bytecode/SpeculatedType.cpp
71
    bytecode/StructureStubClearingWatchpoint.cpp
72
    bytecode/StructureStubInfo.cpp
73
    bytecode/UnlinkedCodeBlock.cpp
74
    bytecode/Watchpoint.cpp
75 76 77 78

    bytecompiler/BytecodeGenerator.cpp
    bytecompiler/NodesCodegen.cpp

79 80
    dfg/DFGAbstractHeap.cpp
    dfg/DFGAbstractValue.cpp
81
    dfg/DFGArgumentsSimplificationPhase.cpp
82
    dfg/DFGArrayMode.cpp
83
    dfg/DFGAssemblyHelpers.cpp
84
    dfg/DFGAtTailAbstractState.cpp
85
    dfg/DFGBackwardsPropagationPhase.cpp
86 87 88
    dfg/DFGBasicBlock.cpp
    dfg/DFGBinarySwitch.cpp
    dfg/DFGBlockInsertionSet.cpp
89
    dfg/DFGByteCodeParser.cpp
90
    dfg/DFGCFAPhase.cpp
91
    dfg/DFGCFGSimplificationPhase.cpp
92
    dfg/DFGCPSRethreadingPhase.cpp
93
    dfg/DFGCSEPhase.cpp
94 95 96 97 98
    dfg/DFGCapabilities.cpp
    dfg/DFGClobberSet.cpp
    dfg/DFGClobberize.cpp
    dfg/DFGCommon.cpp
    dfg/DFGCommonData.cpp
99 100
    dfg/DFGCompilationKey.cpp
    dfg/DFGCompilationMode.cpp
101 102
    dfg/DFGConstantFoldingPhase.cpp
    dfg/DFGCriticalEdgeBreakingPhase.cpp
103
    dfg/DFGDCEPhase.cpp
104 105
    dfg/DFGDesiredIdentifiers.cpp
    dfg/DFGDesiredStructureChains.cpp
106
    dfg/DFGDesiredTransitions.cpp
107
    dfg/DFGDesiredWatchpoints.cpp
108 109
    dfg/DFGDesiredWeakReferences.cpp
    dfg/DFGDesiredWriteBarriers.cpp
110
    dfg/DFGDisassembler.cpp
111
    dfg/DFGDominators.cpp
112
    dfg/DFGDriver.cpp
113
    dfg/DFGEdge.cpp
114 115
    dfg/DFGFailedFinalizer.cpp
    dfg/DFGFinalizer.cpp
116
    dfg/DFGFixupPhase.cpp
117 118
    dfg/DFGFlushFormat.cpp
    dfg/DFGFlushLivenessAnalysisPhase.cpp
119
    dfg/DFGGraph.cpp
120
    dfg/DFGInPlaceAbstractState.cpp
121
    dfg/DFGJITCode.cpp
122
    dfg/DFGJITCompiler.cpp
123 124 125 126
    dfg/DFGJITFinalizer.cpp
    dfg/DFGLICMPhase.cpp
    dfg/DFGLazyJSValue.cpp
    dfg/DFGLivenessAnalysisPhase.cpp
127
    dfg/DFGLongLivedState.cpp
128
    dfg/DFGLoopPreHeaderCreationPhase.cpp
129
    dfg/DFGMinifiedNode.cpp
130
    dfg/DFGNaturalLoops.cpp
131
    dfg/DFGNode.cpp
132
    dfg/DFGNodeFlags.cpp
133
    dfg/DFGOSRAvailabilityAnalysisPhase.cpp
134
    dfg/DFGOSREntry.cpp
135
    dfg/DFGOSREntrypointCreationPhase.cpp
136
    dfg/DFGOSRExit.cpp
137
    dfg/DFGOSRExitBase.cpp
138 139 140
    dfg/DFGOSRExitCompiler.cpp
    dfg/DFGOSRExitCompiler32_64.cpp
    dfg/DFGOSRExitCompiler64.cpp
141
    dfg/DFGOSRExitCompilerCommon.cpp
142
    dfg/DFGOSRExitJumpPlaceholder.cpp
143
    dfg/DFGOSRExitPreparation.cpp
144
    dfg/DFGOperations.cpp
145
    dfg/DFGPhase.cpp
146
    dfg/DFGPlan.cpp
147
    dfg/DFGPredictionInjectionPhase.cpp
148
    dfg/DFGPredictionPropagationPhase.cpp
149
    dfg/DFGRepatch.cpp
150
    dfg/DFGSSAConversionPhase.cpp
151 152 153 154
    dfg/DFGSpeculativeJIT.cpp
    dfg/DFGSpeculativeJIT32_64.cpp
    dfg/DFGSpeculativeJIT64.cpp
    dfg/DFGThunks.cpp
155
    dfg/DFGTierUpCheckInjectionPhase.cpp
156
    dfg/DFGTypeCheckHoistingPhase.cpp
157
    dfg/DFGUnificationPhase.cpp
158
    dfg/DFGUseKind.cpp
159
    dfg/DFGValidate.cpp
160
    dfg/DFGValueSource.cpp
161
    dfg/DFGVariableAccessDataDump.cpp
162 163
    dfg/DFGVariableEvent.cpp
    dfg/DFGVariableEventStream.cpp
164
    dfg/DFGVirtualRegisterAllocationPhase.cpp
165
    dfg/DFGWorklist.cpp
166

167
    disassembler/ARMv7Disassembler.cpp
168
    disassembler/Disassembler.cpp
169 170 171
    disassembler/LLVMDisassembler.cpp
    disassembler/UDis86Disassembler.cpp
    disassembler/X86Disassembler.cpp
172

173
    heap/BlockAllocator.cpp
174
    heap/CodeBlockSet.cpp
175 176 177 178 179 180 181 182 183 184
    heap/ConservativeRoots.cpp
    heap/CopiedSpace.cpp
    heap/CopyVisitor.cpp
    heap/GCThread.cpp
    heap/GCThreadSharedData.cpp
    heap/HandleSet.cpp
    heap/HandleStack.cpp
    heap/Heap.cpp
    heap/HeapStatistics.cpp
    heap/HeapTimer.cpp
185
    heap/IncrementalSweeper.cpp
186 187 188
    heap/JITStubRoutineSet.cpp
    heap/MachineStackMarker.cpp
    heap/MarkStack.cpp
189
    heap/MarkedAllocator.cpp
190
    heap/MarkedBlock.cpp
191
    heap/MarkedSpace.cpp
192
    heap/SlotVisitor.cpp
193
    heap/SuperRegion.cpp
194
    heap/VTableSpectrum.cpp
195
    heap/Weak.cpp
196
    heap/WeakBlock.cpp
197 198
    heap/WeakHandleOwner.cpp
    heap/WeakSet.cpp
199
    heap/WriteBarrierSupport.cpp
200

201 202 203
    debugger/Debugger.cpp
    debugger/DebuggerActivation.cpp
    debugger/DebuggerCallFrame.cpp
204

205
    interpreter/AbstractPC.cpp
206 207
    interpreter/CallFrame.cpp
    interpreter/Interpreter.cpp
208
    interpreter/JSStack.cpp
209
    interpreter/StackVisitor.cpp
210
    interpreter/VMInspector.cpp
211

212
    jit/ClosureCallStubRoutine.cpp
213
    jit/ExecutableAllocator.cpp
214
    jit/ExecutableAllocatorFixedVMPool.cpp
215
    jit/GCAwareJITStubRoutine.cpp
216 217
    jit/HostCallReturnValue.cpp
    jit/JIT.cpp
218
    jit/JITArithmetic.cpp
219
    jit/JITArithmetic32_64.cpp
220
    jit/JITCall.cpp
221
    jit/JITCall32_64.cpp
222
    jit/JITCode.cpp
223
    jit/JITDisassembler.cpp
224
    jit/JITExceptions.cpp
225
    jit/JITOpcodes.cpp
226
    jit/JITOpcodes32_64.cpp
227
    jit/JITPropertyAccess.cpp
228
    jit/JITPropertyAccess32_64.cpp
229
    jit/JITStubRoutine.cpp
230
    jit/JITStubs.cpp
231
    jit/JITThunks.cpp
232
    jit/JITToDFGDeferredCompilationCallback.cpp
233
    jit/JumpReplacementWatchpoint.cpp
234
    jit/ThunkGenerators.cpp
235 236 237 238 239

    parser/Lexer.cpp
    parser/Nodes.cpp
    parser/Parser.cpp
    parser/ParserArena.cpp
240
    parser/SourceCode.cpp
241
    parser/SourceProvider.cpp
242
    parser/SourceProviderCache.cpp
243

244
    profiler/ProfilerBytecode.cpp
245
    profiler/ProfilerBytecodeSequence.cpp
246 247 248 249 250 251 252
    profiler/ProfilerBytecodes.cpp
    profiler/ProfilerCompilation.cpp
    profiler/ProfilerCompilationKind.cpp
    profiler/ProfilerCompiledBytecode.cpp
    profiler/ProfilerDatabase.cpp
    profiler/ProfilerOrigin.cpp
    profiler/ProfilerOriginStack.cpp
253 254
    profiler/ProfilerOSRExit.cpp
    profiler/ProfilerOSRExitSite.cpp
255
    profiler/ProfilerProfiledBytecodes.cpp
256 257 258
    profiler/Profile.cpp
    profiler/ProfileGenerator.cpp
    profiler/ProfileNode.cpp
259
    profiler/LegacyProfiler.cpp
260 261 262

    runtime/ArgList.cpp
    runtime/Arguments.cpp
263 264
    runtime/ArrayBuffer.cpp
    runtime/ArrayBufferView.cpp
265 266 267 268 269 270
    runtime/ArrayConstructor.cpp
    runtime/ArrayPrototype.cpp
    runtime/BooleanConstructor.cpp
    runtime/BooleanObject.cpp
    runtime/BooleanPrototype.cpp
    runtime/CallData.cpp
271
    runtime/CodeCache.cpp
272
    runtime/CodeSpecializationKind.cpp
273
    runtime/CommonIdentifiers.cpp
274
    runtime/CommonSlowPaths.cpp
275
    runtime/CommonSlowPathsExceptions.cpp
276
    runtime/CompilationResult.cpp
277 278
    runtime/Completion.cpp
    runtime/ConstructData.cpp
279 280
    runtime/DataView.cpp
    runtime/DataView.h
281 282 283 284
    runtime/DateConstructor.cpp
    runtime/DateConversion.cpp
    runtime/DateInstance.cpp
    runtime/DatePrototype.cpp
285
    runtime/DumpContext.cpp
286 287 288 289 290 291 292
    runtime/Error.cpp
    runtime/ErrorConstructor.cpp
    runtime/ErrorInstance.cpp
    runtime/ErrorPrototype.cpp
    runtime/ExceptionHelpers.cpp
    runtime/Executable.cpp
    runtime/FunctionConstructor.cpp
293
    runtime/FunctionExecutableDump.cpp
294
    runtime/FunctionPrototype.cpp
295
    runtime/GCActivityCallback.cpp
296 297
    runtime/GetterSetter.cpp
    runtime/Identifier.cpp
298
    runtime/IndexingType.cpp
299
    runtime/InitializeThreading.cpp
300
    runtime/IntendedStructureChain.cpp
301 302
    runtime/InternalFunction.cpp
    runtime/JSAPIValueWrapper.cpp
303
    runtime/JSActivation.cpp
304
    runtime/JSArray.cpp
305 306 307 308
    runtime/JSArrayBuffer.cpp
    runtime/JSArrayBufferConstructor.cpp
    runtime/JSArrayBufferPrototype.cpp
    runtime/JSArrayBufferView.cpp
309 310
    runtime/JSBoundFunction.cpp
    runtime/JSCJSValue.cpp
311
    runtime/JSCell.cpp
312
    runtime/JSChunk.cpp
313 314
    runtime/JSDataView.cpp
    runtime/JSDataViewPrototype.cpp
315
    runtime/JSDateMath.cpp
316 317 318 319
    runtime/JSFunction.cpp
    runtime/JSGlobalObject.cpp
    runtime/JSGlobalObjectFunctions.cpp
    runtime/JSLock.cpp
oliver@apple.com's avatar
oliver@apple.com committed
320
    runtime/JSMap.cpp
321
    runtime/JSNameScope.cpp
322 323
    runtime/JSNotAnObject.cpp
    runtime/JSONObject.cpp
324
    runtime/JSObject.cpp
weinig@apple.com's avatar
weinig@apple.com committed
325 326 327 328 329 330 331
    runtime/JSPromise.cpp
    runtime/JSPromiseCallback.cpp
    runtime/JSPromiseConstructor.cpp
    runtime/JSPromisePrototype.cpp
    runtime/JSPromiseResolver.cpp
    runtime/JSPromiseResolverConstructor.cpp
    runtime/JSPromiseResolverPrototype.cpp
332
    runtime/JSPropertyNameIterator.cpp
333
    runtime/JSProxy.cpp
334
    runtime/JSScope.cpp
335
    runtime/JSSegmentedVariableObject.cpp
oliver@apple.com's avatar
oliver@apple.com committed
336
    runtime/JSSet.cpp
337
    runtime/JSStaticScopeObject.cpp
338
    runtime/JSString.cpp
339
    runtime/JSStringJoiner.cpp
340
    runtime/JSSymbolTableObject.cpp
341 342 343
    runtime/JSTypedArrayConstructors.cpp
    runtime/JSTypedArrayPrototypes.cpp
    runtime/JSTypedArrays.cpp
344
    runtime/JSVariableObject.cpp
oliver@apple.com's avatar
oliver@apple.com committed
345
    runtime/JSWeakMap.cpp
346
    runtime/JSWithScope.cpp
347 348 349
    runtime/JSWrapperObject.cpp
    runtime/LiteralParser.cpp
    runtime/Lookup.cpp
350
    runtime/MapConstructor.cpp
oliver@apple.com's avatar
oliver@apple.com committed
351
    runtime/MapData.cpp
352
    runtime/MapPrototype.cpp
353
    runtime/MathObject.cpp
354
    runtime/MemoryStatistics.cpp
355 356 357
    runtime/NameConstructor.cpp
    runtime/NameInstance.cpp
    runtime/NamePrototype.cpp
358 359 360 361 362 363 364 365
    runtime/NativeErrorConstructor.cpp
    runtime/NativeErrorPrototype.cpp
    runtime/NumberConstructor.cpp
    runtime/NumberObject.cpp
    runtime/NumberPrototype.cpp
    runtime/ObjectConstructor.cpp
    runtime/ObjectPrototype.cpp
    runtime/Operations.cpp
366
    runtime/Options.cpp
367 368 369
    runtime/PropertyDescriptor.cpp
    runtime/PropertyNameArray.cpp
    runtime/PropertySlot.cpp
370
    runtime/PropertyTable.cpp
371
    runtime/PrototypeMap.cpp
372
    runtime/RegExp.cpp
373
    runtime/RegExpCache.cpp
374
    runtime/RegExpCachedResult.cpp
375
    runtime/RegExpConstructor.cpp
376
    runtime/RegExpMatchesArray.cpp
377 378
    runtime/RegExpObject.cpp
    runtime/RegExpPrototype.cpp
379
    runtime/SamplingCounter.cpp
oliver@apple.com's avatar
oliver@apple.com committed
380 381
    runtime/SetConstructor.cpp
    runtime/SetPrototype.cpp
382
    runtime/SimpleTypedArrayController.cpp
383
    runtime/SmallStrings.cpp
384
    runtime/SparseArrayValueMap.cpp
385
    runtime/StrictEvalActivation.cpp
386 387 388
    runtime/StringConstructor.cpp
    runtime/StringObject.cpp
    runtime/StringPrototype.cpp
389
    runtime/StringRecursionChecker.cpp
390 391
    runtime/Structure.cpp
    runtime/StructureChain.cpp
392
    runtime/StructureRareData.cpp
393
    runtime/SymbolTable.cpp
394
    runtime/TestRunnerUtils.cpp
395 396
    runtime/TypedArrayController.cpp
    runtime/TypedArrayType.cpp
397
    runtime/VM.cpp
398 399
    runtime/Watchdog.cpp
    runtime/WatchdogNone.cpp
oliver@apple.com's avatar
oliver@apple.com committed
400 401 402
    runtime/WeakMapConstructor.cpp
    runtime/WeakMapData.cpp
    runtime/WeakMapPrototype.cpp
403

404 405 406
    tools/CodeProfile.cpp
    tools/CodeProfiling.cpp

407
    yarr/YarrCanonicalizeUCS2.cpp
408 409 410
    yarr/YarrPattern.cpp
    yarr/YarrInterpreter.cpp
    yarr/YarrJIT.cpp
411
    yarr/YarrSyntaxChecker.cpp
412 413
)

414
set(JavaScriptCore_LUT_FILES
415
    runtime/ArrayConstructor.cpp
416
    runtime/ArrayPrototype.cpp
417 418
    runtime/BooleanPrototype.cpp
    runtime/DateConstructor.cpp
419
    runtime/DatePrototype.cpp
420
    runtime/ErrorPrototype.cpp
421
    runtime/JSDataViewPrototype.cpp
422
    runtime/JSGlobalObject.cpp
423
    runtime/JSONObject.cpp
weinig@apple.com's avatar
weinig@apple.com committed
424 425 426
    runtime/JSPromiseConstructor.cpp
    runtime/JSPromisePrototype.cpp
    runtime/JSPromiseResolverPrototype.cpp
427
    runtime/NamePrototype.cpp
428
    runtime/NumberConstructor.cpp
429
    runtime/NumberPrototype.cpp
barraclough@apple.com's avatar
barraclough@apple.com committed
430
    runtime/ObjectConstructor.cpp
431 432
    runtime/RegExpConstructor.cpp
    runtime/RegExpObject.cpp
433 434
    runtime/RegExpPrototype.cpp
    runtime/StringConstructor.cpp
435 436
)

437
set(JavaScriptCore_LIBRARIES
438
    WTF
439 440
)

441 442 443 444 445 446 447 448 449
if (WTF_USE_ICU_UNICODE)
    list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
        ${ICU_INCLUDE_DIRS}
    )
    list(APPEND JavaScriptCore_LIBRARIES
        ${ICU_I18N_LIBRARIES}
    )
endif ()

450
if (ENABLE_LLINT)
451 452 453
    # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
    # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
    # for finding the only Ruby interpreter.
454 455 456
    if (NOT RUBY_EXECUTABLE)
        message(FATAL_ERROR "The Ruby interpreter is needed to generate LLInt files.")
    endif ()
457

458
    set(LLINT_ASM
459 460 461 462 463
        llint/LowLevelInterpreter.asm
        llint/LowLevelInterpreter32_64.asm
        llint/LowLevelInterpreter64.asm
    )

464
    set(OFFLINE_ASM
465
        offlineasm/arm.rb
466 467 468 469 470 471 472 473 474
        offlineasm/ast.rb
        offlineasm/backends.rb
        offlineasm/cloop.rb
        offlineasm/config.rb
        offlineasm/instructions.rb
        offlineasm/offsets.rb
        offlineasm/opt.rb
        offlineasm/parser.rb
        offlineasm/registers.rb
475
        offlineasm/risc.rb
476 477 478 479 480 481
        offlineasm/self_hash.rb
        offlineasm/settings.rb
        offlineasm/transform.rb
        offlineasm/x86.rb
    )

482
    add_custom_command(
483 484 485 486 487 488
        OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
        MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
        DEPENDS ${LLINT_ASM} ${OFFLINE_ASM}
        COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
        VERBATIM)

489 490 491 492 493 494 495 496 497
    # We add the header file directly to the ADD_EXECUTABLE call instead of setting the
    # OBJECT_DEPENDS property in LLIntOffsetsExtractor.cpp because generate_offset_extractor.rb may
    # not regenerate it in case the hash it calculates does not change.
    # In this case, if some of the dependencies specified in the ADD_CUSTOM_COMMAND above have
    # changed the command will always be called because the mtime of LLIntDesiredOffsets.h will
    # always be older than that of its dependencies.
    # Additionally, setting the OBJECT_DEPENDS property will make LLIntDesiredOffsets.h a Makefile
    # dependency of both LLIntOffsetsExtractor and LLIntOffsetsExtractor.cpp, so the command will
    # actually be run twice!
498
    add_executable(LLIntOffsetsExtractor
499 500 501
        ${JAVASCRIPTCORE_DIR}/llint/LLIntOffsetsExtractor.cpp
        ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
    )
502
    target_link_libraries(LLIntOffsetsExtractor WTF)
503

504 505 506 507 508 509
    # The build system will execute asm.rb every time LLIntOffsetsExtractor's mtime is newer than
    # LLIntAssembly.h's mtime. The problem we have here is: asm.rb has some built-in optimization
    # that generates a checksum of the LLIntOffsetsExtractor binary, if the checksum of the new
    # LLIntOffsetsExtractor matches, no output is generated. To make this target consistent and avoid
    # running this command for every build, we artificially update LLIntAssembly.h's mtime (using touch)
    # after every asm.rb run.
510
    add_custom_command(
511 512 513 514
        OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
        MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
        DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM}
        COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
515
        COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
516 517
        VERBATIM)

518 519 520
    # The explanation for not making LLIntAssembly.h part of the OBJECT_DEPENDS property of some of
    # the .cpp files below is similar to the one in the previous comment. However, since these .cpp
    # files are used to build JavaScriptCore itself, we can just add LLIntAssembly.h to JSC_HEADERS
521 522
    # since it is used in the add_library() call at the end of this file.
    list(APPEND JavaScriptCore_HEADERS
523 524
        ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
    )
525
    list(APPEND JavaScriptCore_SOURCES
526 527
        llint/LLIntCLoop.cpp
        llint/LLIntData.cpp
528
        llint/LLIntEntrypoint.cpp
529 530 531 532 533
        llint/LLIntExceptions.cpp
        llint/LLIntSlowPaths.cpp
        llint/LLIntThunks.cpp
        llint/LowLevelInterpreter.cpp
    )
534
endif ()
535

536 537 538 539 540 541 542 543 544 545
set(HASH_LUT_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/create_hash_table)
macro(GENERATE_HASH_LUT _input _output)
    add_custom_command(
        OUTPUT ${_output}
        DEPENDS ${HASH_LUT_GENERATOR} ${_input}
        COMMAND ${PERL_EXECUTABLE} ${HASH_LUT_GENERATOR} ${_input} -i > ${_output}
        VERBATIM)
    list(APPEND JavaScriptCore_HEADERS ${_output})
endmacro()

546
# GENERATOR 1-A: LUT creator
547 548
foreach (_file ${JavaScriptCore_LUT_FILES})
    get_filename_component(_name ${_file} NAME_WE)
549
    GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
550
endforeach ()
551

552
set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
553 554 555 556 557 558 559 560 561 562 563 564 565 566
    assembler
    bytecode
    collector/handles
    debugger
    heap
    interpreter
    jit
    llint
    parser
    profiler
    runtime
    yarr
)

567
set(JavaScriptCore_FORWARDING_HEADERS_FILES
568 569 570 571
    API/APICast.h
    API/APIShims.h
    API/JavaScript.h
    API/JSBase.h
572
    API/JSCTestRunnerUtils.h
573 574 575 576
    API/JSContextRef.h
    API/JSContextRefPrivate.h
    API/JSObjectRef.h
    API/JSObjectRefPrivate.h
577
    API/JSScriptRefPrivate.h
578 579 580 581 582 583 584 585 586 587 588 589 590
    API/JSStringRef.h
    API/JSStringRefCF.h
    API/JSStringRefBSTR.h
    API/JSValueRef.h
    API/JavaScriptCore.h
    API/JSRetainPtr.h
    API/JSWeakObjectMapRefInternal.h
    API/JSWeakObjectMapRefPrivate.h
    API/JSRetainPtr.h
    API/OpaqueJSString.h
    API/WebKitAvailability.h
)

591 592

# GENERATOR 1-B: particular LUT creator (for 1 file only)
593
GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
594 595

#GENERATOR: "RegExpJitTables.h": tables used by Yarr
596
add_custom_command(
597
    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
598 599
    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
600
    VERBATIM)
601
ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
602 603


604
#GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
605
add_custom_command(
606
    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
607 608
    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py
    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py ${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
609
    VERBATIM)
610
ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/parser/Lexer.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h)
611

612 613
if (WTF_CPU_ARM)
    list(APPEND JavaScriptCore_SOURCES
614
        assembler/ARMAssembler.cpp
615
        assembler/ARMv7Assembler.cpp
616 617
        assembler/MacroAssemblerARM.cpp
    )
618 619 620 621
    if (MSVC AND ENABLE_JIT)
        add_custom_command(
            OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
            MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_jit_stubs
622
            DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubsARM.h
623
            DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp
624
            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
625 626 627 628 629 630 631 632 633 634
            VERBATIM)

        add_custom_command(
            OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
            MAIN_DEPENDENCY ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
            COMMAND armasm -nologo ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
            VERBATIM)

        list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj)
    endif ()
635 636
elseif (WTF_CPU_MIPS)
elseif (WTF_CPU_X86)
637 638 639
    list(APPEND JavaScriptCore_SOURCES
        assembler/MacroAssemblerX86Common.cpp
    )
640
elseif (WTF_CPU_X86_64)
641 642 643 644 645 646 647 648 649
    if (MSVC AND ENABLE_JIT)
        add_custom_command(
            OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
            MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
            COMMAND ml64 -nologo -c -Fo ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
            VERBATIM)

        list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj)
    endif ()
650 651 652
    list(APPEND JavaScriptCore_SOURCES
        assembler/MacroAssemblerX86Common.cpp
    )
653 654 655
else ()
    message(FATAL_ERROR "Unknown CPU")
endif ()
656 657


658
WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
659

660 661
WEBKIT_CREATE_FORWARDING_HEADERS(JavaScriptCore DIRECTORIES ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES} FILES ${JavaScriptCore_FORWARDING_HEADERS_FILES})

662

663
add_subdirectory(shell)
664 665

WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
666
include_directories(${JavaScriptCore_INCLUDE_DIRECTORIES})
667
add_definitions(-DBUILDING_JavaScriptCore -DSTATICALLY_LINKED_WITH_WTF)
668 669 670 671 672 673 674 675
add_library(JavaScriptCore ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
target_link_libraries(JavaScriptCore ${JavaScriptCore_LIBRARIES})
set_target_properties(JavaScriptCore PROPERTIES FOLDER "JavaScriptCore")
set_target_properties(JavaScriptCore PROPERTIES LINK_INTERFACE_LIBRARIES "")

if (JavaScriptCore_OUTPUT_NAME)
    set_target_properties(JavaScriptCore PROPERTIES OUTPUT_NAME ${JavaScriptCore_OUTPUT_NAME})
endif ()
676 677

if (SHARED_CORE)
678 679
    set_target_properties(JavaScriptCore PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
    install(TARGETS JavaScriptCore DESTINATION "${LIB_INSTALL_DIR}")
680
endif ()