runtime,runtime/debug: Converted some functions from goc to Go.

LGTM=khr
R=golang-codereviews, khr
CC=dvyukov, golang-codereviews
https://codereview.appspot.com/131010044

Committer: Keith Randall <khr@golang.org>