compiler, runtime: allocate defer records on the stack

When a defer is executed at most once in a function body,
we can allocate the defer record for it on the stack instead
of on the heap.

This should make defers like this (which are very common) faster.

This is a port of CL 171758 from the gc repo.

Change-Id: Ib9b83ebeeb5862194d862253ec587b66a2761f3f
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190410
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 files changed