Shorten TRAP_SEQUENCE on Intel.

On Intel, TRAP_SEQUENCE() consisted of:
  int3                  // Breakpoint
  ud2                   // Make sure it crashes in case a developer
                        // steps past the breakpoint
  push $<unique value>  // Prevent trap sequences from being merged
  ud2                   // Only on Windows x64 and Mac, quirk of
                        // __builtin_unreachable().

Previously, the push instruction was required to make CHECKs somewhat
unique, so that compilers like gcc wouldn't fold all the CHECKs in a
function into one common sequence.

However, clang won't fold asm sequences together, so just drop the push
completely.

On Win64 and Mac, also drop the explicit ud2 from TRAP_SEQUENCE:
__builtin_unreachable() always emits a ud2 on those platforms, and
there's no reason to have ud2 twice in a row.

To simplify followups, this CL also temporarily splits the TRAP_SEQUENCE
macro into TRAP_SEQUENCE1 and TRAP_SEQUENCE2:
- TRAP_SEQUENCE1() is responsible for triggering a debug breakpoint.
- TRAP_SEQUENCE2() is responsible for ensuring fatal termination.

Staged followups will turn TRAP_SEQUENCE1 into no-ops. Assuming crash
reports aren't affected, the final followup will remove TRAP_SEQUENCE1
entirely.

Bug: 958675
Change-Id: Id86e70a23a1407404721b9da4f2d2374fa86dc3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1589282
Commit-Queue: Daniel Cheng <[email protected]>
Reviewed-by: Mark Mentovai <[email protected]>
Reviewed-by: Bruce Dawson <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#671123}
2 files changed