Created placeholders for MallocHooks implementation and added define DART_USE_TCMALLOC to specifiy when tcmalloc is available.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2619443002 .
This commit is contained in:
Ben Konyi 2017-01-06 12:38:11 -08:00
parent d6fdc65220
commit 9ff7ee6132
9 changed files with 123 additions and 23 deletions

View file

@ -3,27 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
import("gypi_contents.gni")
declare_args() {
# Whether to fall back to built-in root certificates when they cannot be
# verified at the operating system level.
dart_use_fallback_root_certificates = false
# The BUILD.gn file that we pull from chromium as part of zlib has a
# dependence on //base, which we don't pull in. In a standalone build of the
# VM, we set this to //runtime/bin/zlib where we have a BUILD.gn file without
# a dependence on //base.
dart_zlib_path = "//third_party/zlib"
# Whether to link the standalone VM against tcmalloc. The standalone build of
# the VM enables this only for Linux builds.
dart_use_tcmalloc = false
}
# TODO(zra): Remove this when Fuchsia has a root cert cache on the filesystem.
if (defined(is_fuchsia) && is_fuchsia) {
dart_use_fallback_root_certificates = true
}
import("../runtime_args.gni")
# Generate a resources.cc file for the service isolate without Observatory.
action("gen_resources_cc") {
@ -590,12 +570,13 @@ template("dart_executable") {
"$dart_zlib_path",
] + extra_deps
defines = extra_defines
if (dart_use_tcmalloc) {
deps += [ "//third_party/tcmalloc" ]
defines += [ "DART_USE_TCMALLOC" ]
}
defines = extra_defines
sources = [
"main.cc",
"vmservice_impl.cc",
@ -810,6 +791,7 @@ executable("run_vm_tests") {
if (dart_use_tcmalloc) {
deps += [ "//third_party/tcmalloc" ]
defines += [ "DART_USE_TCMALLOC" ]
}
# The VM sources are already included in libdart, so we just want to add in

View file

@ -1151,6 +1151,9 @@
'dependencies': [
'../third_party/tcmalloc/tcmalloc.gypi:tcmalloc',
],
'defines': [
'DART_USE_TCMALLOC'
],
}],
],
'configurations': {
@ -1402,6 +1405,9 @@
'dependencies': [
'../third_party/tcmalloc/tcmalloc.gypi:tcmalloc',
],
'defines': [
'DART_USE_TCMALLOC'
],
}],
],
'configurations': {

24
runtime/runtime_args.gni Normal file
View file

@ -0,0 +1,24 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
declare_args() {
# Whether to fall back to built-in root certificates when they cannot be
# verified at the operating system level.
dart_use_fallback_root_certificates = false
# The BUILD.gn file that we pull from chromium as part of zlib has a
# dependence on //base, which we don't pull in. In a standalone build of the
# VM, we set this to //runtime/bin/zlib where we have a BUILD.gn file without
# a dependence on //base.
dart_zlib_path = "//third_party/zlib"
# Whether to link the standalone VM against tcmalloc. The standalone build of
# the VM enables this only for Linux builds.
dart_use_tcmalloc = false
}
# TODO(zra): Remove this when Fuchsia has a root cert cache on the filesystem.
if (defined(is_fuchsia) && is_fuchsia) {
dart_use_fallback_root_certificates = true
}

View file

@ -5,6 +5,7 @@
import("../../build/executable_suffix.gni")
import("../../build/prebuilt_dart_sdk.gni")
import("gypi_contents.gni")
import("../runtime_args.gni")
config("libdart_vm_config") {
if (defined(is_fuchsia) && is_fuchsia) {

View file

@ -0,0 +1,17 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#if defined(DART_USE_TCMALLOC)
#include "vm/malloc_hooks.h"
namespace dart {
void MallocHooks::Init() {
// TODO(bkonyi): Implement
}
} // namespace dart
#endif // defined(DART_USE_TCMALLOC)

22
runtime/vm/malloc_hooks.h Normal file
View file

@ -0,0 +1,22 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_MALLOC_HOOKS_H_
#define RUNTIME_VM_MALLOC_HOOKS_H_
#include "vm/globals.h"
namespace dart {
class MallocHooks {
static void Init();
private:
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(MallocHooks);
};
} // namespace dart
#endif // RUNTIME_VM_MALLOC_HOOKS_H_

View file

@ -0,0 +1,17 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#if defined(DART_USE_TCMALLOC)
#include "vm/malloc_hooks.h"
namespace dart {
void MallocHooks::Init() {
// TODO(bkonyi): Implement
}
} // namespace dart
#endif // defined(DART_USE_TCMALLOC)

View file

@ -61,6 +61,13 @@
],
},
}],
# The following condition should be kept in sync with the corresponding
# configurations in runtime/bin/bin.gypi.
['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
'defines': [
'DART_USE_TCMALLOC'
],
}],
['OS=="android" and _toolset=="host"', {
'link_settings': {
'libraries': [
@ -105,6 +112,13 @@
],
},
}],
# The following condition should be kept in sync with the corresponding
# configurations in runtime/bin/bin.gypi.
['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
'defines': [
'DART_USE_TCMALLOC'
],
}],
['OS=="android" and _toolset=="host"', {
'link_settings': {
'libraries': [
@ -149,6 +163,13 @@
],
},
}],
# The following condition should be kept in sync with the corresponding
# configurations in runtime/bin/bin.gypi.
['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
'defines': [
'DART_USE_TCMALLOC'
],
}],
['OS=="android" and _toolset=="host"', {
'link_settings': {
'libraries': [
@ -194,6 +215,13 @@
],
},
}],
# The following condition should be kept in sync with the corresponding
# configurations in runtime/bin/bin.gypi.
['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
'defines': [
'DART_USE_TCMALLOC'
],
}],
['OS=="android" and _toolset=="host"', {
'link_settings': {
'libraries': [

View file

@ -285,6 +285,9 @@
'longjump.cc',
'longjump.h',
'longjump_test.cc',
'malloc_hooks.cc',
'malloc_hooks_unsupported.cc',
'malloc_hooks.h',
'megamorphic_cache_table.cc',
'megamorphic_cache_table.h',
'memory_region.cc',