Commit 314c528d authored by primiano's avatar primiano Committed by Commit bot

Revert of Improve EAT_STREAM_PARAMETERS for Windows x86 (patchset #10...

Revert of Improve EAT_STREAM_PARAMETERS for Windows x86 (patchset #10 id:240001 of https://codereview.chromium.org/2559323007/ )

Reason for revert:
Broke D*LOG on a bunch of bots building non-official builds.
See https://codereview.chromium.org/2559323007/#msg60
and https://codereview.chromium.org/2559323007/#msg61
for more context.

Original issue's description:
> Improve EAT_STREAM_PARAMETERS for Windows x86
>
> Dumps of check_example.exe
>
> Current:
>
> ?DoBlinkReleaseAssert@@YAX_N@Z:
>   00404EDC: 55                 push        ebp
>   00404EDD: 8B EC              mov         ebp,esp
>   00404EDF: 80 7D 08 00        cmp         byte ptr [ebp+8],0
>   00404EE3: 75 07              jne         00404EEC
>   00404EE5: C6 05 00 00 00 00  mov         byte ptr ds:[0],0
>             00
>   00404EEC: 5D                 pop         ebp
>   00404EED: C3                 ret
> ?DoCheck@@YAX_N@Z:
>   00404EEE: 55                 push        ebp
>   00404EEF: 8B EC              mov         ebp,esp
>   00404EF1: 51                 push        ecx
>   00404EF2: 83 65 FC 00        and         dword ptr [ebp-4],0
>   00404EF6: 80 7D 08 00        cmp         byte ptr [ebp+8],0
>   00404EFA: 75 07              jne         00404F03
>   00404EFC: C6 05 00 00 00 00  mov         byte ptr ds:[0],0
>             00
>   00404F03: 8B E5              mov         esp,ebp
>   00404F05: 5D                 pop         ebp
>   00404F06: C3                 ret
> _main:
>   00404F07: 55                 push        ebp
>   00404F08: 8B EC              mov         ebp,esp
>   00404F0A: 83 7D 08 02        cmp         dword ptr [ebp+8],2
>   00404F0E: 53                 push        ebx
>   00404F0F: 0F 9F C3           setg        bl
>   00404F12: 53                 push        ebx
>   00404F13: E8 D6 FF FF FF     call        ?DoCheck@@YAX_N@Z
>   00404F18: 53                 push        ebx
>   00404F19: E8 BE FF FF FF     call        ?DoBlinkReleaseAssert@@YAX_N@Z
>   00404F1E: 59                 pop         ecx
>   00404F1F: 59                 pop         ecx
>   00404F20: 33 C0              xor         eax,eax
>   00404F22: 5B                 pop         ebx
>   00404F23: 5D                 pop         ebp
>   00404F24: C3                 ret
>
>
>
> After this CL:
>
> ?DoBlinkReleaseAssert@@YAX_N@Z:
>   00404EAC: 55                 push        ebp
>   00404EAD: 8B EC              mov         ebp,esp
>   00404EAF: 80 7D 08 00        cmp         byte ptr [ebp+8],0
>   00404EB3: 75 07              jne         00404EBC
>   00404EB5: C6 05 00 00 00 00  mov         byte ptr ds:[0],0
>             00
>   00404EBC: 5D                 pop         ebp
>   00404EBD: C3                 ret
> _main:
>   00404EBE: 55                 push        ebp
>   00404EBF: 8B EC              mov         ebp,esp
>   00404EC1: 83 7D 08 02        cmp         dword ptr [ebp+8],2
>   00404EC5: 53                 push        ebx
>   00404EC6: 0F 9F C3           setg        bl
>   00404EC9: 53                 push        ebx
>   00404ECA: E8 DD FF FF FF     call        ?DoBlinkReleaseAssert@@YAX_N@Z
>   00404ECF: 53                 push        ebx
>   00404ED0: E8 D7 FF FF FF     call        ?DoBlinkReleaseAssert@@YAX_N@Z
>   00404ED5: 59                 pop         ecx
>   00404ED6: 59                 pop         ecx
>   00404ED7: 33 C0              xor         eax,eax
>   00404ED9: 5B                 pop         ebx
>   00404EDA: 5D                 pop         ebp
>   00404EDB: C3                 ret
>
>
> Amusingly, I was confused because I thought I was going crazy when
> DoCheck wasn't showing up in the /disasm. But of course, it's because it
> got COMDAT'd with the Blink one, as we want. :)
>
> R=primiano@chromium.org
> BUG=672699
>
> Review-Url: https://codereview.chromium.org/2559323007

TBR=dcheng@chromium.org,scottmg@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=672699

Review-Url: https://codereview.chromium.org/2569583002
Cr-Commit-Position: refs/heads/master@{#437764}
parent 39e086ae
...@@ -5,27 +5,16 @@ ...@@ -5,27 +5,16 @@
// This file is meant for analyzing the code generated by the CHECK // This file is meant for analyzing the code generated by the CHECK
// macros in a small executable file that's easy to disassemble. // macros in a small executable file that's easy to disassemble.
#include "base/compiler_specific.h"
#include "base/logging.h" #include "base/logging.h"
// An official build shouldn't generate code to print out messages for // An official build shouldn't generate code to print out messages for
// the CHECK* macros, nor should it have the strings in the // the CHECK* macros, nor should it have the strings in the
// executable. It is also important that the CHECK() function collapse to the // executable.
// same implementation as RELEASE_ASSERT(), in particular on Windows x86.
// Historically, the stream eating caused additional unnecessary instructions.
// See https://crbug.com/672699.
#define BLINK_RELEASE_ASSERT_EQUIVALENT(assertion) \
(UNLIKELY(!(assertion)) ? (IMMEDIATE_CRASH()) : (void)0)
void DoCheck(bool b) { void DoCheck(bool b) {
CHECK(b) << "DoCheck " << b; CHECK(b) << "DoCheck " << b;
} }
void DoBlinkReleaseAssert(bool b) {
BLINK_RELEASE_ASSERT_EQUIVALENT(b);
}
void DoCheckEq(int x, int y) { void DoCheckEq(int x, int y) {
CHECK_EQ(x, y); CHECK_EQ(x, y);
} }
...@@ -33,5 +22,4 @@ void DoCheckEq(int x, int y) { ...@@ -33,5 +22,4 @@ void DoCheckEq(int x, int y) {
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
DoCheck(argc > 1); DoCheck(argc > 1);
DoCheckEq(argc, 1); DoCheckEq(argc, 1);
DoBlinkReleaseAssert(argc > 1);
} }
...@@ -426,19 +426,9 @@ const LogSeverity LOG_0 = LOG_ERROR; ...@@ -426,19 +426,9 @@ const LogSeverity LOG_0 = LOG_ERROR;
#define PLOG_IF(severity, condition) \ #define PLOG_IF(severity, condition) \
LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition))
// Note that the null ostream is used instead of an arbitrary LOG() stream to // The actual stream used isn't important.
// avoid the creation of an object with a non-trivial destructor (LogMessage). #define EAT_STREAM_PARAMETERS \
// On MSVC x86 (checked on 2015 Update 3), doing so causes a few additional true ? (void) 0 : ::logging::LogMessageVoidify() & LOG_STREAM(FATAL)
// pointless instructions to be emitted even at full optimization level, even
// though the : arm of the ternary operator is clearly never executed. Using a
// simpler POD object with a templated operator<< also works to avoid these
// instructions. However, this causes warnings on statically defined
// implementations of operator<<(std::ostream, ...) in some .cc files, because
// they become defined-but-unreferenced functions.
#define EAT_STREAM_PARAMETERS \
true \
? (void)0 \
: ::logging::LogMessageVoidify() & (*reinterpret_cast<std::ostream*>(0))
// Captures the result of a CHECK_EQ (for example) and facilitates testing as a // Captures the result of a CHECK_EQ (for example) and facilitates testing as a
// boolean. // boolean.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment