@@ -62,6 +62,8 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
62
62
text: 𝔽; url: #𝔽
63
63
text: ℤ; url: #ℤ
64
64
text: SameValue; url: sec-samevalue
65
+ text: IsStrictlyEqual; url: sec-isstrictlyequal
66
+ text: IsLessThan; url: sec-islessthan
65
67
text: String.fromCharCode; url: sec-string.fromcharcode
66
68
text: String.fromCodePoint; url: sec-string.fromcodepoint
67
69
text: String.prototype.charCodeAt; url: sec-string.prototype.charcodeat
@@ -2007,11 +2009,41 @@ When this builtin is invoked with parameters |string|, |start|, and |end|, the f
2007
2009
2008
2010
<h4 id="js-string-equals">equals</h4>
2009
2011
2010
- TODO
2012
+ The |funcType| of this builtin is `(func (param externref externref) (result i32))`.
2013
+
2014
+ Note: Explicitly allow null strings to be compared for equality as that is meaningful.
2015
+
2016
+ <div algorithm="js-string-equals">
2017
+
2018
+ When this builtin is invoked with parameters |first| and |second|, the following steps must be run:
2019
+
2020
+ 1. If |first| is not null and [=Type=] (|first|) is not [=String=]
2021
+ 1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
2022
+ 1. If |second| is not null and [=Type=] (|second|) is not [=String=]
2023
+ 1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
2024
+ 1. If [=!=] [=IsStrictlyEqual=] (|first|, |second|) is true
2025
+ 1. Return 1.
2026
+ 1. Return 0.
2027
+
2028
+ </div>
2011
2029
2012
2030
<h4 id="js-string-compare">compare</h4>
2013
2031
2014
- TODO
2032
+ The |funcType| of this builtin is `(func (param externref externref) (result i32))`.
2033
+
2034
+ <div algorithm="js-string-compare">
2035
+
2036
+ When this builtin is invoked with parameters |first| and |second|, the following steps must be run:
2037
+
2038
+ 1. Let |first| be [=?=] [$UnwrapString$] (|first|).
2039
+ 1. Let |second| be [=?=] [$UnwrapString$] (|second|).
2040
+ 1. If [=!=] [=IsStrictlyEqual=] (|first|, |second|) is true
2041
+ 1. Return 0.
2042
+ 1. If [=!=] [=IsLessThan=] (|first|, |second|, true) is true
2043
+ 1. Return -1.
2044
+ 1. Return 1.
2045
+
2046
+ </div>
2015
2047
2016
2048
<h2 id="errors">Error Condition Mappings to JavaScript</h2>
2017
2049
0 commit comments