Commit f3a0347
committed
#101: spec-compliance batch — Promise/RegExp/Object/Array/dispatch (+254 test262 passes)
Bundles ~30 ECMA-262 fidelity fixes across the compiled-mode emitters. Net
Test262 baseline movement: 7305 → 7559 passes (+254). All 10,321 unit
tests still pass.
Themes:
Promise (§27.2.4, §27.2.5)
• Promise.prototype.{then,catch,finally}.call(null|undefined) throws
TypeError per ToObject step 1; new EmitThrowIfNullOrUndefined helper.
• Promise.prototype.then validates IsPromise(promise) (only $TSPromise
/ Task<object>); throws TypeError otherwise per §27.2.5.4 step 2.
• catch/finally dispatch shape: fast path for real promises, user-then
invoke path for objects with custom `then` (spec §27.2.5.1 — catch
is `Invoke(this, "then", «undefined, onRejected»)`). User-then PDS
override on $TSPromise instances correctly diverts to user `then`.
• Promise.all/any/race/allSettled non-iterable receivers reject with
TypeError synchronously per §27.2.4.1 step 3.
• Promise.then onRejected paths use $Runtime.WrapException to unwrap
__tsValue / PromiseRejectedException.Reason / TargetInvocationException.
RegExp (§22.2)
• Sticky flag (`y`) honors lastIndex like global: requires match.Index
== lastIndex, resets to 0 on failure (§22.2.5.2.2 step 15.c.i).
Parity in both interpreter (SharpTSRegExp.Test) and compiler ($RegExp).
• String.split distinguishes null (coerces to "null" per 7.1.17) from
$Undefined.Instance (early-return per §22.1.3.21 step 4); callers
now push UndefinedInstance instead of "" for the no-separator case.
Object / Error prototypes (§10.1.6.3, §20.5.6.4)
• Native-error subclass prototypes: distinct TypeError.prototype /
RangeError.prototype / etc., each inheriting from Error.prototype,
populated lazily with constructor/name/message via PDS.
• Object.getPrototypeOf and the gOPD .prototype paths route every
native-error subclass first, with base $Error last (subclass Type
tokens are distinct from base; check order matters).
• defineProperty validation: accessor-redefine spec rule 7.b/7.c
(existing accessor + non-configurable + new Desc.[[Get]]/[[Set]]
must SameValue match existing); data-redefine writable=false uses
SameValue (Object.is) not Object.Equals so +0/-0 and NaN behave per
§7.2.10. BigInt and Symbol primitive descriptors are explicitly
rejected.
Dispatch identity
• Static-method bracket access (`Object["assign"]`, `Number["isNaN"]`,
`Array["from"]`) routes through TSFunctionGetOrCreate so it returns
the same $TSFunction wrapper as syntactic access. gOPD descriptors
on Object/Number/Array statics now use LookupBuiltInStaticMember for
value identity per test262 15.2.3.3-4-{14,15,…} probes.
• Math.random's descriptor synthesis can wire the actual MethodBuilder
(EmitRandom moved earlier than gOPD) for `desc.value === Math.random`.
Array iteration (§23.1.3)
• map/filter/forEach/find/findIndex/some/every cache len ONCE before
the loop (§23.1.3.X step 2) so callback-driven mutations to
list.Count don't shift iteration bounds. Per-iteration bounds re-
check routes truncated indices to each method's hole-handling label
(map preserves the hole; filter/some/every/forEach skip; find/
findIndex invoke predicate with undefined — fixed in prior commit).
• Void-returning prototype methods (forEach, split-no-sep, Map/Set
.forEach) emit UndefinedInstance instead of null so strict-equality
probes (`arr.forEach(cb) === undefined`) pass.
String methods
• indexOf/lastIndexOf now use ToJsString (handles undefined/symbols/
objects) instead of Castclass-to-string. Default-arg push is
"undefined" not "" per §22.1.3.8.
• Array-creating method receivers: pre-check length ≤ 2^32-1, throw
RangeError before any receiver-stack operation.
Test262 infra
• BatchedSubprocessRunner: each of the N worker slots now respawns
its worker subprocess after the 1.5GB memory ceiling triggers a
clean exit. Pre-fix, parallelism degraded 6→5→4→…→1 over an 11K-
test regen. Post-fix, all slots stay busy until the shared queue is
drained.
• SmokeTest.cs: Diagnostic_ClusterFixes test enumerating the test262
paths this batch targets for regression watch.
Tests: 10,321/10,321 passing. Test262 compiled baseline +254 net.1 parent 13b9794 commit f3a0347
33 files changed
Lines changed: 1659 additions & 453 deletions
File tree
- Compilation
- Emitters
- Runtime
- BuiltIns
- Types
- SharpTS.Test262
- baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
444 | 459 | | |
445 | 460 | | |
446 | 461 | | |
| |||
736 | 751 | | |
737 | 752 | | |
738 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
739 | 765 | | |
740 | 766 | | |
741 | 767 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | | - | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
111 | | - | |
| 114 | + | |
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
365 | 368 | | |
366 | 369 | | |
367 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1224 | 1224 | | |
1225 | 1225 | | |
1226 | 1226 | | |
1227 | | - | |
1228 | | - | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1229 | 1230 | | |
1230 | 1231 | | |
1231 | 1232 | | |
1232 | 1233 | | |
1233 | | - | |
1234 | | - | |
| 1234 | + | |
| 1235 | + | |
1235 | 1236 | | |
1236 | 1237 | | |
1237 | 1238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| |||
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
121 | | - | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
157 | | - | |
| 160 | + | |
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
0 commit comments