encoding/json: inline fieldByIndex
encoding/json: inline fieldByIndex

This function was only used in a single place - in the field encoding
loop within the struct encoder.

Inlining the function call manually lets us get rid of the call
overhead. But most importantly, it lets us simplify the logic afterward.
We no longer need to use reflect.Value{} and !fv.IsValid(), as we can
skip the field immediately.

The two factors combined (mostly just the latter) give a moderate speed
improvement to this hot loop.

name           old time/op    new time/op    delta
CodeEncoder-4    6.01ms ± 1%    5.91ms ± 1%  -1.66%  (p=0.002 n=6+6)

name           old speed      new speed      delta
CodeEncoder-4   323MB/s ± 1%   328MB/s ± 1%  +1.69%  (p=0.002 n=6+6)

Updates #5683.

Change-Id: I12757c325a68abb2856026cf719c122612a1f38e
Reviewed-on: https://go-review.googlesource.com/125417
Run-TryBot: Daniel Martí <29bf28b42a938ace12a5819da4ed4ba03d82f315@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>

akutz/go,akutz/go,CAFxX/go,josharian/go,cloudflare/go,nawawi/go,josharian/go,golang/go,cloudflare/go,nawawi/go,cloudflare/go,akutz/go,nawawi/go,cloudflare/go,nawawi/go,josharian/go,golang/go,CAFxX/go,golang/go,nawawi/go,akutz/go,cloudflare/go,golang/go,akutz/go,cloudflare/go,josharian/go,josharian/go,josharian/go,josharian/go,cloudflare/go,CAFxX/go,nawawi/go,josharian/go,golang/go,CAFxX/go,akutz/go,nawawi/go,nawawi/go,akutz/go,CAFxX/go,golang/go,CAFxX/go,golang/go,akutz/go,cloudflare/go,CAFxX/go,CAFxX/go,golang/go