Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: build/config/allocator.gni

Issue 2601573002: mac: Hook up allocator shim. (Closed)
Patch Set: Clean up. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/sanitizers/sanitizers.gni") 5 import("//build/config/sanitizers/sanitizers.gni")
6 6
7 # Temporarily disable tcmalloc on arm64 linux to get rid of compilation errors. 7 # Temporarily disable tcmalloc on arm64 linux to get rid of compilation errors.
8 if (is_android || current_cpu == "mipsel" || is_mac || is_ios || is_asan || 8 if (is_android || current_cpu == "mipsel" || is_mac || is_ios || is_asan ||
9 is_lsan || is_tsan || is_msan || is_win || is_syzyasan || 9 is_lsan || is_tsan || is_msan || is_win || is_syzyasan ||
10 (is_linux && target_cpu == "arm64")) { 10 (is_linux && target_cpu == "arm64")) {
11 _default_allocator = "none" 11 _default_allocator = "none"
12 } else { 12 } else {
13 _default_allocator = "tcmalloc" 13 _default_allocator = "tcmalloc"
14 } 14 }
15 15
16 # The debug CRT on Windows has some debug features that are incompatible with 16 # The debug CRT on Windows has some debug features that are incompatible with
17 # the shim. NaCl in particular does seem to link some binaries statically 17 # the shim. NaCl in particular does seem to link some binaries statically
18 # against the debug CRT with "is_nacl=false". 18 # against the debug CRT with "is_nacl=false".
19 if ((is_linux || is_android || (is_win && !is_component_build && !is_debug)) && 19 if ((is_linux || is_android || is_mac ||
Primiano Tucci (use gerrit) 2017/01/17 17:09:59 the pattern I used in the past was to flip the swi
20 !is_asan && !is_lsan && !is_tsan && !is_msan) { 20 (is_win && !is_component_build && !is_debug)) && !is_asan && !is_lsan &&
21 !is_tsan && !is_msan) {
21 _default_use_experimental_allocator_shim = true 22 _default_use_experimental_allocator_shim = true
22 } else { 23 } else {
23 _default_use_experimental_allocator_shim = false 24 _default_use_experimental_allocator_shim = false
24 } 25 }
25 26
26 declare_args() { 27 declare_args() {
27 # Memory allocator to use. Set to "none" to use default allocator. 28 # Memory allocator to use. Set to "none" to use default allocator.
28 use_allocator = _default_allocator 29 use_allocator = _default_allocator
29 30
30 # TODO(primiano): this should just become the default without having a flag, 31 # TODO(primiano): this should just become the default without having a flag,
31 # but we need to get there first. http://crbug.com/550886 . 32 # but we need to get there first. http://crbug.com/550886 .
32 # Causes all the allocations to be routed via allocator_shim.cc. 33 # Causes all the allocations to be routed via allocator_shim.cc.
33 use_experimental_allocator_shim = _default_use_experimental_allocator_shim 34 use_experimental_allocator_shim = _default_use_experimental_allocator_shim
34 } 35 }
35 36
36 if (is_nacl) { 37 if (is_nacl) {
37 # Turn off the build flag for NaCL builds to minimize confusion, as NaCL 38 # Turn off the build flag for NaCL builds to minimize confusion, as NaCL
38 # doesn't support the heap shim. 39 # doesn't support the heap shim.
39 use_experimental_allocator_shim = false 40 use_experimental_allocator_shim = false
40 } 41 }
41 42
42 assert(use_allocator == "none" || use_allocator == "tcmalloc") 43 assert(use_allocator == "none" || use_allocator == "tcmalloc")
43 44
44 assert(!is_win || use_allocator == "none", "Tcmalloc doesn't work on Windows.") 45 assert(!is_win || use_allocator == "none", "Tcmalloc doesn't work on Windows.")
46 assert(!is_mac || use_allocator == "none", "Tcmalloc doesn't work on macOS.")
45 47
46 assert( 48 assert(!use_experimental_allocator_shim || is_linux || is_android || is_win ||
47 !use_experimental_allocator_shim || is_linux || is_android || is_win, 49 is_mac,
48 "use_experimental_allocator_shim supported only on Linux, Android and Window s targets") 50 "use_experimental_allocator_shim supported only on Linux, Android, " +
51 "Windows and macOS targets")
49 52
50 if (is_win && use_experimental_allocator_shim) { 53 if (is_win && use_experimental_allocator_shim) {
51 assert(!is_component_build, 54 assert(!is_component_build,
52 "The allocator shim doesn't work for the component build on Windows.") 55 "The allocator shim doesn't work for the component build on Windows.")
53 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698