BUILD.gn 13.8 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 183 184
    "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",
    "test-fast-dtoa.cc",
    "test-feedback-vector.cc",
185
    "test-feedback-vector.h",
jochen's avatar
jochen committed
186 187 188 189 190 191
    "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",
192
    "test-hashcode.cc",
jochen's avatar
jochen committed
193 194 195 196
    "test-hashmap.cc",
    "test-heap-profiler.cc",
    "test-identity-map.cc",
    "test-inobject-slack-tracking.cc",
197
    "test-inspector.cc",
198
    "test-intl.cc",
199
    "test-isolate-independent-builtins.cc",
200
    "test-js-weak-refs.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
    "test-sampler-api.cc",
    "test-serialize.cc",
218
    "test-smi-lexicographic-compare.cc",
jochen's avatar
jochen committed
219 220 221 222 223 224
    "test-strings.cc",
    "test-strtod.cc",
    "test-symbols.cc",
    "test-thread-termination.cc",
    "test-threads.cc",
    "test-trace-event.cc",
225
    "test-traced-value.cc",
jochen's avatar
jochen committed
226
    "test-transitions.cc",
227
    "test-transitions.h",
jochen's avatar
jochen committed
228 229 230 231 232 233 234 235 236 237
    "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",
238
    "torque/test-torque.cc",
jochen's avatar
jochen committed
239
    "trace-extension.cc",
240 241
    "trace-extension.h",
    "types-fuzz.h",
242
    "unicode-helpers.cc",
243
    "unicode-helpers.h",
244
    "wasm/test-c-wasm-entry.cc",
245
    "wasm/test-jump-table-assembler.cc",
jochen's avatar
jochen committed
246 247
    "wasm/test-run-wasm-64.cc",
    "wasm/test-run-wasm-asmjs.cc",
248
    "wasm/test-run-wasm-atomics.cc",
249
    "wasm/test-run-wasm-atomics64.cc",
jochen's avatar
jochen committed
250 251 252
    "wasm/test-run-wasm-interpreter.cc",
    "wasm/test-run-wasm-js.cc",
    "wasm/test-run-wasm-module.cc",
253
    "wasm/test-run-wasm-sign-extension.cc",
254
    "wasm/test-run-wasm-simd.cc",
jochen's avatar
jochen committed
255
    "wasm/test-run-wasm.cc",
256
    "wasm/test-streaming-compilation.cc",
257
    "wasm/test-wasm-breakpoints.cc",
258
    "wasm/test-wasm-codegen.cc",
259
    "wasm/test-wasm-import-wrapper-cache.cc",
260
    "wasm/test-wasm-interpreter-entry.cc",
261
    "wasm/test-wasm-serialization.cc",
262
    "wasm/test-wasm-shared-engine.cc",
jochen's avatar
jochen committed
263 264
    "wasm/test-wasm-stack.cc",
    "wasm/test-wasm-trap-position.cc",
265
    "wasm/wasm-atomics-utils.h",
266
    "wasm/wasm-run-utils.cc",
jochen's avatar
jochen committed
267 268
    "wasm/wasm-run-utils.h",
  ]
machenbach's avatar
machenbach committed
269

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

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

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

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

392
  defines = []
393 394 395
  deps = [
    "../..:run_torque",
  ]
396

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

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

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

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

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

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

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 = [
485 486
    "../..:v8",
    "../..:v8_libbase",
487 488 489 490
    "../..:v8_libplatform",
    "//build/win:default_exe_manifest",
  ]
}