BUILD.gn 12 KB
Newer Older
machenbach's avatar
machenbach committed
1 2 3 4 5 6
# Copyright 2016 The V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("../../gni/v8.gni")

7
v8_executable("cctest") {
machenbach's avatar
machenbach committed
8 9
  testonly = true

jochen's avatar
jochen committed
10 11
  sources = [
    "$target_gen_dir/resources.cc",
12 13

    ### gcmole(all) ###
jochen's avatar
jochen committed
14
    "asmjs/test-asm-typer.cc",
15
    "ast-types-fuzz.h",
jochen's avatar
jochen committed
16
    "cctest.cc",
17
    "cctest.h",
jochen's avatar
jochen committed
18
    "compiler/c-signature.h",
19
    "compiler/call-tester.h",
jochen's avatar
jochen committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    "compiler/code-assembler-tester.h",
    "compiler/codegen-tester.cc",
    "compiler/codegen-tester.h",
    "compiler/function-tester.cc",
    "compiler/function-tester.h",
    "compiler/graph-builder-tester.h",
    "compiler/test-basic-block-profiler.cc",
    "compiler/test-branch-combine.cc",
    "compiler/test-code-assembler.cc",
    "compiler/test-gap-resolver.cc",
    "compiler/test-graph-visualizer.cc",
    "compiler/test-instruction.cc",
    "compiler/test-js-constant-cache.cc",
    "compiler/test-js-context-specialization.cc",
    "compiler/test-js-typed-lowering.cc",
    "compiler/test-jump-threading.cc",
    "compiler/test-linkage.cc",
    "compiler/test-loop-analysis.cc",
    "compiler/test-loop-assignment-analysis.cc",
    "compiler/test-machine-operator-reducer.cc",
    "compiler/test-multiple-return.cc",
    "compiler/test-node.cc",
    "compiler/test-operator.cc",
    "compiler/test-representation-change.cc",
    "compiler/test-run-bytecode-graph-builder.cc",
    "compiler/test-run-calls-to-external-references.cc",
    "compiler/test-run-deopt.cc",
    "compiler/test-run-inlining.cc",
    "compiler/test-run-intrinsics.cc",
    "compiler/test-run-jsbranches.cc",
    "compiler/test-run-jscalls.cc",
    "compiler/test-run-jsexceptions.cc",
    "compiler/test-run-jsobjects.cc",
    "compiler/test-run-jsops.cc",
    "compiler/test-run-load-store.cc",
    "compiler/test-run-machops.cc",
    "compiler/test-run-native-calls.cc",
    "compiler/test-run-stackcheck.cc",
    "compiler/test-run-stubs.cc",
    "compiler/test-run-unwinding-info.cc",
    "compiler/test-run-variables.cc",
    "compiler/test-run-wasm-machops.cc",
62 63
    "compiler/value-helper.h",
    "expression-type-collector-macros.h",
jochen's avatar
jochen committed
64
    "gay-fixed.cc",
65
    "gay-fixed.h",
jochen's avatar
jochen committed
66
    "gay-precision.cc",
67
    "gay-precision.h",
jochen's avatar
jochen committed
68
    "gay-shortest.cc",
69
    "gay-shortest.h",
jochen's avatar
jochen committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
    "heap/heap-tester.h",
    "heap/heap-utils.cc",
    "heap/heap-utils.h",
    "heap/test-alloc.cc",
    "heap/test-array-buffer-tracker.cc",
    "heap/test-compaction.cc",
    "heap/test-heap.cc",
    "heap/test-incremental-marking.cc",
    "heap/test-lab.cc",
    "heap/test-mark-compact.cc",
    "heap/test-page-promotion.cc",
    "heap/test-spaces.cc",
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/interpreter-tester.cc",
85
    "interpreter/interpreter-tester.h",
jochen's avatar
jochen committed
86 87 88 89 90 91 92 93
    "interpreter/source-position-matcher.cc",
    "interpreter/source-position-matcher.h",
    "interpreter/test-bytecode-generator.cc",
    "interpreter/test-interpreter-intrinsics.cc",
    "interpreter/test-interpreter.cc",
    "interpreter/test-source-positions.cc",
    "libplatform/test-tracing.cc",
    "libsampler/test-sampler.cc",
94
    "parsing/test-scanner-streams.cc",
95
    "parsing/test-scanner.cc",
jochen's avatar
jochen committed
96
    "print-extension.cc",
97
    "print-extension.h",
jochen's avatar
jochen committed
98
    "profiler-extension.cc",
99
    "profiler-extension.h",
jochen's avatar
jochen committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
    "test-access-checks.cc",
    "test-accessors.cc",
    "test-api-accessors.cc",
    "test-api-fast-accessor-builder.cc",
    "test-api-interceptors.cc",
    "test-api.cc",
    "test-api.h",
    "test-array-list.cc",
    "test-ast-types.cc",
    "test-ast.cc",
    "test-atomicops.cc",
    "test-bignum-dtoa.cc",
    "test-bignum.cc",
    "test-bit-vector.cc",
    "test-circular-queue.cc",
    "test-code-cache.cc",
    "test-code-layout.cc",
    "test-code-stub-assembler.cc",
    "test-compiler.cc",
    "test-constantpool.cc",
    "test-conversions.cc",
    "test-cpu-profiler.cc",
    "test-date.cc",
    "test-debug.cc",
    "test-decls.cc",
    "test-deoptimization.cc",
    "test-dictionary.cc",
    "test-diy-fp.cc",
    "test-double.cc",
    "test-dtoa.cc",
    "test-elements-kind.cc",
    "test-fast-dtoa.cc",
    "test-feedback-vector.cc",
133
    "test-feedback-vector.h",
jochen's avatar
jochen committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    "test-field-type-tracking.cc",
    "test-fixed-dtoa.cc",
    "test-flags.cc",
    "test-func-name-inference.cc",
    "test-global-handles.cc",
    "test-global-object.cc",
    "test-hashing.cc",
    "test-hashmap.cc",
    "test-heap-profiler.cc",
    "test-hydrogen-types.cc",
    "test-identity-map.cc",
    "test-inobject-slack-tracking.cc",
    "test-list.cc",
    "test-liveedit.cc",
    "test-lockers.cc",
    "test-log.cc",
    "test-mementos.cc",
151
    "test-modules.cc",
jochen's avatar
jochen committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
    "test-object.cc",
    "test-parsing.cc",
    "test-platform.cc",
    "test-profile-generator.cc",
    "test-random-number-generator.cc",
    "test-receiver-check-hidden-prototype.cc",
    "test-regexp.cc",
    "test-representation.cc",
    "test-sampler-api.cc",
    "test-serialize.cc",
    "test-simd.cc",
    "test-strings.cc",
    "test-strtod.cc",
    "test-symbols.cc",
    "test-thread-termination.cc",
    "test-threads.cc",
    "test-trace-event.cc",
169
    "test-traced-value.cc",
jochen's avatar
jochen committed
170 171 172 173 174 175 176 177 178 179 180 181 182
    "test-transitions.cc",
    "test-typedarrays.cc",
    "test-types.cc",
    "test-unbound-queue.cc",
    "test-unboxed-doubles.cc",
    "test-unique.cc",
    "test-unscopables-hidden-prototype.cc",
    "test-usecounters.cc",
    "test-utils.cc",
    "test-version.cc",
    "test-weakmaps.cc",
    "test-weaksets.cc",
    "trace-extension.cc",
183 184
    "trace-extension.h",
    "types-fuzz.h",
185
    "wasm/test-managed.cc",
jochen's avatar
jochen committed
186 187 188 189 190 191 192 193 194 195 196
    "wasm/test-run-wasm-64.cc",
    "wasm/test-run-wasm-asmjs.cc",
    "wasm/test-run-wasm-interpreter.cc",
    "wasm/test-run-wasm-js.cc",
    "wasm/test-run-wasm-module.cc",
    "wasm/test-run-wasm-relocation.cc",
    "wasm/test-run-wasm.cc",
    "wasm/test-wasm-stack.cc",
    "wasm/test-wasm-trap-position.cc",
    "wasm/wasm-run-utils.h",
  ]
machenbach's avatar
machenbach committed
197

198
  if (v8_current_cpu == "arm") {
199
    sources += [  ### gcmole(arch:arm) ###
jochen's avatar
jochen committed
200 201 202
      "test-assembler-arm.cc",
      "test-code-stubs-arm.cc",
      "test-code-stubs.cc",
203
      "test-code-stubs.h",
jochen's avatar
jochen committed
204 205 206 207
      "test-disasm-arm.cc",
      "test-macro-assembler-arm.cc",
      "test-run-wasm-relocation-arm.cc",
    ]
208
  } else if (v8_current_cpu == "arm64") {
209
    sources += [  ### gcmole(arch:arm64) ###
jochen's avatar
jochen committed
210 211 212
      "test-assembler-arm64.cc",
      "test-code-stubs-arm64.cc",
      "test-code-stubs.cc",
213
      "test-code-stubs.h",
jochen's avatar
jochen committed
214 215 216 217 218 219
      "test-disasm-arm64.cc",
      "test-fuzz-arm64.cc",
      "test-javascript-arm64.cc",
      "test-js-arm64-variables.cc",
      "test-run-wasm-relocation-arm64.cc",
      "test-utils-arm64.cc",
220
      "test-utils-arm64.h",
jochen's avatar
jochen committed
221
    ]
222
  } else if (v8_current_cpu == "x86") {
223
    sources += [  ### gcmole(arch:ia32) ###
jochen's avatar
jochen committed
224 225 226
      "test-assembler-ia32.cc",
      "test-code-stubs-ia32.cc",
      "test-code-stubs.cc",
227
      "test-code-stubs.h",
jochen's avatar
jochen committed
228 229 230 231 232
      "test-disasm-ia32.cc",
      "test-log-stack-tracer.cc",
      "test-macro-assembler-ia32.cc",
      "test-run-wasm-relocation-ia32.cc",
    ]
233
  } else if (v8_current_cpu == "mips") {
234
    sources += [  ### gcmole(arch:mips) ###
jochen's avatar
jochen committed
235 236 237
      "test-assembler-mips.cc",
      "test-code-stubs-mips.cc",
      "test-code-stubs.cc",
238
      "test-code-stubs.h",
jochen's avatar
jochen committed
239 240 241
      "test-disasm-mips.cc",
      "test-macro-assembler-mips.cc",
    ]
242
  } else if (v8_current_cpu == "mipsel") {
243
    sources += [  ### gcmole(arch:mipsel) ###
jochen's avatar
jochen committed
244 245 246
      "test-assembler-mips.cc",
      "test-code-stubs-mips.cc",
      "test-code-stubs.cc",
247
      "test-code-stubs.h",
jochen's avatar
jochen committed
248 249 250
      "test-disasm-mips.cc",
      "test-macro-assembler-mips.cc",
    ]
251
  } else if (v8_current_cpu == "mips64") {
252
    sources += [  ### gcmole(arch:mips64) ###
jochen's avatar
jochen committed
253 254 255
      "test-assembler-mips64.cc",
      "test-code-stubs-mips64.cc",
      "test-code-stubs.cc",
256
      "test-code-stubs.h",
jochen's avatar
jochen committed
257 258 259
      "test-disasm-mips64.cc",
      "test-macro-assembler-mips64.cc",
    ]
260
  } else if (v8_current_cpu == "mips64el") {
261
    sources += [  ### gcmole(arch:mips64el) ###
jochen's avatar
jochen committed
262 263 264
      "test-assembler-mips64.cc",
      "test-code-stubs-mips64.cc",
      "test-code-stubs.cc",
265
      "test-code-stubs.h",
jochen's avatar
jochen committed
266 267 268
      "test-disasm-mips64.cc",
      "test-macro-assembler-mips64.cc",
    ]
269
  } else if (v8_current_cpu == "x64") {
270
    sources += [  ### gcmole(arch:x64) ###
jochen's avatar
jochen committed
271 272 273
      "test-assembler-x64.cc",
      "test-code-stubs-x64.cc",
      "test-code-stubs.cc",
274
      "test-code-stubs.h",
jochen's avatar
jochen committed
275 276 277 278
      "test-disasm-x64.cc",
      "test-log-stack-tracer.cc",
      "test-macro-assembler-x64.cc",
      "test-run-wasm-relocation-x64.cc",
279
      "wasm/test-run-wasm-simd-lowering.cc",
jochen's avatar
jochen committed
280 281
      "wasm/test-run-wasm-simd.cc",
    ]
282
  } else if (v8_current_cpu == "x87") {
283
    sources += [  ### gcmole(arch:x87) ###
jochen's avatar
jochen committed
284 285 286
      "test-assembler-x87.cc",
      "test-code-stubs-x87.cc",
      "test-code-stubs.cc",
287
      "test-code-stubs.h",
jochen's avatar
jochen committed
288 289 290 291 292
      "test-disasm-x87.cc",
      "test-log-stack-tracer.cc",
      "test-macro-assembler-x87.cc",
      "test-run-wasm-relocation-x87.cc",
    ]
293
  } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
294
    sources += [  ### gcmole(arch:ppc) ###
jochen's avatar
jochen committed
295 296
      "test-assembler-ppc.cc",
      "test-code-stubs.cc",
297
      "test-code-stubs.h",
jochen's avatar
jochen committed
298 299
      "test-disasm-ppc.cc",
    ]
300
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
301
    sources += [  ### gcmole(arch:s390) ###
jochen's avatar
jochen committed
302 303
      "test-assembler-s390.cc",
      "test-code-stubs.cc",
304
      "test-code-stubs.h",
jochen's avatar
jochen committed
305 306
      "test-disasm-s390.cc",
    ]
machenbach's avatar
machenbach committed
307 308 309 310 311 312 313 314 315
  }

  if (is_linux) {
    # TODO(machenbach): Translate 'or OS=="qnx"' from gyp.
    sources += [ "test-platform-linux.cc" ]
  } else if (is_win) {
    sources += [ "test-platform-win32.cc" ]
  }

316
  configs = [
machenbach's avatar
machenbach committed
317 318 319 320 321 322 323 324 325 326 327
    "../..:external_config",
    "../..:internal_config_base",
  ]

  # TODO(machenbach): Translate from gyp.
  #["OS=="aix"", {
  #  "ldflags": [ "-Wl,-bbigtoc" ],
  #}],

  deps = [
    ":resources",
328
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
329
    "../..:v8_libplatform",
330
    "../..:wasm_module_runner",
331
    "../..:wasm_test_signatures",
machenbach's avatar
machenbach committed
332 333 334 335
    "//build/config/sanitizers:deps",
    "//build/win:default_exe_manifest",
  ]

336 337
  defines = []

machenbach's avatar
machenbach committed
338 339 340 341
  if (is_component_build) {
    # cctest can't be built against a shared library, so we
    # need to depend on the underlying static target in that case.
    deps += [ "../..:v8_maybe_snapshot" ]
342
    defines += [ "BUILDING_V8_SHARED" ]
machenbach's avatar
machenbach committed
343 344 345
  } else {
    deps += [ "../..:v8" ]
  }
346

347 348 349 350 351 352 353 354 355 356 357
  cflags = []
  ldflags = []

  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
      v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
    cflags += [ "-ffp-contract=off" ]
  }

358 359 360 361
  if (is_win) {
    # This warning is benignly triggered by the U16 and U32 macros in
    # bytecode-utils.h.
    # C4309: 'static_cast': truncation of constant value
362 363 364 365
    cflags += [ "/wd4309" ]

    # MSVS wants this for gay-{precision,shortest}.cc.
    cflags += [ "/bigobj" ]
366
  }
machenbach's avatar
machenbach committed
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
}

action("resources") {
  visibility = [ ":*" ]  # Only targets in this file can depend on this.

  script = "../../tools/js2c.py"

  # The script depends on this other script, this rule causes a rebuild if it
  # changes.
  inputs = [
    "../../tools/jsmin.py",
  ]

  # NOSORT
  sources = [
    "../../tools/splaytree.js",
    "../../tools/codemap.js",
    "../../tools/csvparser.js",
    "../../tools/consarray.js",
    "../../tools/profile.js",
    "../../tools/profile_view.js",
    "../../tools/logreader.js",
    "log-eq-of-logging-and-traversal.js",
  ]

  outputs = [
    "$target_gen_dir/resources.cc",
  ]

  args = [
    rebase_path("$target_gen_dir/resources.cc", root_build_dir),
    "TEST",
  ]
  args += rebase_path(sources, root_build_dir)
}
402 403 404 405 406 407 408 409 410 411 412 413 414 415

v8_executable("generate-bytecode-expectations") {
  sources = [
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/generate-bytecode-expectations.cc",
  ]

  configs = [
    "../..:external_config",
    "../..:internal_config_base",
  ]

  deps = [
416 417
    "../..:v8",
    "../..:v8_libbase",
418 419 420 421 422
    "../..:v8_libplatform",
    "//build/config/sanitizers:deps",
    "//build/win:default_exe_manifest",
  ]
}