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

Issue 2653073002: Make sure DCHECK compiles out completely if DCHECKS aren't enabled. (Closed)

Created:
3 years, 11 months ago by dcheng
Modified:
3 years, 11 months ago
CC:
chromium-reviews, vmpstr+watch_chromium.org, danakj, ncarter (slow), brucedawson
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make sure DCHECK compiles out completely if DCHECKS aren't enabled. The MSVC optimizer can get confused when expressions that create temporaries are completely optimized out. Before: 2017-01-24 05:59 PM 1,139,712 chrome.exe 2017-01-24 05:53 PM 48,618,496 chrome.dll 2017-01-24 05:59 PM 68,739,584 chrome_child.dll After: 2017-01-24 06:51 PM 1,136,128 chrome.exe 2017-01-24 06:45 PM 48,265,216 chrome.dll 2017-01-24 06:51 PM 68,245,504 chrome_child.dll This results in a total savings of ~830KB in a mostly official build. These numbers don't include the effect of full_wpo_on_official=true, but it's been confirmed that this codegen bug happens either way. BUG=684105 R=scottmg@chromium.org Review-Url: https://codereview.chromium.org/2653073002 Cr-Commit-Position: refs/heads/master@{#446054} Committed: https://chromium.googlesource.com/chromium/src/+/fc670f47ae174fb59497fe5d3315b10cc7601cad

Patch Set 1 #

Patch Set 2 : DCHECK_OP as well #

Patch Set 3 : Trick DCHECK_OP into working #

Patch Set 4 : Slightly format better #

Total comments: 1

Patch Set 5 : More comments. #

Patch Set 6 : Really fix DCHECK_OP more. #

Patch Set 7 : Really fix the build this time, for real. #

Patch Set 8 : Really truly fix build. #

Total comments: 2

Patch Set 9 : commented #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -5 lines) Patch
M base/logging.h View 1 2 3 4 5 6 7 8 4 chunks +38 lines, -5 lines 2 comments Download

Messages

Total messages: 50 (31 generated)
dcheng
I think this should work, but I don't have a local test case. We'll also ...
3 years, 11 months ago (2017-01-24 20:55:49 UTC) #1
danakj
Seems cool, since DCHECK_IS_ON() is no longer runtime, there's no reason to use it like ...
3 years, 11 months ago (2017-01-24 20:58:03 UTC) #3
dcheng
OK, I think I managed to trick DCHECK_OP into using this optimization as well.
3 years, 11 months ago (2017-01-24 21:17:05 UTC) #4
scottmg
lgtm https://codereview.chromium.org/2653073002/diff/60001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2653073002/diff/60001/base/logging.h#newcode742 base/logging.h:742: #define DCHECK(condition) EAT_STREAM_PARAMETERS << !(condition) !'ing condition seems ...
3 years, 11 months ago (2017-01-24 21:25:58 UTC) #5
scottmg
As discussed offline, a test would be nice, but would only work in Official, and ...
3 years, 11 months ago (2017-01-24 21:28:21 UTC) #6
danakj
On Tue, Jan 24, 2017 at 4:28 PM, <scottmg@chromium.org> wrote: > As discussed offline, a ...
3 years, 11 months ago (2017-01-24 21:30:22 UTC) #7
scottmg
On 2017/01/24 21:30:22, danakj (slow) wrote: > On Tue, Jan 24, 2017 at 4:28 PM, ...
3 years, 11 months ago (2017-01-24 21:36:16 UTC) #8
dcheng
On 2017/01/24 21:30:22, danakj (slow) wrote: > On Tue, Jan 24, 2017 at 4:28 PM, ...
3 years, 11 months ago (2017-01-24 21:37:44 UTC) #9
ncarter (slow)
+wez as an FYI
3 years, 11 months ago (2017-01-24 21:52:06 UTC) #13
ncarter (slow)
lgtm
3 years, 11 months ago (2017-01-24 21:52:25 UTC) #14
ncarter (slow)
I patched this in, and verified that it fixes the repro I reported.
3 years, 11 months ago (2017-01-24 22:04:43 UTC) #15
dcheng
OK, I patched it in, built, and confirmed it works. And as a bonus, it ...
3 years, 11 months ago (2017-01-25 01:11:26 UTC) #33
Wez
https://codereview.chromium.org/2653073002/diff/120003/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2653073002/diff/120003/base/logging.h#newcode774 base/logging.h:774: ::logging::g_swallow_stream, val2), \ nit: Add a comment to clarify ...
3 years, 11 months ago (2017-01-25 01:57:24 UTC) #34
dcheng
Also updated the CL description with some numbers. https://codereview.chromium.org/2653073002/diff/120003/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2653073002/diff/120003/base/logging.h#newcode774 base/logging.h:774: ::logging::g_swallow_stream, ...
3 years, 11 months ago (2017-01-25 03:11:58 UTC) #35
danakj
LGTM https://codereview.chromium.org/2653073002/diff/160001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2653073002/diff/160001/base/logging.h#newcode735 base/logging.h:735: #if DCHECK_IS_ON() can you elif instead of else\nif?
3 years, 11 months ago (2017-01-25 16:03:42 UTC) #42
dcheng
https://codereview.chromium.org/2653073002/diff/160001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2653073002/diff/160001/base/logging.h#newcode735 base/logging.h:735: #if DCHECK_IS_ON() On 2017/01/25 16:03:42, danakj (slow) wrote: > ...
3 years, 11 months ago (2017-01-25 17:42:53 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2653073002/160001
3 years, 11 months ago (2017-01-25 17:43:42 UTC) #46
commit-bot: I haz the power
Committed patchset #9 (id:160001) as https://chromium.googlesource.com/chromium/src/+/fc670f47ae174fb59497fe5d3315b10cc7601cad
3 years, 11 months ago (2017-01-25 17:49:25 UTC) #49
scottmg
3 years, 11 months ago (2017-01-25 18:19:27 UTC) #50
Message was sent while issue was closed.
[ FWIW, I experienced a 7M discrepancy between full_wpo_on_official=true and
=false in https://bugs.chromium.org/p/chromium/issues/detail?id=581766 . So
unfortunately in general, it's not really worth doing size comparisons without
it on. ]

Powered by Google App Engine
This is Rietveld 408576698