BUILD.gn 13.7 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
    "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",
167
    "test-builtins.cc",
jochen's avatar
jochen committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
    "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",
    "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 196 197
    "test-hashmap.cc",
    "test-heap-profiler.cc",
    "test-identity-map.cc",
    "test-inobject-slack-tracking.cc",
198
    "test-inspector.cc",
199
    "test-intl.cc",
200
    "test-isolate-independent-builtins.cc",
jochen's avatar
jochen committed
201 202 203
    "test-liveedit.cc",
    "test-lockers.cc",
    "test-log.cc",
204
    "test-managed.cc",
jochen's avatar
jochen committed
205
    "test-mementos.cc",
206
    "test-modules.cc",
jochen's avatar
jochen committed
207
    "test-object.cc",
208
    "test-orderedhashtable.cc",
jochen's avatar
jochen committed
209 210 211 212 213 214
    "test-parsing.cc",
    "test-platform.cc",
    "test-profile-generator.cc",
    "test-random-number-generator.cc",
    "test-regexp.cc",
    "test-representation.cc",
215
    "test-roots.cc",
jochen's avatar
jochen committed
216 217 218 219 220 221 222 223
    "test-sampler-api.cc",
    "test-serialize.cc",
    "test-strings.cc",
    "test-strtod.cc",
    "test-symbols.cc",
    "test-thread-termination.cc",
    "test-threads.cc",
    "test-trace-event.cc",
224
    "test-traced-value.cc",
jochen's avatar
jochen committed
225
    "test-transitions.cc",
226
    "test-transitions.h",
jochen's avatar
jochen committed
227 228 229 230 231 232 233 234 235 236
    "test-typedarrays.cc",
    "test-types.cc",
    "test-unbound-queue.cc",
    "test-unboxed-doubles.cc",
    "test-unscopables-hidden-prototype.cc",
    "test-usecounters.cc",
    "test-utils.cc",
    "test-version.cc",
    "test-weakmaps.cc",
    "test-weaksets.cc",
237
    "torque/test-torque.cc",
jochen's avatar
jochen committed
238
    "trace-extension.cc",
239 240
    "trace-extension.h",
    "types-fuzz.h",
241
    "unicode-helpers.h",
242
    "wasm/test-c-wasm-entry.cc",
243
    "wasm/test-jump-table-assembler.cc",
jochen's avatar
jochen committed
244 245
    "wasm/test-run-wasm-64.cc",
    "wasm/test-run-wasm-asmjs.cc",
246
    "wasm/test-run-wasm-atomics.cc",
247
    "wasm/test-run-wasm-atomics64.cc",
jochen's avatar
jochen committed
248 249 250
    "wasm/test-run-wasm-interpreter.cc",
    "wasm/test-run-wasm-js.cc",
    "wasm/test-run-wasm-module.cc",
251
    "wasm/test-run-wasm-sign-extension.cc",
252
    "wasm/test-run-wasm-simd.cc",
jochen's avatar
jochen committed
253
    "wasm/test-run-wasm.cc",
254
    "wasm/test-streaming-compilation.cc",
255
    "wasm/test-wasm-breakpoints.cc",
256
    "wasm/test-wasm-codegen.cc",
257
    "wasm/test-wasm-interpreter-entry.cc",
258
    "wasm/test-wasm-serialization.cc",
259
    "wasm/test-wasm-shared-engine.cc",
jochen's avatar
jochen committed
260 261
    "wasm/test-wasm-stack.cc",
    "wasm/test-wasm-trap-position.cc",
262
    "wasm/wasm-atomics-utils.h",
263
    "wasm/wasm-run-utils.cc",
jochen's avatar
jochen committed
264 265
    "wasm/wasm-run-utils.h",
  ]
machenbach's avatar
machenbach committed
266

267 268 269 270 271 272
  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",
      "interpreter/bytecode-expectations-printer.h",
273
      "interpreter/test-bytecode-generator.cc",
274 275 276 277 278
      "test-api.cc",
      "test-api.h",
    ]
  }

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

376
  configs = [
machenbach's avatar
machenbach committed
377 378 379 380
    "../..:external_config",
    "../..:internal_config_base",
  ]

381
  public_deps = [
machenbach's avatar
machenbach committed
382
    ":resources",
383
    "../..:v8_initializers",
384
    "../..:v8_libbase",
machenbach's avatar
machenbach committed
385
    "../..:v8_libplatform",
386
    "../..:wasm_module_runner",
machenbach's avatar
machenbach committed
387 388 389
    "//build/win:default_exe_manifest",
  ]

390
  defines = []
391 392 393
  deps = [
    "../..:run_torque",
  ]
394

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

404 405
  if (v8_enable_i18n_support) {
    defines += [ "V8_INTL_SUPPORT" ]
406
    public_deps += [ "//third_party/icu" ]
407 408 409 410
  } else {
    sources -= [ "test-intl.cc" ]
  }

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

422 423 424 425
  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
426 427 428 429
    cflags += [ "/wd4309" ]

    # MSVS wants this for gay-{precision,shortest}.cc.
    cflags += [ "/bigobj" ]
430
  }
machenbach's avatar
machenbach committed
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
}

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",
452
    "../../tools/arguments.js",
machenbach's avatar
machenbach committed
453 454 455 456 457 458 459 460 461 462 463 464 465 466
    "../../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)
}
467 468 469 470 471 472 473 474 475 476 477 478 479 480

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 = [
481 482
    "../..:v8",
    "../..:v8_libbase",
483 484 485 486
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
}