Skip to content

Commit

Permalink
add gn jumbo build support
Browse files Browse the repository at this point in the history
To speed up compilation times, jumbo allows files to be compiled
together. This is a well known method ("unity builds") to both
compile faster and create a poor man's "full program optimization".
We are only interested in compile times.

Background:
https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md

Note that jumbo builds are not enabled by default.  To try this out,
add use_jumbo_build=true to your GN args.

BUG=chromium:746958

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ieb9fdccb6c135e9806dbed91c09a29aa8b8bee11
Reviewed-on: https://chromium-review.googlesource.com/579090
Commit-Queue: Mostyn Bramley-Moore <mostynb@opera.com>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47239}
  • Loading branch information
mostynb authored and Commit Bot committed Aug 9, 2017
1 parent b7227dc commit 2ddca9c
Show file tree
Hide file tree
Showing 70 changed files with 413 additions and 184 deletions.
39 changes: 39 additions & 0 deletions BUILD.gn
Expand Up @@ -6,6 +6,7 @@ import("//build/config/android/config.gni")
import("//build/config/arm.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/jumbo.gni")
import("//build/config/mips.gni")
import("//build/config/sanitizers/sanitizers.gni")

Expand Down Expand Up @@ -867,6 +868,15 @@ v8_source_set("v8_nosnapshot") {
"src/snapshot/snapshot-empty.cc",
]

if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
# Generated source, contains same variable names as libraries.cc
"$target_gen_dir/experimental-extras-libraries.cc",
"$target_gen_dir/libraries.cc",
]
}

configs = [ ":internal_config" ]
}

Expand Down Expand Up @@ -898,6 +908,15 @@ v8_source_set("v8_snapshot") {
"src/setup-isolate-deserialize.cc",
]

if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
# Generated source, contains same variable names as libraries.cc
"$target_gen_dir/experimental-extras-libraries.cc",
"$target_gen_dir/libraries.cc",
]
}

configs = [ ":internal_config" ]
}

Expand Down Expand Up @@ -1001,6 +1020,14 @@ v8_source_set("v8_builtins_generators") {
"src/interpreter/setup-interpreter.h",
]

if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
"src/builtins/builtins-async-iterator-gen.cc",
"src/builtins/builtins-async-generator-gen.cc",
]
}

if (v8_current_cpu == "x86") {
sources += [
### gcmole(arch:ia32) ###
Expand Down Expand Up @@ -2045,6 +2072,18 @@ v8_source_set("v8_base") {
"src/zone/zone.h",
]

if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
"src/profiler/heap-snapshot-generator.cc", # Macro clash in mman-linux.h
"src/compiler/c-linkage.cc", # Symbol clashes with linkage.cc
"src/compiler/wasm-linkage.cc", # regloc symbol clash with linkage.cc

"src/compiler/escape-analysis.cc", # Symbol clashes with new-escape-analysis.cc
"src/compiler/escape-analysis-reducer.cc", # Symbol clashes with new-escape-analysis-reducer.cc
]
}

if (v8_current_cpu == "x86") {
sources += [ ### gcmole(arch:ia32) ###
"src/compiler/ia32/code-generator-ia32.cc",
Expand Down
16 changes: 10 additions & 6 deletions gni/v8.gni
Expand Up @@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/jumbo.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/v8_target_cpu.gni")
import("//build/split_static_library.gni")
Expand Down Expand Up @@ -109,7 +110,11 @@ template("v8_source_set") {
} else if (defined(v8_static_library) && v8_static_library) {
link_target_type = "static_library"
} else {
link_target_type = "source_set"
if (use_jumbo_build) {
link_target_type = "jumbo_source_set"
} else {
link_target_type = "source_set"
}
}
target(link_target_type, target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
Expand All @@ -120,7 +125,7 @@ template("v8_source_set") {
}

template("v8_header_set") {
source_set(target_name) {
jumbo_source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= v8_remove_configs
Expand Down Expand Up @@ -151,14 +156,13 @@ template("v8_executable") {
# reasons.
if (is_clang) {
configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
configs += [ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
configs +=
[ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
} else {
configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ]
}
}
deps += [
v8_path_prefix + ":v8_dump_build_config",
]
deps += [ v8_path_prefix + ":v8_dump_build_config" ]
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/api-arguments-inl.h
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_API_ARGUMENTS_INL_H_
#define V8_API_ARGUMENTS_INL_H_

#include "src/api-arguments.h"

#include "src/tracing/trace-event.h"
Expand Down Expand Up @@ -153,3 +156,5 @@ void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,

} // namespace internal
} // namespace v8

#endif // V8_API_ARGUMENTS_INL_H_
2 changes: 2 additions & 0 deletions src/asmjs/asm-parser.cc
Expand Up @@ -2460,3 +2460,5 @@ void AsmJsParser::GatherCases(ZoneVector<int32_t>* cases) {
} // namespace wasm
} // namespace internal
} // namespace v8

#undef RECURSE
5 changes: 5 additions & 0 deletions src/base/platform/platform-posix-time.h
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_
#define V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_

#include "src/base/platform/platform-posix.h"

namespace v8 {
Expand All @@ -17,3 +20,5 @@ class PosixDefaultTimezoneCache : public PosixTimezoneCache {

} // namespace base
} // namespace v8

#endif // V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_
5 changes: 5 additions & 0 deletions src/builtins/builtins-arguments-gen.h
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_
#define V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_

#include "src/code-stub-assembler.h"

namespace v8 {
Expand Down Expand Up @@ -53,3 +56,5 @@ class ArgumentsBuiltinsAssembler : public CodeStubAssembler {

} // namespace internal
} // namespace v8

#endif // V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_
6 changes: 5 additions & 1 deletion src/builtins/builtins-forin-gen.h
@@ -1,8 +1,10 @@

// Copyright 2017 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.

#ifndef V8_BUILTINS_BUILTINS_FORIN_GEN_H_
#define V8_BUILTINS_BUILTINS_FORIN_GEN_H_

#include "src/code-stub-assembler.h"

namespace v8 {
Expand Down Expand Up @@ -32,3 +34,5 @@ class ForInBuiltinsAssembler : public CodeStubAssembler {

} // namespace internal
} // namespace v8

#endif // V8_BUILTINS_BUILTINS_FORIN_GEN_H_
5 changes: 5 additions & 0 deletions src/builtins/builtins-iterator-gen.h
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_
#define V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_

#include "src/code-stub-assembler.h"

namespace v8 {
Expand Down Expand Up @@ -47,3 +50,5 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {

} // namespace internal
} // namespace v8

#endif // V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_
15 changes: 6 additions & 9 deletions src/compiler/common-operator.cc
Expand Up @@ -341,7 +341,7 @@ ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) {
return OpParameter<TypedObjectStateInfo>(op).machine_types();
}

#define CACHED_OP_LIST(V) \
#define COMMON_CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
Expand Down Expand Up @@ -501,7 +501,7 @@ struct CommonOperatorGlobalCache final {
control_output_count) {} \
}; \
Name##Operator k##Name##Operator;
CACHED_OP_LIST(CACHED)
COMMON_CACHED_OP_LIST(CACHED)
#undef CACHED

template <size_t kInputCount>
Expand Down Expand Up @@ -752,22 +752,19 @@ struct CommonOperatorGlobalCache final {
#undef CACHED_STATE_VALUES
};


static base::LazyInstance<CommonOperatorGlobalCache>::type kCache =
LAZY_INSTANCE_INITIALIZER;

static base::LazyInstance<CommonOperatorGlobalCache>::type
kCommonOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER;

CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone)
: cache_(kCache.Get()), zone_(zone) {}

: cache_(kCommonOperatorGlobalCache.Get()), zone_(zone) {}

#define CACHED(Name, properties, value_input_count, effect_input_count, \
control_input_count, value_output_count, effect_output_count, \
control_output_count) \
const Operator* CommonOperatorBuilder::Name() { \
return &cache_.k##Name##Operator; \
}
CACHED_OP_LIST(CACHED)
COMMON_CACHED_OP_LIST(CACHED)
#undef CACHED


Expand Down
2 changes: 2 additions & 0 deletions src/compiler/control-equivalence.cc
Expand Up @@ -228,6 +228,8 @@ void ControlEquivalence::BracketListTRACE(BracketList& blist) {
}
}

#undef TRACE

} // namespace compiler
} // namespace internal
} // namespace v8
2 changes: 2 additions & 0 deletions src/compiler/escape-analysis.cc
Expand Up @@ -1788,6 +1788,8 @@ bool EscapeAnalysis::ExistsVirtualAllocate() {

Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); }

#undef TRACE

} // namespace compiler
} // namespace internal
} // namespace v8
2 changes: 2 additions & 0 deletions src/compiler/js-inlining.cc
Expand Up @@ -746,6 +746,8 @@ SimplifiedOperatorBuilder* JSInliner::simplified() const {
return jsgraph()->simplified();
}

#undef TRACE

} // namespace compiler
} // namespace internal
} // namespace v8
7 changes: 0 additions & 7 deletions src/compiler/js-native-context-specialization.cc
Expand Up @@ -39,13 +39,6 @@ bool HasOnlyJSArrayMaps(MapHandles const& maps) {
return true;
}

bool HasOnlyStringMaps(MapHandles const& maps) {
for (auto map : maps) {
if (!map->IsStringMap()) return false;
}
return true;
}

} // namespace

struct JSNativeContextSpecialization::ScriptContextTableLookupResult {
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/js-operator.cc
Expand Up @@ -632,11 +632,11 @@ struct JSOperatorGlobalCache final {
#undef COMPARE_OP
};

static base::LazyInstance<JSOperatorGlobalCache>::type kCache =
static base::LazyInstance<JSOperatorGlobalCache>::type kJSOperatorGlobalCache =
LAZY_INSTANCE_INITIALIZER;

JSOperatorBuilder::JSOperatorBuilder(Zone* zone)
: cache_(kCache.Get()), zone_(zone) {}
: cache_(kJSOperatorGlobalCache.Get()), zone_(zone) {}

#define CACHED_OP(Name, properties, value_input_count, value_output_count) \
const Operator* JSOperatorBuilder::Name() { \
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/jump-threading.cc
Expand Up @@ -197,6 +197,8 @@ void JumpThreading::ApplyForwarding(ZoneVector<RpoNumber>& result,
}
}

#undef TRACE

} // namespace compiler
} // namespace internal
} // namespace v8
1 change: 1 addition & 0 deletions src/compiler/live-range-separator.cc
Expand Up @@ -174,6 +174,7 @@ void LiveRangeMerger::Merge() {
}
}

#undef TRACE

} // namespace compiler
} // namespace internal
Expand Down
5 changes: 3 additions & 2 deletions src/compiler/load-elimination.cc
Expand Up @@ -132,7 +132,7 @@ Reduction LoadElimination::Reduce(Node* node) {

namespace {

bool IsCompatibleCheck(Node const* a, Node const* b) {
bool LoadEliminationIsCompatibleCheck(Node const* a, Node const* b) {
if (a->op() != b->op()) return false;
for (int i = a->op()->ValueInputCount(); --i >= 0;) {
if (!MustAlias(a->InputAt(i), b->InputAt(i))) return false;
Expand All @@ -144,7 +144,8 @@ bool IsCompatibleCheck(Node const* a, Node const* b) {

Node* LoadElimination::AbstractChecks::Lookup(Node* node) const {
for (Node* const check : nodes_) {
if (check && !check->IsDead() && IsCompatibleCheck(check, node)) {
if (check && !check->IsDead() &&
LoadEliminationIsCompatibleCheck(check, node)) {
return check;
}
}
Expand Down

0 comments on commit 2ddca9c

Please sign in to comment.