BUILD.gn 14 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
  deps = [
    ":cctest_sources",
  ]
12 13 14 15 16 17 18 19 20 21 22

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

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

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
  configs = [
    "../..:external_config",
    "../..:internal_config_base",
  ]

  ldflags = []

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

  # crbug.com/676417: Suppress symbol import warning from linker.
  if (is_win && is_component_build) {
    ldflags += [
      "/ignore:4217",
      "/ignore:4049",
    ]
    remove_configs = [ "//build/config/win:default_incremental_linking" ]
    configs += [ "//build/config/win:no_incremental_linking" ]
  }
}

v8_source_set("cctest_sources") {
  testonly = true
machenbach's avatar
machenbach committed
48

jochen's avatar
jochen committed
49 50
  sources = [
    "$target_gen_dir/resources.cc",
51 52

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

272 273 274 275 276
  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",
277
      "interpreter/test-bytecode-generator.cc",
278 279 280 281
      "test-api.cc",
    ]
  }

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

380
  configs = [
machenbach's avatar
machenbach committed
381 382 383 384
    "../..:external_config",
    "../..:internal_config_base",
  ]

385
  public_deps = [
machenbach's avatar
machenbach committed
386
    ":resources",
387
    "../..:v8_initializers",
388
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
389
    "../..:v8_libplatform",
390
    "../..:wasm_module_runner",
machenbach's avatar
machenbach committed
391 392 393
    "//build/win:default_exe_manifest",
  ]

394
  defines = []
395 396 397
  deps = [
    "../..:run_torque",
  ]
398

machenbach's avatar
machenbach committed
399 400 401 402
  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" ]
403
    defines += [ "BUILDING_V8_SHARED" ]
machenbach's avatar
machenbach committed
404 405 406
  } else {
    deps += [ "../..:v8" ]
  }
407

408 409
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
410
    public_deps += [ "//third_party/icu" ]
411 412 413 414
  } else {
    sources -= [ "test-intl.cc" ]
  }

415 416 417
  cflags = []
  if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64" ||
      v8_current_cpu == "arm" || v8_current_cpu == "arm64" ||
418 419 420
      v8_current_cpu == "s390" || v8_current_cpu == "s390x" ||
      v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
      v8_current_cpu == "mipsel" || v8_current_cpu == "mipsel64") {
421 422
    # Disable fmadd/fmsub so that expected results match generated code in
    # RunFloat64MulAndFloat64Add1 and friends.
423 424 425
    if (!is_win) {
      cflags += [ "-ffp-contract=off" ]
    }
426 427
  }

428 429 430 431
  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
432 433 434 435
    cflags += [ "/wd4309" ]

    # MSVS wants this for gay-{precision,shortest}.cc.
    cflags += [ "/bigobj" ]
436
  }
machenbach's avatar
machenbach committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
}

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",
458
    "../../tools/arguments.js",
machenbach's avatar
machenbach committed
459 460 461 462 463 464 465 466 467 468 469 470 471 472
    "../../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)
}
473 474 475 476 477 478 479 480 481 482 483 484 485 486

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 = [
487 488
    "../..:v8",
    "../..:v8_libbase",
489 490 491 492
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
}
493 494 495 496 497 498 499 500 501

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

  deps = [
    ":resources",
  ]
}