mirror of
https://github.com/golang/go
synced 2024-11-18 14:04:45 -07:00
runtime: speed up eqstring
eqstring does not need to check the length of the strings. Other architectures were done in a separate commit. While we're here, add a pointer equality check. Change-Id: Id2c8616a03a7da7037c1e9ccd56a549fc952bd98 Reviewed-on: https://go-review.googlesource.com/3956 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
135ef49fde
commit
82a761b656
@ -969,30 +969,30 @@ eq:
|
|||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
// eqstring tests whether two strings are equal.
|
// eqstring tests whether two strings are equal.
|
||||||
|
// The compiler guarantees that strings passed
|
||||||
|
// to eqstring have equal length.
|
||||||
// See runtime_test.go:eqstring_generic for
|
// See runtime_test.go:eqstring_generic for
|
||||||
// equivalent Go code.
|
// equivalent Go code.
|
||||||
TEXT runtime·eqstring(SB),NOSPLIT,$0-33
|
TEXT runtime·eqstring(SB),NOSPLIT,$0-33
|
||||||
MOVD s1len+8(FP), R4
|
|
||||||
MOVD s2len+24(FP), R5
|
|
||||||
CMP R4, R5
|
|
||||||
BNE noteq
|
|
||||||
|
|
||||||
MOVD s1str+0(FP), R3
|
MOVD s1str+0(FP), R3
|
||||||
MOVD s2str+16(FP), R4
|
MOVD s2str+16(FP), R4
|
||||||
|
MOVD $1, R5
|
||||||
|
MOVB R5, ret+32(FP)
|
||||||
|
CMP R3, R4
|
||||||
|
BNE 2(PC)
|
||||||
|
RETURN
|
||||||
|
MOVD s1len+8(FP), R5
|
||||||
SUB $1, R3
|
SUB $1, R3
|
||||||
SUB $1, R4
|
SUB $1, R4
|
||||||
ADD R3, R5, R8
|
ADD R3, R5, R8
|
||||||
loop:
|
loop:
|
||||||
CMP R3, R8
|
CMP R3, R8
|
||||||
BNE 4(PC)
|
BNE 2(PC)
|
||||||
MOVD $1, R3
|
|
||||||
MOVB R3, ret+32(FP)
|
|
||||||
RETURN
|
RETURN
|
||||||
MOVBZU 1(R3), R6
|
MOVBZU 1(R3), R6
|
||||||
MOVBZU 1(R4), R7
|
MOVBZU 1(R4), R7
|
||||||
CMP R6, R7
|
CMP R6, R7
|
||||||
BEQ loop
|
BEQ loop
|
||||||
noteq:
|
|
||||||
MOVB R0, ret+32(FP)
|
MOVB R0, ret+32(FP)
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user