Move IC code into a subdir and move ic-compilation related code from stub-cache into...
[platform/upstream/v8.git] / BUILD.gn
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # TODO(jochen): These will need to be user-settable to support standalone V8
6 # builds.
7 v8_compress_startup_data = "off"
8 v8_deprecation_warnings = false
9 v8_enable_disassembler = false
10 v8_enable_gdbjit = false
11 v8_enable_handle_zapping = true
12 v8_enable_i18n_support = true
13 v8_enable_verify_heap = false
14 v8_interpreted_regexp = false
15 v8_object_print = false
16 v8_postmortem_support = false
17 v8_use_snapshot = true
18 v8_use_external_startup_data = false
19 v8_enable_extra_checks = is_debug
20 v8_target_arch = cpu_arch
21 v8_random_seed = "314159265"
22
23
24 ###############################################################################
25 # Configurations
26 #
27 config("internal_config") {
28   visibility = ":*"  # Only targets in this file can depend on this.
29
30   include_dirs = [ "." ]
31
32   if (component_mode == "shared_library") {
33     defines = [
34       "V8_SHARED",
35       "BUILDING_V8_SHARED",
36     ]
37   }
38 }
39
40 config("internal_config_base") {
41   visibility = ":*"  # Only targets in this file can depend on this.
42
43   include_dirs = [ "." ]
44 }
45
46 # This config should only be applied to code using V8 and not any V8 code
47 # itself.
48 config("external_config") {
49   if (is_component_build) {
50     defines = [
51       "V8_SHARED",
52       "USING_V8_SHARED",
53     ]
54   }
55   include_dirs = [ "include" ]
56 }
57
58 config("features") {
59   visibility = ":*"  # Only targets in this file can depend on this.
60
61   defines = []
62
63   if (v8_enable_disassembler == true) {
64     defines += [
65       "ENABLE_DISASSEMBLER",
66     ]
67   }
68   if (v8_enable_gdbjit == true) {
69     defines += [
70       "ENABLE_GDB_JIT_INTERFACE",
71     ]
72   }
73   if (v8_object_print == true) {
74     defines += [
75       "OBJECT_PRINT",
76     ]
77   }
78   if (v8_enable_verify_heap == true) {
79     defines += [
80       "VERIFY_HEAP",
81     ]
82   }
83   if (v8_interpreted_regexp == true) {
84     defines += [
85       "V8_INTERPRETED_REGEXP",
86     ]
87   }
88   if (v8_deprecation_warnings == true) {
89     defines += [
90       "V8_DEPRECATION_WARNINGS",
91     ]
92   }
93   if (v8_enable_i18n_support == true) {
94     defines += [
95       "V8_I18N_SUPPORT",
96     ]
97   }
98   if (v8_compress_startup_data == "bz2") {
99     defines += [
100       "COMPRESS_STARTUP_DATA_BZ2",
101     ]
102   }
103   if (v8_enable_extra_checks == true) {
104     defines += [
105       "ENABLE_EXTRA_CHECKS",
106     ]
107   }
108   if (v8_enable_handle_zapping == true) {
109     defines += [
110       "ENABLE_HANDLE_ZAPPING",
111     ]
112   }
113   if (v8_use_external_startup_data == true) {
114     defines += [
115       "V8_USE_EXTERNAL_STARTUP_DATA",
116     ]
117   }
118 }
119
120 config("toolchain") {
121   visibility = ":*"  # Only targets in this file can depend on this.
122
123   defines = []
124   cflags = []
125
126   # TODO(jochen): Add support for arm, mips, mipsel.
127
128   if (v8_target_arch == "arm64") {
129     defines += [
130       "V8_TARGET_ARCH_ARM64",
131     ]
132   }
133   if (v8_target_arch == "x86") {
134     defines += [
135       "V8_TARGET_ARCH_IA32",
136     ]
137   }
138   if (v8_target_arch == "x64") {
139     defines += [
140       "V8_TARGET_ARCH_X64",
141     ]
142   }
143   if (is_win) {
144     defines += [
145       "WIN32",
146     ]
147     # TODO(jochen): Support v8_enable_prof.
148   }
149
150   # TODO(jochen): Add support for compiling with simulators.
151
152   if (is_debug) {
153     # TODO(jochen): Add support for different debug optimization levels.
154     defines += [
155       "ENABLE_DISASSEMBLER",
156       "V8_ENABLE_CHECKS",
157       "OBJECT_PRINT",
158       "VERIFY_HEAP",
159       "DEBUG",
160       "OPTIMIZED_DEBUG",
161     ]
162   }
163 }
164
165 ###############################################################################
166 # Actions
167 #
168
169 action("js2c") {
170   visibility = ":*"  # Only targets in this file can depend on this.
171
172   script = "tools/js2c.py"
173
174   # The script depends on this other script, this rule causes a rebuild if it
175   # changes.
176   source_prereqs = [ "tools/jsmin.py" ]
177
178   sources = [
179     "src/runtime.js",
180     "src/v8natives.js",
181     "src/symbol.js",
182     "src/array.js",
183     "src/string.js",
184     "src/uri.js",
185     "third_party/fdlibm/fdlibm.js",
186     "src/math.js",
187     "src/apinatives.js",
188     "src/date.js",
189     "src/regexp.js",
190     "src/arraybuffer.js",
191     "src/typedarray.js",
192     "src/object-observe.js",
193     "src/collection.js",
194     "src/weak-collection.js",
195     "src/collection-iterator.js",
196     "src/promise.js",
197     "src/messages.js",
198     "src/json.js",
199     "src/array-iterator.js",
200     "src/string-iterator.js",
201     "src/debug-debugger.js",
202     "src/mirror-debugger.js",
203     "src/liveedit-debugger.js",
204     "src/macros.py",
205   ]
206
207   outputs = [
208     "$target_gen_dir/libraries.cc"
209   ]
210
211   if (v8_enable_i18n_support) {
212     sources += [ "src/i18n.js" ]
213   }
214
215   args = [
216     rebase_path("$target_gen_dir/libraries.cc", root_build_dir),
217     "CORE",
218     v8_compress_startup_data
219   ] + rebase_path(sources, root_build_dir)
220
221   if (v8_use_external_startup_data) {
222     outputs += [ "$target_gen_dir/libraries.bin" ]
223     args += [
224       "--startup_blob",
225       rebase_path("$target_gen_dir/libraries.bin", root_build_dir)
226     ]
227   }
228 }
229
230 action("js2c_experimental") {
231   visibility = ":*"  # Only targets in this file can depend on this.
232
233   script = "tools/js2c.py"
234
235   # The script depends on this other script, this rule causes a rebuild if it
236   # changes.
237   source_prereqs = [ "tools/jsmin.py" ]
238
239   sources = [
240     "src/macros.py",
241     "src/proxy.js",
242     "src/generator.js",
243     "src/harmony-string.js",
244     "src/harmony-array.js",
245     "src/harmony-classes.js",
246   ]
247
248   outputs = [
249     "$target_gen_dir/experimental-libraries.cc"
250   ]
251
252   args = [
253     rebase_path("$target_gen_dir/experimental-libraries.cc", root_build_dir),
254     "EXPERIMENTAL",
255     v8_compress_startup_data
256   ] + rebase_path(sources, root_build_dir)
257
258   if (v8_use_external_startup_data) {
259     outputs += [ "$target_gen_dir/libraries_experimental.bin" ]
260     args += [
261       "--startup_blob",
262       rebase_path("$target_gen_dir/libraries_experimental.bin", root_build_dir)
263     ]
264   }
265 }
266
267 if (v8_use_external_startup_data) {
268   action("natives_blob") {
269     visibility = ":*"  # Only targets in this file can depend on this.
270
271     deps = [
272       ":js2c",
273       ":js2c_experimental"
274     ]
275
276     sources = [
277       "$target_gen_dir/libraries.bin",
278       "$target_gen_dir/libraries_experimental.bin"
279     ]
280
281     outputs = [
282       "$root_gen_dir/natives_blob.bin"
283     ]
284
285     script = "tools/concatenate-files.py"
286
287     args = rebase_path(sources + outputs, root_build_dir)
288   }
289 }
290
291 action("postmortem-metadata") {
292   visibility = ":*"  # Only targets in this file can depend on this.
293
294   script = "tools/gen-postmortem-metadata.py"
295
296   sources = [
297     "src/objects.h",
298     "src/objects-inl.h",
299   ]
300
301   outputs = [
302     "$target_gen_dir/debug-support.cc"
303   ]
304
305   args =
306     rebase_path(outputs, root_build_dir) +
307     rebase_path(sources, root_build_dir)
308 }
309
310 action("run_mksnapshot") {
311   visibility = ":*"  # Only targets in this file can depend on this.
312
313   deps = [ ":mksnapshot($host_toolchain)" ]
314
315   script = "tools/run.py"
316
317   outputs = [
318     "$target_gen_dir/snapshot.cc"
319   ]
320
321   args = [
322     "./" + rebase_path(get_label_info(":mksnapshot($host_toolchain)",
323                                       "root_out_dir") + "/mksnapshot",
324                        root_build_dir),
325     "--log-snapshot-positions",
326     "--logfile", rebase_path("$target_gen_dir/snapshot.log", root_build_dir),
327     rebase_path("$target_gen_dir/snapshot.cc", root_build_dir)
328   ]
329
330   if (v8_random_seed != "0") {
331     args += [ "--random-seed", v8_random_seed ]
332   }
333
334   if (v8_use_external_startup_data) {
335     outputs += [ "$root_gen_dir/snapshot_blob.bin" ]
336     args += [
337       "--startup_blob",
338       rebase_path("$root_gen_dir/snapshot_blob.bin", root_build_dir)
339     ]
340   }
341 }
342
343
344 ###############################################################################
345 # Source Sets (aka static libraries)
346 #
347
348 source_set("v8_nosnapshot") {
349   visibility = ":*"  # Only targets in this file can depend on this.
350
351   deps = [
352     ":js2c",
353     ":js2c_experimental",
354     ":v8_base",
355   ]
356
357   sources = [
358     "$target_gen_dir/libraries.cc",
359     "$target_gen_dir/experimental-libraries.cc",
360     "src/snapshot-empty.cc",
361     "src/snapshot-common.cc",
362   ]
363
364   configs -= [ "//build/config/compiler:chromium_code" ]
365   configs += [ "//build/config/compiler:no_chromium_code" ]
366   configs += [ ":internal_config", ":features", ":toolchain" ]
367 }
368
369 source_set("v8_snapshot") {
370   visibility = ":*"  # Only targets in this file can depend on this.
371
372   deps = [
373     ":js2c",
374     ":js2c_experimental",
375     ":run_mksnapshot",
376     ":v8_base",
377   ]
378
379   sources = [
380     "$target_gen_dir/libraries.cc",
381     "$target_gen_dir/experimental-libraries.cc",
382     "$target_gen_dir/snapshot.cc",
383     "src/snapshot-common.cc",
384   ]
385
386   configs -= [ "//build/config/compiler:chromium_code" ]
387   configs += [ "//build/config/compiler:no_chromium_code" ]
388   configs += [ ":internal_config", ":features", ":toolchain" ]
389 }
390
391 if (v8_use_external_startup_data) {
392   source_set("v8_external_snapshot") {
393     visibility = ":*"  # Only targets in this file can depend on this.
394
395     deps = [
396       ":js2c",
397       ":js2c_experimental",
398       ":run_mksnapshot",
399       ":v8_base",
400       ":natives_blob",
401     ]
402
403     sources = [
404       "src/natives-external.cc",
405       "src/snapshot-external.cc",
406     ]
407
408     configs -= [ "//build/config/compiler:chromium_code" ]
409     configs += [ "//build/config/compiler:no_chromium_code" ]
410     configs += [ ":internal_config", ":features", ":toolchain" ]
411   }
412 }
413
414 source_set("v8_base") {
415   visibility = ":*"  # Only targets in this file can depend on this.
416
417   sources = [
418     "src/accessors.cc",
419     "src/accessors.h",
420     "src/allocation.cc",
421     "src/allocation.h",
422     "src/allocation-site-scopes.cc",
423     "src/allocation-site-scopes.h",
424     "src/allocation-tracker.cc",
425     "src/allocation-tracker.h",
426     "src/api.cc",
427     "src/api.h",
428     "src/arguments.cc",
429     "src/arguments.h",
430     "src/assembler.cc",
431     "src/assembler.h",
432     "src/assert-scope.h",
433     "src/assert-scope.cc",
434     "src/ast-value-factory.cc",
435     "src/ast-value-factory.h",
436     "src/ast.cc",
437     "src/ast.h",
438     "src/bignum-dtoa.cc",
439     "src/bignum-dtoa.h",
440     "src/bignum.cc",
441     "src/bignum.h",
442     "src/bootstrapper.cc",
443     "src/bootstrapper.h",
444     "src/builtins.cc",
445     "src/builtins.h",
446     "src/bytecodes-irregexp.h",
447     "src/cached-powers.cc",
448     "src/cached-powers.h",
449     "src/char-predicates-inl.h",
450     "src/char-predicates.h",
451     "src/checks.cc",
452     "src/checks.h",
453     "src/circular-queue-inl.h",
454     "src/circular-queue.h",
455     "src/code-stubs.cc",
456     "src/code-stubs.h",
457     "src/code-stubs-hydrogen.cc",
458     "src/code.h",
459     "src/codegen.cc",
460     "src/codegen.h",
461     "src/compilation-cache.cc",
462     "src/compilation-cache.h",
463     "src/compiler/ast-graph-builder.cc",
464     "src/compiler/ast-graph-builder.h",
465     "src/compiler/code-generator-impl.h",
466     "src/compiler/code-generator.cc",
467     "src/compiler/code-generator.h",
468     "src/compiler/common-node-cache.h",
469     "src/compiler/common-operator.h",
470     "src/compiler/control-builders.cc",
471     "src/compiler/control-builders.h",
472     "src/compiler/frame.h",
473     "src/compiler/gap-resolver.cc",
474     "src/compiler/gap-resolver.h",
475     "src/compiler/generic-algorithm-inl.h",
476     "src/compiler/generic-algorithm.h",
477     "src/compiler/generic-graph.h",
478     "src/compiler/generic-node-inl.h",
479     "src/compiler/generic-node.h",
480     "src/compiler/graph-builder.cc",
481     "src/compiler/graph-builder.h",
482     "src/compiler/graph-inl.h",
483     "src/compiler/graph-reducer.cc",
484     "src/compiler/graph-reducer.h",
485     "src/compiler/graph-replay.cc",
486     "src/compiler/graph-replay.h",
487     "src/compiler/graph-visualizer.cc",
488     "src/compiler/graph-visualizer.h",
489     "src/compiler/graph.cc",
490     "src/compiler/graph.h",
491     "src/compiler/instruction-codes.h",
492     "src/compiler/instruction-selector-impl.h",
493     "src/compiler/instruction-selector.cc",
494     "src/compiler/instruction-selector.h",
495     "src/compiler/instruction.cc",
496     "src/compiler/instruction.h",
497     "src/compiler/js-context-specialization.cc",
498     "src/compiler/js-context-specialization.h",
499     "src/compiler/js-generic-lowering.cc",
500     "src/compiler/js-generic-lowering.h",
501     "src/compiler/js-graph.cc",
502     "src/compiler/js-graph.h",
503     "src/compiler/js-inlining.cc",
504     "src/compiler/js-inlining.h",
505     "src/compiler/js-operator.h",
506     "src/compiler/js-typed-lowering.cc",
507     "src/compiler/js-typed-lowering.h",
508     "src/compiler/linkage-impl.h",
509     "src/compiler/linkage.cc",
510     "src/compiler/linkage.h",
511     "src/compiler/machine-node-factory.h",
512     "src/compiler/machine-operator-reducer.cc",
513     "src/compiler/machine-operator-reducer.h",
514     "src/compiler/machine-operator.h",
515     "src/compiler/machine-type.cc",
516     "src/compiler/machine-type.h",
517     "src/compiler/node-aux-data-inl.h",
518     "src/compiler/node-aux-data.h",
519     "src/compiler/node-cache.cc",
520     "src/compiler/node-cache.h",
521     "src/compiler/node-matchers.h",
522     "src/compiler/node-properties-inl.h",
523     "src/compiler/node-properties.h",
524     "src/compiler/node.cc",
525     "src/compiler/node.h",
526     "src/compiler/opcodes.h",
527     "src/compiler/operator-properties-inl.h",
528     "src/compiler/operator-properties.h",
529     "src/compiler/operator.h",
530     "src/compiler/phi-reducer.h",
531     "src/compiler/pipeline.cc",
532     "src/compiler/pipeline.h",
533     "src/compiler/raw-machine-assembler.cc",
534     "src/compiler/raw-machine-assembler.h",
535     "src/compiler/register-allocator.cc",
536     "src/compiler/register-allocator.h",
537     "src/compiler/representation-change.h",
538     "src/compiler/schedule.cc",
539     "src/compiler/schedule.h",
540     "src/compiler/scheduler.cc",
541     "src/compiler/scheduler.h",
542     "src/compiler/simplified-lowering.cc",
543     "src/compiler/simplified-lowering.h",
544     "src/compiler/simplified-node-factory.h",
545     "src/compiler/simplified-operator-reducer.cc",
546     "src/compiler/simplified-operator-reducer.h",
547     "src/compiler/simplified-operator.h",
548     "src/compiler/source-position.cc",
549     "src/compiler/source-position.h",
550     "src/compiler/structured-machine-assembler.cc",
551     "src/compiler/structured-machine-assembler.h",
552     "src/compiler/typer.cc",
553     "src/compiler/typer.h",
554     "src/compiler/verifier.cc",
555     "src/compiler/verifier.h",
556     "src/compiler.cc",
557     "src/compiler.h",
558     "src/contexts.cc",
559     "src/contexts.h",
560     "src/conversions-inl.h",
561     "src/conversions.cc",
562     "src/conversions.h",
563     "src/counters.cc",
564     "src/counters.h",
565     "src/cpu-profiler-inl.h",
566     "src/cpu-profiler.cc",
567     "src/cpu-profiler.h",
568     "src/data-flow.cc",
569     "src/data-flow.h",
570     "src/date.cc",
571     "src/date.h",
572     "src/dateparser-inl.h",
573     "src/dateparser.cc",
574     "src/dateparser.h",
575     "src/debug.cc",
576     "src/debug.h",
577     "src/deoptimizer.cc",
578     "src/deoptimizer.h",
579     "src/disasm.h",
580     "src/disassembler.cc",
581     "src/disassembler.h",
582     "src/diy-fp.cc",
583     "src/diy-fp.h",
584     "src/double.h",
585     "src/dtoa.cc",
586     "src/dtoa.h",
587     "src/effects.h",
588     "src/elements-kind.cc",
589     "src/elements-kind.h",
590     "src/elements.cc",
591     "src/elements.h",
592     "src/execution.cc",
593     "src/execution.h",
594     "src/extensions/externalize-string-extension.cc",
595     "src/extensions/externalize-string-extension.h",
596     "src/extensions/free-buffer-extension.cc",
597     "src/extensions/free-buffer-extension.h",
598     "src/extensions/gc-extension.cc",
599     "src/extensions/gc-extension.h",
600     "src/extensions/statistics-extension.cc",
601     "src/extensions/statistics-extension.h",
602     "src/extensions/trigger-failure-extension.cc",
603     "src/extensions/trigger-failure-extension.h",
604     "src/factory.cc",
605     "src/factory.h",
606     "src/fast-dtoa.cc",
607     "src/fast-dtoa.h",
608     "src/feedback-slots.h",
609     "src/field-index.cc",
610     "src/field-index.h",
611     "src/field-index-inl.h",
612     "src/fixed-dtoa.cc",
613     "src/fixed-dtoa.h",
614     "src/flag-definitions.h",
615     "src/flags.cc",
616     "src/flags.h",
617     "src/frames-inl.h",
618     "src/frames.cc",
619     "src/frames.h",
620     "src/full-codegen.cc",
621     "src/full-codegen.h",
622     "src/func-name-inferrer.cc",
623     "src/func-name-inferrer.h",
624     "src/gdb-jit.cc",
625     "src/gdb-jit.h",
626     "src/global-handles.cc",
627     "src/global-handles.h",
628     "src/globals.h",
629     "src/handles-inl.h",
630     "src/handles.cc",
631     "src/handles.h",
632     "src/hashmap.h",
633     "src/heap-profiler.cc",
634     "src/heap-profiler.h",
635     "src/heap-snapshot-generator-inl.h",
636     "src/heap-snapshot-generator.cc",
637     "src/heap-snapshot-generator.h",
638     "src/heap/gc-idle-time-handler.cc",
639     "src/heap/gc-idle-time-handler.h",
640     "src/heap/gc-tracer.cc",
641     "src/heap/gc-tracer.h",
642     "src/heap/heap-inl.h",
643     "src/heap/heap.cc",
644     "src/heap/heap.h",
645     "src/heap/incremental-marking.cc",
646     "src/heap/incremental-marking.h",
647     "src/heap/mark-compact-inl.h",
648     "src/heap/mark-compact.cc",
649     "src/heap/mark-compact.h",
650     "src/heap/objects-visiting-inl.h",
651     "src/heap/objects-visiting.cc",
652     "src/heap/objects-visiting.h",
653     "src/heap/spaces-inl.h",
654     "src/heap/spaces.cc",
655     "src/heap/spaces.h",
656     "src/heap/store-buffer-inl.h",
657     "src/heap/store-buffer.cc",
658     "src/heap/store-buffer.h",
659     "src/heap/sweeper-thread.h",
660     "src/heap/sweeper-thread.cc",
661     "src/hydrogen-alias-analysis.h",
662     "src/hydrogen-bce.cc",
663     "src/hydrogen-bce.h",
664     "src/hydrogen-bch.cc",
665     "src/hydrogen-bch.h",
666     "src/hydrogen-canonicalize.cc",
667     "src/hydrogen-canonicalize.h",
668     "src/hydrogen-check-elimination.cc",
669     "src/hydrogen-check-elimination.h",
670     "src/hydrogen-dce.cc",
671     "src/hydrogen-dce.h",
672     "src/hydrogen-dehoist.cc",
673     "src/hydrogen-dehoist.h",
674     "src/hydrogen-environment-liveness.cc",
675     "src/hydrogen-environment-liveness.h",
676     "src/hydrogen-escape-analysis.cc",
677     "src/hydrogen-escape-analysis.h",
678     "src/hydrogen-flow-engine.h",
679     "src/hydrogen-instructions.cc",
680     "src/hydrogen-instructions.h",
681     "src/hydrogen.cc",
682     "src/hydrogen.h",
683     "src/hydrogen-gvn.cc",
684     "src/hydrogen-gvn.h",
685     "src/hydrogen-infer-representation.cc",
686     "src/hydrogen-infer-representation.h",
687     "src/hydrogen-infer-types.cc",
688     "src/hydrogen-infer-types.h",
689     "src/hydrogen-load-elimination.cc",
690     "src/hydrogen-load-elimination.h",
691     "src/hydrogen-mark-deoptimize.cc",
692     "src/hydrogen-mark-deoptimize.h",
693     "src/hydrogen-mark-unreachable.cc",
694     "src/hydrogen-mark-unreachable.h",
695     "src/hydrogen-osr.cc",
696     "src/hydrogen-osr.h",
697     "src/hydrogen-range-analysis.cc",
698     "src/hydrogen-range-analysis.h",
699     "src/hydrogen-redundant-phi.cc",
700     "src/hydrogen-redundant-phi.h",
701     "src/hydrogen-removable-simulates.cc",
702     "src/hydrogen-removable-simulates.h",
703     "src/hydrogen-representation-changes.cc",
704     "src/hydrogen-representation-changes.h",
705     "src/hydrogen-sce.cc",
706     "src/hydrogen-sce.h",
707     "src/hydrogen-store-elimination.cc",
708     "src/hydrogen-store-elimination.h",
709     "src/hydrogen-types.cc",
710     "src/hydrogen-types.h",
711     "src/hydrogen-uint32-analysis.cc",
712     "src/hydrogen-uint32-analysis.h",
713     "src/i18n.cc",
714     "src/i18n.h",
715     "src/icu_util.cc",
716     "src/icu_util.h",
717     "src/ic/ic-inl.h",
718     "src/ic/ic.cc",
719     "src/ic/ic.h",
720     "src/ic/stub-cache.cc",
721     "src/ic/stub-cache.h",
722     "src/interface.cc",
723     "src/interface.h",
724     "src/interpreter-irregexp.cc",
725     "src/interpreter-irregexp.h",
726     "src/isolate.cc",
727     "src/isolate.h",
728     "src/json-parser.h",
729     "src/json-stringifier.h",
730     "src/jsregexp-inl.h",
731     "src/jsregexp.cc",
732     "src/jsregexp.h",
733     "src/list-inl.h",
734     "src/list.h",
735     "src/lithium-allocator-inl.h",
736     "src/lithium-allocator.cc",
737     "src/lithium-allocator.h",
738     "src/lithium-codegen.cc",
739     "src/lithium-codegen.h",
740     "src/lithium.cc",
741     "src/lithium.h",
742     "src/liveedit.cc",
743     "src/liveedit.h",
744     "src/log-inl.h",
745     "src/log-utils.cc",
746     "src/log-utils.h",
747     "src/log.cc",
748     "src/log.h",
749     "src/lookup-inl.h",
750     "src/lookup.cc",
751     "src/lookup.h",
752     "src/macro-assembler.h",
753     "src/messages.cc",
754     "src/messages.h",
755     "src/msan.h",
756     "src/natives.h",
757     "src/objects-debug.cc",
758     "src/objects-inl.h",
759     "src/objects-printer.cc",
760     "src/objects.cc",
761     "src/objects.h",
762     "src/optimizing-compiler-thread.cc",
763     "src/optimizing-compiler-thread.h",
764     "src/ostreams.cc",
765     "src/ostreams.h",
766     "src/parser.cc",
767     "src/parser.h",
768     "src/perf-jit.cc",
769     "src/perf-jit.h",
770     "src/preparse-data-format.h",
771     "src/preparse-data.cc",
772     "src/preparse-data.h",
773     "src/preparser.cc",
774     "src/preparser.h",
775     "src/prettyprinter.cc",
776     "src/prettyprinter.h",
777     "src/profile-generator-inl.h",
778     "src/profile-generator.cc",
779     "src/profile-generator.h",
780     "src/property-details.h",
781     "src/property.cc",
782     "src/property.h",
783     "src/prototype.h",
784     "src/regexp-macro-assembler-irregexp-inl.h",
785     "src/regexp-macro-assembler-irregexp.cc",
786     "src/regexp-macro-assembler-irregexp.h",
787     "src/regexp-macro-assembler-tracer.cc",
788     "src/regexp-macro-assembler-tracer.h",
789     "src/regexp-macro-assembler.cc",
790     "src/regexp-macro-assembler.h",
791     "src/regexp-stack.cc",
792     "src/regexp-stack.h",
793     "src/rewriter.cc",
794     "src/rewriter.h",
795     "src/runtime-profiler.cc",
796     "src/runtime-profiler.h",
797     "src/runtime.cc",
798     "src/runtime.h",
799     "src/safepoint-table.cc",
800     "src/safepoint-table.h",
801     "src/sampler.cc",
802     "src/sampler.h",
803     "src/scanner-character-streams.cc",
804     "src/scanner-character-streams.h",
805     "src/scanner.cc",
806     "src/scanner.h",
807     "src/scopeinfo.cc",
808     "src/scopeinfo.h",
809     "src/scopes.cc",
810     "src/scopes.h",
811     "src/serialize.cc",
812     "src/serialize.h",
813     "src/small-pointer-list.h",
814     "src/smart-pointers.h",
815     "src/snapshot-source-sink.cc",
816     "src/snapshot-source-sink.h",
817     "src/snapshot.h",
818     "src/string-search.cc",
819     "src/string-search.h",
820     "src/string-stream.cc",
821     "src/string-stream.h",
822     "src/strtod.cc",
823     "src/strtod.h",
824     "src/token.cc",
825     "src/token.h",
826     "src/transitions-inl.h",
827     "src/transitions.cc",
828     "src/transitions.h",
829     "src/type-info.cc",
830     "src/type-info.h",
831     "src/types-inl.h",
832     "src/types.cc",
833     "src/types.h",
834     "src/typing.cc",
835     "src/typing.h",
836     "src/unbound-queue-inl.h",
837     "src/unbound-queue.h",
838     "src/unicode-inl.h",
839     "src/unicode.cc",
840     "src/unicode.h",
841     "src/unique.h",
842     "src/uri.h",
843     "src/utils-inl.h",
844     "src/utils.cc",
845     "src/utils.h",
846     "src/v8.cc",
847     "src/v8.h",
848     "src/v8memory.h",
849     "src/v8threads.cc",
850     "src/v8threads.h",
851     "src/variables.cc",
852     "src/variables.h",
853     "src/version.cc",
854     "src/version.h",
855     "src/vm-state-inl.h",
856     "src/vm-state.h",
857     "src/zone-inl.h",
858     "src/zone.cc",
859     "src/zone.h",
860     "third_party/fdlibm/fdlibm.cc",
861     "third_party/fdlibm/fdlibm.h",
862   ]
863
864   if (v8_target_arch == "x86") {
865     sources += [
866       "src/ia32/assembler-ia32-inl.h",
867       "src/ia32/assembler-ia32.cc",
868       "src/ia32/assembler-ia32.h",
869       "src/ia32/builtins-ia32.cc",
870       "src/ia32/code-stubs-ia32.cc",
871       "src/ia32/code-stubs-ia32.h",
872       "src/ia32/codegen-ia32.cc",
873       "src/ia32/codegen-ia32.h",
874       "src/ia32/cpu-ia32.cc",
875       "src/ia32/debug-ia32.cc",
876       "src/ia32/deoptimizer-ia32.cc",
877       "src/ia32/disasm-ia32.cc",
878       "src/ia32/frames-ia32.cc",
879       "src/ia32/frames-ia32.h",
880       "src/ia32/full-codegen-ia32.cc",
881       "src/ia32/lithium-codegen-ia32.cc",
882       "src/ia32/lithium-codegen-ia32.h",
883       "src/ia32/lithium-gap-resolver-ia32.cc",
884       "src/ia32/lithium-gap-resolver-ia32.h",
885       "src/ia32/lithium-ia32.cc",
886       "src/ia32/lithium-ia32.h",
887       "src/ia32/macro-assembler-ia32.cc",
888       "src/ia32/macro-assembler-ia32.h",
889       "src/ia32/regexp-macro-assembler-ia32.cc",
890       "src/ia32/regexp-macro-assembler-ia32.h",
891       "src/compiler/ia32/code-generator-ia32.cc",
892       "src/compiler/ia32/instruction-codes-ia32.h",
893       "src/compiler/ia32/instruction-selector-ia32.cc",
894       "src/compiler/ia32/linkage-ia32.cc",
895       "src/ic/ia32/ic-ia32.cc",
896       "src/ic/ia32/handler-ia32.cc",
897       "src/ic/ia32/stub-cache-ia32.cc",
898     ]
899   } else if (v8_target_arch == "x64") {
900     sources += [
901       "src/x64/assembler-x64-inl.h",
902       "src/x64/assembler-x64.cc",
903       "src/x64/assembler-x64.h",
904       "src/x64/builtins-x64.cc",
905       "src/x64/code-stubs-x64.cc",
906       "src/x64/code-stubs-x64.h",
907       "src/x64/codegen-x64.cc",
908       "src/x64/codegen-x64.h",
909       "src/x64/cpu-x64.cc",
910       "src/x64/debug-x64.cc",
911       "src/x64/deoptimizer-x64.cc",
912       "src/x64/disasm-x64.cc",
913       "src/x64/frames-x64.cc",
914       "src/x64/frames-x64.h",
915       "src/x64/full-codegen-x64.cc",
916       "src/x64/lithium-codegen-x64.cc",
917       "src/x64/lithium-codegen-x64.h",
918       "src/x64/lithium-gap-resolver-x64.cc",
919       "src/x64/lithium-gap-resolver-x64.h",
920       "src/x64/lithium-x64.cc",
921       "src/x64/lithium-x64.h",
922       "src/x64/macro-assembler-x64.cc",
923       "src/x64/macro-assembler-x64.h",
924       "src/x64/regexp-macro-assembler-x64.cc",
925       "src/x64/regexp-macro-assembler-x64.h",
926       "src/compiler/x64/code-generator-x64.cc",
927       "src/compiler/x64/instruction-codes-x64.h",
928       "src/compiler/x64/instruction-selector-x64.cc",
929       "src/compiler/x64/linkage-x64.cc",
930       "src/ic/x64/ic-x64.cc",
931       "src/ic/x64/ic-compiler-x64.cc",
932       "src/ic/x64/stub-cache-x64.cc",
933     ]
934   } else if (v8_target_arch == "arm") {
935     sources += [
936       "src/arm/assembler-arm-inl.h",
937       "src/arm/assembler-arm.cc",
938       "src/arm/assembler-arm.h",
939       "src/arm/builtins-arm.cc",
940       "src/arm/code-stubs-arm.cc",
941       "src/arm/code-stubs-arm.h",
942       "src/arm/codegen-arm.cc",
943       "src/arm/codegen-arm.h",
944       "src/arm/constants-arm.h",
945       "src/arm/constants-arm.cc",
946       "src/arm/cpu-arm.cc",
947       "src/arm/debug-arm.cc",
948       "src/arm/deoptimizer-arm.cc",
949       "src/arm/disasm-arm.cc",
950       "src/arm/frames-arm.cc",
951       "src/arm/frames-arm.h",
952       "src/arm/full-codegen-arm.cc",
953       "src/arm/lithium-arm.cc",
954       "src/arm/lithium-arm.h",
955       "src/arm/lithium-codegen-arm.cc",
956       "src/arm/lithium-codegen-arm.h",
957       "src/arm/lithium-gap-resolver-arm.cc",
958       "src/arm/lithium-gap-resolver-arm.h",
959       "src/arm/macro-assembler-arm.cc",
960       "src/arm/macro-assembler-arm.h",
961       "src/arm/regexp-macro-assembler-arm.cc",
962       "src/arm/regexp-macro-assembler-arm.h",
963       "src/arm/simulator-arm.cc",
964       "src/compiler/arm/code-generator-arm.cc",
965       "src/compiler/arm/instruction-codes-arm.h",
966       "src/compiler/arm/instruction-selector-arm.cc",
967       "src/compiler/arm/linkage-arm.cc",
968       "src/ic/arm/ic-arm.cc",
969       "src/ic/arm/ic-compiler-arm.cc",
970       "src/ic/arm/stub-cache-arm.cc",
971     ]
972   } else if (v8_target_arch == "arm64") {
973     sources += [
974       "src/arm64/assembler-arm64.cc",
975       "src/arm64/assembler-arm64.h",
976       "src/arm64/assembler-arm64-inl.h",
977       "src/arm64/builtins-arm64.cc",
978       "src/arm64/codegen-arm64.cc",
979       "src/arm64/codegen-arm64.h",
980       "src/arm64/code-stubs-arm64.cc",
981       "src/arm64/code-stubs-arm64.h",
982       "src/arm64/constants-arm64.h",
983       "src/arm64/cpu-arm64.cc",
984       "src/arm64/debug-arm64.cc",
985       "src/arm64/decoder-arm64.cc",
986       "src/arm64/decoder-arm64.h",
987       "src/arm64/decoder-arm64-inl.h",
988       "src/arm64/deoptimizer-arm64.cc",
989       "src/arm64/disasm-arm64.cc",
990       "src/arm64/disasm-arm64.h",
991       "src/arm64/frames-arm64.cc",
992       "src/arm64/frames-arm64.h",
993       "src/arm64/full-codegen-arm64.cc",
994       "src/arm64/instructions-arm64.cc",
995       "src/arm64/instructions-arm64.h",
996       "src/arm64/instrument-arm64.cc",
997       "src/arm64/instrument-arm64.h",
998       "src/arm64/lithium-arm64.cc",
999       "src/arm64/lithium-arm64.h",
1000       "src/arm64/lithium-codegen-arm64.cc",
1001       "src/arm64/lithium-codegen-arm64.h",
1002       "src/arm64/lithium-gap-resolver-arm64.cc",
1003       "src/arm64/lithium-gap-resolver-arm64.h",
1004       "src/arm64/macro-assembler-arm64.cc",
1005       "src/arm64/macro-assembler-arm64.h",
1006       "src/arm64/macro-assembler-arm64-inl.h",
1007       "src/arm64/regexp-macro-assembler-arm64.cc",
1008       "src/arm64/regexp-macro-assembler-arm64.h",
1009       "src/arm64/simulator-arm64.cc",
1010       "src/arm64/simulator-arm64.h",
1011       "src/arm64/utils-arm64.cc",
1012       "src/arm64/utils-arm64.h",
1013       "src/compiler/arm64/code-generator-arm64.cc",
1014       "src/compiler/arm64/instruction-codes-arm64.h",
1015       "src/compiler/arm64/instruction-selector-arm64.cc",
1016       "src/compiler/arm64/linkage-arm64.cc",
1017       "src/ic/arm64/ic-arm64.cc",
1018       "src/ic/arm64/ic-compiler-arm64.cc",
1019       "src/ic/arm64/stub-cache-arm64.cc",
1020     ]
1021   } else if (v8_target_arch == "mipsel") {
1022     sources += [
1023       "src/mips/assembler-mips.cc",
1024       "src/mips/assembler-mips.h",
1025       "src/mips/assembler-mips-inl.h",
1026       "src/mips/builtins-mips.cc",
1027       "src/mips/codegen-mips.cc",
1028       "src/mips/codegen-mips.h",
1029       "src/mips/code-stubs-mips.cc",
1030       "src/mips/code-stubs-mips.h",
1031       "src/mips/constants-mips.cc",
1032       "src/mips/constants-mips.h",
1033       "src/mips/cpu-mips.cc",
1034       "src/mips/debug-mips.cc",
1035       "src/mips/deoptimizer-mips.cc",
1036       "src/mips/disasm-mips.cc",
1037       "src/mips/frames-mips.cc",
1038       "src/mips/frames-mips.h",
1039       "src/mips/full-codegen-mips.cc",
1040       "src/mips/ic-mips.cc",
1041       "src/mips/lithium-codegen-mips.cc",
1042       "src/mips/lithium-codegen-mips.h",
1043       "src/mips/lithium-gap-resolver-mips.cc",
1044       "src/mips/lithium-gap-resolver-mips.h",
1045       "src/mips/lithium-mips.cc",
1046       "src/mips/lithium-mips.h",
1047       "src/mips/macro-assembler-mips.cc",
1048       "src/mips/macro-assembler-mips.h",
1049       "src/mips/regexp-macro-assembler-mips.cc",
1050       "src/mips/regexp-macro-assembler-mips.h",
1051       "src/mips/simulator-mips.cc",
1052       "src/mips/stub-cache-mips.cc",
1053     ]
1054   }
1055
1056   configs -= [ "//build/config/compiler:chromium_code" ]
1057   configs += [ "//build/config/compiler:no_chromium_code" ]
1058   configs += [ ":internal_config", ":features", ":toolchain" ]
1059
1060   defines = []
1061   deps = [ ":v8_libbase" ]
1062
1063   if (is_linux) {
1064     if (v8_compress_startup_data == "bz2") {
1065       libs += [ "bz2" ]
1066     }
1067   }
1068
1069   if (v8_enable_i18n_support) {
1070     deps += [ "//third_party/icu" ]
1071     if (is_win) {
1072       deps += [ "//third_party/icu:icudata" ]
1073     }
1074     # TODO(jochen): Add support for icu_use_data_file_flag
1075     defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE" ]
1076   } else {
1077     sources -= [
1078       "src/i18n.cc",
1079       "src/i18n.h",
1080     ]
1081   }
1082
1083   if (v8_postmortem_support) {
1084     sources += [ "$target_gen_dir/debug-support.cc" ]
1085     deps += [ ":postmortem-metadata" ]
1086   }
1087 }
1088
1089 source_set("v8_libbase") {
1090   visibility = ":*"  # Only targets in this file can depend on this.
1091
1092   sources = [
1093     "src/base/atomicops.h",
1094     "src/base/atomicops_internals_arm64_gcc.h",
1095     "src/base/atomicops_internals_arm_gcc.h",
1096     "src/base/atomicops_internals_atomicword_compat.h",
1097     "src/base/atomicops_internals_mac.h",
1098     "src/base/atomicops_internals_mips_gcc.h",
1099     "src/base/atomicops_internals_tsan.h",
1100     "src/base/atomicops_internals_x86_gcc.cc",
1101     "src/base/atomicops_internals_x86_gcc.h",
1102     "src/base/atomicops_internals_x86_msvc.h",
1103     "src/base/bits.h",
1104     "src/base/build_config.h",
1105     "src/base/cpu.cc",
1106     "src/base/cpu.h",
1107     "src/base/lazy-instance.h",
1108     "src/base/logging.cc",
1109     "src/base/logging.h",
1110     "src/base/macros.h",
1111     "src/base/once.cc",
1112     "src/base/once.h",
1113     "src/base/platform/elapsed-timer.h",
1114     "src/base/platform/time.cc",
1115     "src/base/platform/time.h",
1116     "src/base/platform/condition-variable.cc",
1117     "src/base/platform/condition-variable.h",
1118     "src/base/platform/mutex.cc",
1119     "src/base/platform/mutex.h",
1120     "src/base/platform/platform.h",
1121     "src/base/platform/semaphore.cc",
1122     "src/base/platform/semaphore.h",
1123     "src/base/safe_conversions.h",
1124     "src/base/safe_conversions_impl.h",
1125     "src/base/safe_math.h",
1126     "src/base/safe_math_impl.h",
1127     "src/base/utils/random-number-generator.cc",
1128     "src/base/utils/random-number-generator.h",
1129   ]
1130
1131   configs -= [ "//build/config/compiler:chromium_code" ]
1132   configs += [ "//build/config/compiler:no_chromium_code" ]
1133   configs += [ ":internal_config_base", ":features", ":toolchain" ]
1134
1135   defines = []
1136
1137   if (is_posix) {
1138     sources += [
1139       "src/base/platform/platform-posix.cc"
1140     ]
1141   }
1142
1143   if (is_linux) {
1144     sources += [
1145       "src/base/platform/platform-linux.cc"
1146     ]
1147
1148     libs = [ "rt" ]
1149   } else if (is_android) {
1150     defines += [ "CAN_USE_VFP_INSTRUCTIONS" ]
1151
1152     if (build_os == "mac") {
1153       if (current_toolchain == host_toolchain) {
1154         sources += [ "src/base/platform/platform-macos.cc" ]
1155       } else {
1156         sources += [ "src/base/platform/platform-linux.cc" ]
1157       }
1158     } else {
1159       sources += [ "src/base/platform/platform-linux.cc" ]
1160       if (current_toolchain == host_toolchain) {
1161         defines += [ "V8_LIBRT_NOT_AVAILABLE" ]
1162       }
1163     }
1164   } else if (is_mac) {
1165     sources += [ "src/base/platform/platform-macos.cc" ]
1166   } else if (is_win) {
1167     # TODO(jochen): Add support for cygwin.
1168     sources += [
1169       "src/base/platform/platform-win32.cc",
1170       "src/base/win32-headers.h",
1171       "src/base/win32-math.cc",
1172       "src/base/win32-math.h",
1173     ]
1174
1175     defines += [ "_CRT_RAND_S" ]  # for rand_s()
1176
1177     libs = [ "winmm.lib", "ws2_32.lib" ]
1178   }
1179
1180   # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
1181 }
1182
1183 source_set("v8_libplatform") {
1184   sources = [
1185     "include/libplatform/libplatform.h",
1186     "src/libplatform/default-platform.cc",
1187     "src/libplatform/default-platform.h",
1188     "src/libplatform/task-queue.cc",
1189     "src/libplatform/task-queue.h",
1190     "src/libplatform/worker-thread.cc",
1191     "src/libplatform/worker-thread.h",
1192   ]
1193
1194   configs -= [ "//build/config/compiler:chromium_code" ]
1195   configs += [ "//build/config/compiler:no_chromium_code" ]
1196   configs += [ ":internal_config_base", ":features", ":toolchain" ]
1197
1198   deps = [
1199     ":v8_libbase",
1200   ]
1201 }
1202
1203 ###############################################################################
1204 # Executables
1205 #
1206
1207 if (current_toolchain == host_toolchain) {
1208   executable("mksnapshot") {
1209     visibility = ":*"  # Only targets in this file can depend on this.
1210
1211     sources = [
1212       "src/mksnapshot.cc",
1213     ]
1214
1215     configs -= [ "//build/config/compiler:chromium_code" ]
1216     configs += [ "//build/config/compiler:no_chromium_code" ]
1217     configs += [ ":internal_config", ":features", ":toolchain" ]
1218
1219     deps = [
1220       ":v8_base",
1221       ":v8_libplatform",
1222       ":v8_nosnapshot",
1223     ]
1224
1225     if (v8_compress_startup_data == "bz2") {
1226       libs = [ "bz2" ]
1227     }
1228   }
1229 }
1230
1231 ###############################################################################
1232 # Public targets
1233 #
1234
1235 if (component_mode == "shared_library") {
1236
1237 component("v8") {
1238   sources = [
1239     "src/v8dll-main.cc",
1240   ]
1241
1242   if (v8_use_external_startup_data) {
1243     deps = [
1244       ":v8_base",
1245       ":v8_external_snapshot",
1246     ]
1247   } else if (v8_use_snapshot) {
1248     deps = [
1249       ":v8_base",
1250       ":v8_snapshot",
1251     ]
1252   } else {
1253     deps = [
1254       ":v8_base",
1255       ":v8_nosnapshot",
1256     ]
1257   }
1258
1259   configs -= [ "//build/config/compiler:chromium_code" ]
1260   configs += [ "//build/config/compiler:no_chromium_code" ]
1261   configs += [ ":internal_config", ":features", ":toolchain" ]
1262
1263   direct_dependent_configs = [ ":external_config" ]
1264
1265   if (is_android && current_toolchain != host_toolchain) {
1266     libs += [ "log" ]
1267   }
1268 }
1269
1270 } else {
1271
1272 group("v8") {
1273   if (v8_use_external_startup_data) {
1274     deps = [
1275       ":v8_base",
1276       ":v8_external_snapshot",
1277     ]
1278   } else if (v8_use_snapshot) {
1279     deps = [
1280       ":v8_base",
1281       ":v8_snapshot",
1282     ]
1283   } else {
1284     deps = [
1285       ":v8_base",
1286       ":v8_nosnapshot",
1287     ]
1288   }
1289
1290   direct_dependent_configs = [ ":external_config" ]
1291 }
1292
1293 }