BUILD.gn 13.1 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
  testonly = true
9 10 11 12 13

  sources = [
    "cctest.cc",
  ]

14 15 16
  deps = [
    ":cctest_sources",
  ]
17 18 19 20 21 22 23 24 25 26 27

  data_deps = [
    "../../tools:v8_testrunner",
  ]

  data = [
    "testcfg.py",
    "cctest.status",
    "interpreter/bytecode_expectations/",
  ]

28 29 30 31 32 33 34 35 36 37 38 39 40
  configs = [
    "../..:external_config",
    "../..:internal_config_base",
  ]

  ldflags = []

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

41 42 43 44 45 46 47 48 49 50 51 52 53
v8_header_set("cctest_headers") {
  testonly = true

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

  sources = [
    "cctest.h",
  ]
}

54 55
v8_source_set("cctest_sources") {
  testonly = true
machenbach's avatar
machenbach committed
56

jochen's avatar
jochen committed
57 58
  sources = [
    "$target_gen_dir/resources.cc",
59 60

    ### gcmole(all) ###
61 62 63 64
    "../common/assembler-tester.h",
    "../common/wasm/flag-utils.h",
    "../common/wasm/test-signatures.h",
    "../common/wasm/wasm-macro-gen.h",
65
    "collector.h",
jochen's avatar
jochen committed
66
    "compiler/c-signature.h",
67
    "compiler/call-tester.h",
jochen's avatar
jochen committed
68 69 70 71 72 73
    "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",
74 75
    "compiler/serializer-tester.cc",
    "compiler/serializer-tester.h",
jochen's avatar
jochen committed
76 77 78
    "compiler/test-basic-block-profiler.cc",
    "compiler/test-branch-combine.cc",
    "compiler/test-code-assembler.cc",
79
    "compiler/test-code-generator.cc",
jochen's avatar
jochen committed
80 81
    "compiler/test-gap-resolver.cc",
    "compiler/test-graph-visualizer.cc",
82
    "compiler/test-instruction-scheduler.cc",
jochen's avatar
jochen committed
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
    "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-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-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",
107
    "compiler/test-run-retpoline.cc",
jochen's avatar
jochen committed
108
    "compiler/test-run-stackcheck.cc",
109
    "compiler/test-run-tail-calls.cc",
jochen's avatar
jochen committed
110 111
    "compiler/test-run-unwinding-info.cc",
    "compiler/test-run-variables.cc",
112
    "compiler/value-helper.cc",
113 114
    "compiler/value-helper.h",
    "expression-type-collector-macros.h",
jochen's avatar
jochen committed
115
    "gay-fixed.cc",
116
    "gay-fixed.h",
jochen's avatar
jochen committed
117
    "gay-precision.cc",
118
    "gay-precision.h",
jochen's avatar
jochen committed
119
    "gay-shortest.cc",
120
    "gay-shortest.h",
jochen's avatar
jochen committed
121 122 123 124 125 126
    "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",
127
    "heap/test-concurrent-marking.cc",
128
    "heap/test-embedder-tracing.cc",
129
    "heap/test-external-string-tracker.cc",
jochen's avatar
jochen committed
130 131
    "heap/test-heap.cc",
    "heap/test-incremental-marking.cc",
132
    "heap/test-invalidated-slots.cc",
133
    "heap/test-iterators.cc",
jochen's avatar
jochen committed
134 135 136 137
    "heap/test-lab.cc",
    "heap/test-mark-compact.cc",
    "heap/test-page-promotion.cc",
    "heap/test-spaces.cc",
138
    "heap/test-unmapper.cc",
139
    "heap/test-weak-references.cc",
jochen's avatar
jochen committed
140 141 142
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/interpreter-tester.cc",
143
    "interpreter/interpreter-tester.h",
jochen's avatar
jochen committed
144 145 146 147 148 149 150 151
    "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",
152
    "parsing/test-parse-decision.cc",
153
    "parsing/test-preparser.cc",
154
    "parsing/test-scanner-streams.cc",
155
    "parsing/test-scanner.cc",
jochen's avatar
jochen committed
156
    "print-extension.cc",
157
    "print-extension.h",
jochen's avatar
jochen committed
158
    "profiler-extension.cc",
159
    "profiler-extension.h",
160
    "scope-test-helper.h",
161 162
    "setup-isolate-for-tests.cc",
    "setup-isolate-for-tests.h",
jochen's avatar
jochen committed
163
    "test-access-checks.cc",
164
    "test-accessor-assembler.cc",
jochen's avatar
jochen committed
165
    "test-accessors.cc",
166
    "test-allocation.cc",
jochen's avatar
jochen committed
167 168
    "test-api-accessors.cc",
    "test-api-interceptors.cc",
169
    "test-api-stack-traces.cc",
jochen's avatar
jochen committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
    "test-api.cc",
    "test-api.h",
    "test-array-list.cc",
    "test-atomicops.cc",
    "test-bignum-dtoa.cc",
    "test-bignum.cc",
    "test-bit-vector.cc",
    "test-circular-queue.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",
193
    "test-factory.cc",
jochen's avatar
jochen committed
194 195
    "test-fast-dtoa.cc",
    "test-feedback-vector.cc",
196
    "test-feedback-vector.h",
jochen's avatar
jochen committed
197 198 199 200 201 202
    "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",
203
    "test-hashcode.cc",
jochen's avatar
jochen committed
204 205
    "test-hashmap.cc",
    "test-heap-profiler.cc",
206
    "test-icache.cc",
jochen's avatar
jochen committed
207 208
    "test-identity-map.cc",
    "test-inobject-slack-tracking.cc",
209
    "test-inspector.cc",
210
    "test-intl.cc",
211
    "test-js-weak-refs.cc",
jochen's avatar
jochen committed
212 213 214
    "test-liveedit.cc",
    "test-lockers.cc",
    "test-log.cc",
215
    "test-managed.cc",
jochen's avatar
jochen committed
216
    "test-mementos.cc",
217
    "test-modules.cc",
jochen's avatar
jochen committed
218
    "test-object.cc",
219
    "test-orderedhashtable.cc",
jochen's avatar
jochen committed
220 221 222 223 224 225
    "test-parsing.cc",
    "test-platform.cc",
    "test-profile-generator.cc",
    "test-random-number-generator.cc",
    "test-regexp.cc",
    "test-representation.cc",
226
    "test-roots.cc",
jochen's avatar
jochen committed
227 228
    "test-sampler-api.cc",
    "test-serialize.cc",
229
    "test-smi-lexicographic-compare.cc",
jochen's avatar
jochen committed
230 231 232 233 234 235
    "test-strings.cc",
    "test-strtod.cc",
    "test-symbols.cc",
    "test-thread-termination.cc",
    "test-threads.cc",
    "test-trace-event.cc",
236
    "test-traced-value.cc",
jochen's avatar
jochen committed
237
    "test-transitions.cc",
238
    "test-transitions.h",
jochen's avatar
jochen committed
239 240 241 242
    "test-typedarrays.cc",
    "test-types.cc",
    "test-unboxed-doubles.cc",
    "test-unscopables-hidden-prototype.cc",
243
    "test-unwinder.cc",
jochen's avatar
jochen committed
244 245 246 247 248
    "test-usecounters.cc",
    "test-utils.cc",
    "test-version.cc",
    "test-weakmaps.cc",
    "test-weaksets.cc",
249
    "torque/test-torque.cc",
jochen's avatar
jochen committed
250
    "trace-extension.cc",
251
    "trace-extension.h",
252
    "unicode-helpers.cc",
253
    "unicode-helpers.h",
254
    "wasm/test-c-wasm-entry.cc",
255
    "wasm/test-jump-table-assembler.cc",
jochen's avatar
jochen committed
256 257
    "wasm/test-run-wasm-64.cc",
    "wasm/test-run-wasm-asmjs.cc",
258
    "wasm/test-run-wasm-atomics.cc",
259
    "wasm/test-run-wasm-atomics64.cc",
260
    "wasm/test-run-wasm-bulk-memory.cc",
261
    "wasm/test-run-wasm-exceptions.cc",
jochen's avatar
jochen committed
262 263 264
    "wasm/test-run-wasm-interpreter.cc",
    "wasm/test-run-wasm-js.cc",
    "wasm/test-run-wasm-module.cc",
265
    "wasm/test-run-wasm-sign-extension.cc",
266
    "wasm/test-run-wasm-simd.cc",
jochen's avatar
jochen committed
267
    "wasm/test-run-wasm.cc",
268
    "wasm/test-streaming-compilation.cc",
269
    "wasm/test-wasm-breakpoints.cc",
270
    "wasm/test-wasm-codegen.cc",
271
    "wasm/test-wasm-import-wrapper-cache.cc",
272
    "wasm/test-wasm-interpreter-entry.cc",
273
    "wasm/test-wasm-serialization.cc",
274
    "wasm/test-wasm-shared-engine.cc",
jochen's avatar
jochen committed
275 276
    "wasm/test-wasm-stack.cc",
    "wasm/test-wasm-trap-position.cc",
277
    "wasm/wasm-atomics-utils.h",
278
    "wasm/wasm-run-utils.cc",
jochen's avatar
jochen committed
279 280
    "wasm/wasm-run-utils.h",
  ]
machenbach's avatar
machenbach committed
281

282 283 284 285 286
  if (use_jumbo_build) {
    jumbo_excluded_sources = [
      # TODO(mostynb@opera.com): figure out the jumbo issues with these source
      # files, and include them in jumbo compilation units.
      "interpreter/bytecode-expectations-printer.cc",
287
      "interpreter/test-bytecode-generator.cc",
288 289 290 291
      "test-api.cc",
    ]
  }

292
  if (v8_current_cpu == "arm") {
293
    sources += [  ### gcmole(arch:arm) ###
294 295
      "assembler-helper-arm.cc",
      "assembler-helper-arm.h",
jochen's avatar
jochen committed
296 297 298
      "test-assembler-arm.cc",
      "test-disasm-arm.cc",
      "test-macro-assembler-arm.cc",
299
      "test-poison-disasm-arm.cc",
300
      "test-sync-primitives-arm.cc",
jochen's avatar
jochen committed
301
    ]
302
  } else if (v8_current_cpu == "arm64") {
303
    sources += [  ### gcmole(arch:arm64) ###
jochen's avatar
jochen committed
304 305 306 307 308
      "test-assembler-arm64.cc",
      "test-disasm-arm64.cc",
      "test-fuzz-arm64.cc",
      "test-javascript-arm64.cc",
      "test-js-arm64-variables.cc",
309
      "test-sync-primitives-arm64.cc",
jochen's avatar
jochen committed
310
      "test-utils-arm64.cc",
311
      "test-utils-arm64.h",
jochen's avatar
jochen committed
312
    ]
313
  } else if (v8_current_cpu == "x86") {
314
    sources += [  ### gcmole(arch:ia32) ###
jochen's avatar
jochen committed
315 316 317 318
      "test-assembler-ia32.cc",
      "test-disasm-ia32.cc",
      "test-log-stack-tracer.cc",
    ]
319
  } else if (v8_current_cpu == "mips") {
320
    sources += [  ### gcmole(arch:mips) ###
jochen's avatar
jochen committed
321 322 323 324
      "test-assembler-mips.cc",
      "test-disasm-mips.cc",
      "test-macro-assembler-mips.cc",
    ]
325
  } else if (v8_current_cpu == "mipsel") {
326
    sources += [  ### gcmole(arch:mipsel) ###
jochen's avatar
jochen committed
327 328 329 330
      "test-assembler-mips.cc",
      "test-disasm-mips.cc",
      "test-macro-assembler-mips.cc",
    ]
331
  } else if (v8_current_cpu == "mips64") {
332
    sources += [  ### gcmole(arch:mips64) ###
jochen's avatar
jochen committed
333 334 335 336
      "test-assembler-mips64.cc",
      "test-disasm-mips64.cc",
      "test-macro-assembler-mips64.cc",
    ]
337
  } else if (v8_current_cpu == "mips64el") {
338
    sources += [  ### gcmole(arch:mips64el) ###
jochen's avatar
jochen committed
339 340 341 342
      "test-assembler-mips64.cc",
      "test-disasm-mips64.cc",
      "test-macro-assembler-mips64.cc",
    ]
343
  } else if (v8_current_cpu == "x64") {
344
    sources += [  ### gcmole(arch:x64) ###
jochen's avatar
jochen committed
345 346 347 348 349
      "test-assembler-x64.cc",
      "test-disasm-x64.cc",
      "test-log-stack-tracer.cc",
      "test-macro-assembler-x64.cc",
    ]
350 351 352
    if (is_win) {
      sources += [ "test-stack-unwinding-x64.cc" ]
    }
353
  } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
354
    sources += [  ### gcmole(arch:ppc) ###
jochen's avatar
jochen committed
355 356 357
      "test-assembler-ppc.cc",
      "test-disasm-ppc.cc",
    ]
358
  } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
359
    sources += [  ### gcmole(arch:s390) ###
jochen's avatar
jochen committed
360 361 362
      "test-assembler-s390.cc",
      "test-disasm-s390.cc",
    ]
machenbach's avatar
machenbach committed
363 364
  }

365
  configs = [
machenbach's avatar
machenbach committed
366 367 368 369
    "../..:external_config",
    "../..:internal_config_base",
  ]

370
  public_deps = [
371
    ":cctest_headers",
machenbach's avatar
machenbach committed
372
    ":resources",
373
    "..:common_test_headers",
374
    "../..:v8_for_testing",
375
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
376
    "../..:v8_libplatform",
377
    "../..:wasm_module_runner",
machenbach's avatar
machenbach committed
378 379 380
    "//build/win:default_exe_manifest",
  ]

381
  defines = []
382 383 384
  deps = [
    "../..:run_torque",
  ]
385

386 387
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
388
    public_deps += [ "//third_party/icu" ]
389 390 391 392
  } else {
    sources -= [ "test-intl.cc" ]
  }

393 394 395
  cflags = []
  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
396 397 398
      v8_current_cpu == "s390" || v8_current_cpu == "s390x" ||
      v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
      v8_current_cpu == "mipsel" || v8_current_cpu == "mipsel64") {
399 400
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
401 402 403
    if (!is_win) {
      cflags += [ "-ffp-contract=off" ]
    }
404 405
  }

406 407 408 409
  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
410 411 412 413
    cflags += [ "/wd4309" ]

    # MSVS wants this for gay-{precision,shortest}.cc.
    cflags += [ "/bigobj" ]
414
  }
415 416 417 418

  if (v8_use_perfetto) {
    deps += [ "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite" ]
  }
machenbach's avatar
machenbach committed
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
}

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

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

  # NOSORT
  sources = [
    "../../tools/splaytree.js",
    "../../tools/codemap.js",
    "../../tools/csvparser.js",
    "../../tools/consarray.js",
    "../../tools/profile.js",
    "../../tools/profile_view.js",
434
    "../../tools/arguments.js",
machenbach's avatar
machenbach committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448
    "../../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)
}
449 450

v8_executable("generate-bytecode-expectations") {
451 452
  testonly = true

453 454 455 456 457 458 459 460 461 462 463 464
  sources = [
    "interpreter/bytecode-expectations-printer.cc",
    "interpreter/bytecode-expectations-printer.h",
    "interpreter/generate-bytecode-expectations.cc",
  ]

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

  deps = [
465
    ":cctest_headers",
466 467
    "../..:v8",
    "../..:v8_libbase",
468 469 470 471
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
}
472 473 474 475 476 477 478 479 480

#Target to generate all .cc files.
group("v8_generated_cc_files") {
  testonly = true

  deps = [
    ":resources",
  ]
}