diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-09 08:19:58 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-09 08:19:58 +0000 |
commit | 2da6f72bb78de6e6ca3d387d970cb21bf36684be (patch) | |
tree | 7ca86535c5a6b99d4cc432ba5cfddabc5ee4ea16 /libgo/go/encoding/json/scanner.go | |
parent | 98ea39f2b59cc0a4a0a32b095e8f0faa84fd7882 (diff) | |
download | ppe42-gcc-2da6f72bb78de6e6ca3d387d970cb21bf36684be.tar.gz ppe42-gcc-2da6f72bb78de6e6ca3d387d970cb21bf36684be.zip |
libgo: Update to weekly.2012-02-07.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184034 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/encoding/json/scanner.go')
-rw-r--r-- | libgo/go/encoding/json/scanner.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/libgo/go/encoding/json/scanner.go b/libgo/go/encoding/json/scanner.go index 2661f410e01..054b6b3d564 100644 --- a/libgo/go/encoding/json/scanner.go +++ b/libgo/go/encoding/json/scanner.go @@ -185,18 +185,9 @@ func isSpace(c rune) bool { return c == ' ' || c == '\t' || c == '\r' || c == '\n' } -// NOTE(rsc): The various instances of -// -// if c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n') -// -// below should all be if c <= ' ' && isSpace(c), but inlining -// the checks makes a significant difference (>10%) in tight loops -// such as nextValue. These should be rewritten with the clearer -// function call once 6g knows to inline the call. - // stateBeginValueOrEmpty is the state after reading `[`. func stateBeginValueOrEmpty(s *scanner, c int) int { - if c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n') { + if c <= ' ' && isSpace(rune(c)) { return scanSkipSpace } if c == ']' { @@ -207,7 +198,7 @@ func stateBeginValueOrEmpty(s *scanner, c int) int { // stateBeginValue is the state at the beginning of the input. func stateBeginValue(s *scanner, c int) int { - if c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n') { + if c <= ' ' && isSpace(rune(c)) { return scanSkipSpace } switch c { @@ -247,7 +238,7 @@ func stateBeginValue(s *scanner, c int) int { // stateBeginStringOrEmpty is the state after reading `{`. func stateBeginStringOrEmpty(s *scanner, c int) int { - if c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n') { + if c <= ' ' && isSpace(rune(c)) { return scanSkipSpace } if c == '}' { @@ -260,7 +251,7 @@ func stateBeginStringOrEmpty(s *scanner, c int) int { // stateBeginString is the state after reading `{"key": value,`. func stateBeginString(s *scanner, c int) int { - if c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n') { + if c <= ' ' && isSpace(rune(c)) { return scanSkipSpace } if c == '"' { @@ -280,7 +271,7 @@ func stateEndValue(s *scanner, c int) int { s.endTop = true return stateEndTop(s, c) } - if c <= ' ' && (c == ' ' || c == '\t' || c == '\r' || c == '\n') { + if c <= ' ' && isSpace(rune(c)) { s.step = stateEndValue return scanSkipSpace } |