WebAssembly JS API: check and test in-call / out-call values
[WebKit-https.git] / JSTests / ChangeLog
1 2017-01-03  JF Bastien  <jfbastien@apple.com>
2
3         WebAssembly JS API: check and test in-call / out-call values
4         https://bugs.webkit.org/show_bug.cgi?id=164876
5         <rdar://problem/29844107>
6
7         Reviewed by Saam Barati.
8
9         * wasm.yaml:
10         * wasm/assert.js: add an assert for NaN comparison
11         * wasm/fuzz/export-function.js: Added. Generate random wasm export
12         signatures, and call them with random parameters.
13         (const.paramExporter):
14         (const.setBuffer):
15         (const.types.generate):
16         (generate):
17         * wasm/js-api/export-arity.js: Added.
18         (const.paramExporter): Test that mismatched arities when JS calls
19         wasm follow the defined semantics: i32 is 0, f32 / f64 are NaN.
20         https://github.com/WebAssembly/design/blob/master/JS.md#exported-function-exotic-objects
21         * wasm/js-api/export-void-is-undef.js: Added. Test that "void"
22         wasm functions return "undefined" in JS.
23
24 2017-01-02  JF Bastien  <jfbastien@apple.com>
25
26         WebAssembly: handle and optimize wasm export → wasm import calls
27         https://bugs.webkit.org/show_bug.cgi?id=165282
28
29         Reviewed by Saam Barati.
30
31         * wasm/Builder.js: Add a Proxy to Builder.js, which intercepts
32         unknown property lookups. This creates way better error messages
33         on typos than 'undefined is not a function', which happens
34         semi-frequently as I typo opcode names (and which one is a typo is
35         hard to find because we chain builders).
36         (const._isValidValue):
37         (get target):
38         (const._importFunctionContinuation):
39         (const._importMemoryContinuation):
40         (const._importTableContinuation):
41         (const._exportFunctionContinuation):
42         (export.default.Builder.prototype._registerSectionBuilders.const.section.in.WASM.description.section.switch.section.case.string_appeared_here.this.section):
43         (export.default.Builder.prototype._registerSectionBuilders.this.Unknown):
44         * wasm/LowLevelBinary.js: Add limited support for var{u}int64 (only the 32-bit values)
45         (export.default.LowLevelBinary.prototype.varint32):
46         (export.default.LowLevelBinary.prototype.varuint64):
47         (export.default.LowLevelBinary.prototype.varint64):
48         * wasm/function-tests/exceptions.js: update error message
49         * wasm/function-tests/trap-load.js: update error message
50         * wasm/function-tests/trap-store.js: update error message
51         * wasm/js-api/wasm-to-wasm-bad-signature.js: Added. Test a bunch of bad wasm->wasm import signatures
52         (const.makeImportee.signature.switch):
53         (BadSignatureDropStartParams):
54         * wasm/js-api/wasm-to-wasm.js: Added. Test 64-bit wasm->wasm import calls
55         (const.callerModule):
56         (const.calleeModule):
57         (WasmToWasm):
58
59 2017-01-02  Saam Barati  <sbarati@apple.com>
60
61         WebAssembly: Some loads don't take into account the offset
62         https://bugs.webkit.org/show_bug.cgi?id=166616
63         <rdar://problem/29841541>
64
65         Reviewed by Keith Miller.
66
67         * wasm/function-tests/load-offset.js: Added.
68
69 2016-12-29  Saam Barati  <sbarati@apple.com>
70
71         WebAssembly: Rebase spec-tests now that wabt has been updated to produce certain kinds of invalid modules
72         https://bugs.webkit.org/show_bug.cgi?id=166491
73         <rdar://problem/29814999>
74
75         Reviewed by Yusuke Suzuki.
76
77         Based off these revisions:
78         - spec: b055d01ea1dfdd7a5231ae779095435f836de97f
79         - wabt: d0d44702c753f851b094615298a2f4d4e3c21035
80
81         The reason for the rebase is that wabt was updated to stop
82         silently rejecting invalid modules. This was needed because
83         some of the spec tests check to make sure that the module
84         is invalid, but wabt was silently ignoring the errors and
85         generating valid modules:
86         https://github.com/WebAssembly/wabt/issues/256
87
88         * wasm.yaml:
89         * wasm/spec-tests/address.wast.js:
90         * wasm/spec-tests/binary.wast.js:
91         * wasm/spec-tests/block.wast.js:
92         * wasm/spec-tests/br.wast.js:
93         * wasm/spec-tests/br_if.wast.js:
94         * wasm/spec-tests/br_table.wast.js:
95         * wasm/spec-tests/break-drop.wast.js:
96         * wasm/spec-tests/call.wast.js:
97         * wasm/spec-tests/call_indirect.wast.js:
98         * wasm/spec-tests/comments.wast.js:
99         * wasm/spec-tests/conversions.wast.js:
100         * wasm/spec-tests/custom_section.wast.js:
101         * wasm/spec-tests/endianness.wast.js:
102         * wasm/spec-tests/exports.wast.js:
103         * wasm/spec-tests/f32.wast.js:
104         * wasm/spec-tests/f32_cmp.wast.js:
105         * wasm/spec-tests/f64.wast.js:
106         * wasm/spec-tests/f64_cmp.wast.js:
107         * wasm/spec-tests/fac.wast.js:
108         * wasm/spec-tests/float_exprs.wast.js:
109         * wasm/spec-tests/float_literals.wast.js:
110         * wasm/spec-tests/float_memory.wast.js:
111         * wasm/spec-tests/float_misc.wast.js:
112         * wasm/spec-tests/forward.wast.js:
113         * wasm/spec-tests/func.wast.js:
114         * wasm/spec-tests/func_ptrs.wast.js:
115         * wasm/spec-tests/get_local.wast.js:
116         * wasm/spec-tests/globals.wast.js:
117         * wasm/spec-tests/i32.wast.js:
118         * wasm/spec-tests/i64.wast.js:
119         * wasm/spec-tests/imports.wast.js:
120         * wasm/spec-tests/int_exprs.wast.js:
121         * wasm/spec-tests/int_literals.wast.js:
122         * wasm/spec-tests/left-to-right.wast.js:
123         * wasm/spec-tests/linking.wast.js:
124         * wasm/spec-tests/loop.wast.js:
125         * wasm/spec-tests/memory.wast.js:
126         * wasm/spec-tests/memory_redundancy.wast.js:
127         * wasm/spec-tests/memory_trap.wast.js:
128         * wasm/spec-tests/names.wast.js:
129         * wasm/spec-tests/nop.wast.js:
130         * wasm/spec-tests/resizing.wast.js:
131         * wasm/spec-tests/return.wast.js:
132         * wasm/spec-tests/select.wast.js:
133         * wasm/spec-tests/set_local.wast.js:
134         * wasm/spec-tests/skip-stack-guard-page.wast.js:
135         * wasm/spec-tests/stack.wast.js:
136         * wasm/spec-tests/start.wast.js:
137         * wasm/spec-tests/store_retval.wast.js:
138         * wasm/spec-tests/switch.wast.js:
139         * wasm/spec-tests/tee_local.wast.js:
140         * wasm/spec-tests/traps.wast.js:
141         * wasm/spec-tests/typecheck.wast.js:
142         * wasm/spec-tests/unreachable.wast.js:
143         * wasm/spec-tests/unwind.wast.js:
144
145 2016-12-28  Saam Barati  <sbarati@apple.com>
146
147         WebAssembly: Don't allow duplicate export names
148         https://bugs.webkit.org/show_bug.cgi?id=166490
149         <rdar://problem/29815000>
150
151         Reviewed by Keith Miller.
152
153         * wasm.yaml:
154         * wasm/function-tests/invalid-duplicate-export.js: Added.
155
156 2016-12-28  Saam Barati  <sbarati@apple.com>
157
158         WebAssembly: Implement grow_memory and current_memory
159         https://bugs.webkit.org/show_bug.cgi?id=166448
160         <rdar://problem/29803676>
161
162         Reviewed by Keith Miller.
163
164         I rewrote some of the testWasmModuleFunctions that used Memory to use
165         the JS API since the jsc.cpp version can no longer use memory.
166
167         * wasm.yaml:
168         * wasm/function-tests/add-12.js:
169         (testWasmModuleFunctions):
170         * wasm/function-tests/br-if-loop-less-than.js:
171         (testWasmModuleFunctions):
172         * wasm/function-tests/brTableAsIf.js:
173         (testWasmModuleFunctions):
174         * wasm/function-tests/brTableManyValues.js:
175         (testWasmModuleFunctions):
176         * wasm/function-tests/brTableWithLoop.js:
177         (testWasmModuleFunctions):
178         * wasm/function-tests/dumb-eq-if-then-else.js:
179         * wasm/function-tests/eqz.js:
180         * wasm/function-tests/grow-memory-2.js: Added.
181         (const.func):
182         (assert.eq.instance.exports.foo):
183         * wasm/function-tests/grow-memory-3.js: Added.
184         * wasm/function-tests/grow-memory-4.js: Added.
185         (const.func):
186         * wasm/function-tests/grow-memory.js: Added.
187         (binaryShouldNotParse):
188         (assert.truthy):
189         (assert.eq):
190         (memory.grow):
191         * wasm/function-tests/i32-load.js:
192         (testWasmModuleFunctions):
193         * wasm/function-tests/i32-load8-s.js:
194         * wasm/function-tests/max.js:
195         * wasm/function-tests/min.js:
196         * wasm/js-api/memory-grow.js: Added.
197         (i.i):
198         (assertEq):
199         * wasm/js-api/test_memory.js:
200         * wasm/wasm.json:
201
202 2016-12-25  Yusuke Suzuki  <utatane.tea@gmail.com>
203
204         Propagate the source origin as much as possible
205         https://bugs.webkit.org/show_bug.cgi?id=166348
206
207         Reviewed by Darin Adler.
208
209         * stress/source-origin.js: Added.
210         (shouldBe):
211
212 2016-12-24  Caio Lima  <ticaiolima@gmail.com>
213
214         [test262] Fixing mapped arguments object property test case
215         https://bugs.webkit.org/show_bug.cgi?id=159398
216
217         Reviewed by Saam Barati.
218
219         * stress/arguments-bizarre-behaviour-disable-enumerability.js:
220         * stress/arguments-define-property.js: Added.
221         (assert):
222         (testProperties):
223         * stress/arguments-non-configurable.js: Added.
224         (assert):
225         (tryChangeNonConfigurableDescriptor):
226         (set tryChangeNonConfigurableDescriptor):
227         (tryChangeWritableOfNonConfigurableDescriptor):
228         * test262.yaml:
229
230 016-12-20  Caio Lima  <ticaiolima@gmail.com>
231
232         [test262] Fixing mapped arguments object property test case
233         https://bugs.webkit.org/show_bug.cgi?id=159398
234
235         Reviewed by .
236
237         * stress/arguments-bizarre-behaviour-disable-enumerability.js:
238         * stress/arguments-define-property.js: Added.
239         (assert):
240         (testProperties):
241         * stress/arguments-non-configurable.js: Added.
242         (assert):
243         (tryChangeNonConfigurableDescriptor):
244         (set tryChangeNonConfigurableDescriptor):
245         (tryChangeWritableOfNonConfigurableDescriptor):
246         * test262.yaml:
247
248 2016-12-23  Keith Miller  <keith_miller@apple.com>
249
250         WebAssembly: trap on bad division.
251         https://bugs.webkit.org/show_bug.cgi?id=164786
252
253         Reviewed by Mark Lam.
254
255         Also, mark conversions as passing.
256
257         * wasm.yaml:
258         * wasm/wasm.json:
259
260 2016-12-22  Keith Miller  <keith_miller@apple.com>
261
262         WebAssembly: Make spec-tests/f32.wast.js and spec-tests/f64.wast.js pass
263         https://bugs.webkit.org/show_bug.cgi?id=166447
264
265         Reviewed by Saam Barati.
266
267         * wasm.yaml:
268         * wasm/wasm.json:
269
270 2016-12-22  Saam Barati  <sbarati@apple.com>
271
272         WebAssembly: Make calling Wasm functions that returns or takes an i64 as a parameter an early exception
273         https://bugs.webkit.org/show_bug.cgi?id=166437
274         <rdar://problem/29793949>
275
276         Reviewed by Keith Miller.
277
278         * wasm.yaml:
279         * wasm/function-tests/i64-from-js-exceptions.js: Added.
280         (const.imp.import.sideEffects):
281         (assert.throws.instance.exports.foo.valueOf):
282
283 2016-12-22  Mark Lam  <mark.lam@apple.com>
284
285         De-duplicate finally blocks.
286         https://bugs.webkit.org/show_bug.cgi?id=160168
287
288         Reviewed by Saam Barati.
289
290         Re-landing r209952 with a few new tests added in test-finally.js.
291
292         * stress/deeply-nested-finallys.js: Copied from JSTests/stress/deeply-nested-finallys.js.
293         - Tests many levels of finally nesting.  This causes the old code to hang (and
294           crashes eventually) while trying to generate bytecode for the exponentially
295           duplicated finally blocks.  The new code completes this test almost instantly.
296
297         * stress/test-finally.js: Copied from JSTests/stress/test-finally.js.
298         - Tests control flow through various permutations of finally blocks.
299
300 2016-12-22  Saam Barati  <sbarati@apple.com>
301
302         WebAssembly: Make the spec-tests/address.wast.js test pass
303         https://bugs.webkit.org/show_bug.cgi?id=166429
304         <rdar://problem/29793220>
305
306         Reviewed by Keith Miller.
307
308         * wasm.yaml:
309
310 2016-12-22  Keith Miller  <keith_miller@apple.com>
311
312         WebAssembly: The validator should not allow unused stack entries at the end of a block
313         https://bugs.webkit.org/show_bug.cgi?id=166411
314
315         Reviewed by Saam Barati.
316
317         Test cleanup and enable new passing tests.
318
319         * wasm.yaml:
320         * wasm/function-tests/br-if-as-return.js:
321
322 2016-12-22  Saam Barati  <sbarati@apple.com>
323
324         WebAssembly: Make the spec-tests/start.wast.js test pass
325         https://bugs.webkit.org/show_bug.cgi?id=166416
326         <rdar://problem/29784532>
327
328         Reviewed by Yusuke Suzuki.
329
330         * wasm.yaml:
331
332 2016-12-21  Keith Miller  <keith_miller@apple.com>
333
334         WebAssembly: Fix decode floating point constants in unreachable code
335         https://bugs.webkit.org/show_bug.cgi?id=166400
336
337         Reviewed by Saam Barati.
338
339         * wasm.yaml:
340
341 2016-12-21  Keith Miller  <keith_miller@apple.com>
342
343         WebAssembly: Allow br, br_if, and br_table to act as a return
344         https://bugs.webkit.org/show_bug.cgi?id=166393
345
346         Reviewed by Saam Barati.
347
348         Add tests for breaks acting as returns and fix tests that
349         validate error messages.
350
351         * wasm/function-tests/br-as-return.js: Added.
352         * wasm/function-tests/br-if-as-return.js: Added.
353         * wasm/function-tests/br-table-as-return.js: Added.
354         * wasm/function-tests/if-no-else-non-void.js:
355         * wasm/function-tests/struct.js: Added.
356         * wasm/js-api/global-error.js:
357         (assert.throws):
358         * wasm/js-api/table.js:
359         (assert.throws):
360
361 2016-12-21  Saam Barati  <sbarati@apple.com>
362
363         WebAssembly: Import spec tests
364         https://bugs.webkit.org/show_bug.cgi?id=166395
365
366         Rubber stamped by Keith Miller.
367
368         This patch implements the Wasm spec's tests found here:
369         https://github.com/WebAssembly/spec/tree/master/interpreter/test
370         
371         These tests are in .wast s-epxression format. To convert
372         them to JS, I use a script from the wabt library, found here:
373         https://github.com/WebAssembly/wabt/blob/master/test/run-gen-spec-js.py
374         
375         I also added a script that automatically imports the tests as
376         JS files. The inputs to the script is the path to the Wasm spec
377         git repo and the path to the wabt git repo. This will make importing
378         new tests easy in the future.
379
380         The wasm spec imported is at commit: b055d01ea1dfdd7a5231ae779095435f836de97f
381         The wabt used to do the import is at commit: 622b42dced6d793e9d49e9b1fd1d1524defd1387
382
383         * wasm.yaml:
384         * wasm/import-spec-tests.rb: Added.
385         * wasm/spec-tests: Added.
386         * wasm/spec-tests/address.wast.js: Added.
387         (register):
388         (module):
389         (instance):
390         (assert_malformed):
391         (assert_invalid):
392         (assert_soft_invalid):
393         (assert_unlinkable):
394         (assert_uninstantiable):
395         (assert_trap):
396         (assert_return):
397         (assert_return_nan):
398         * wasm/spec-tests/binary.wast.js: Added.
399         (register):
400         (module):
401         (instance):
402         (assert_malformed):
403         (assert_invalid):
404         (assert_soft_invalid):
405         (assert_unlinkable):
406         (assert_uninstantiable):
407         (assert_trap):
408         (assert_return):
409         (assert_return_nan):
410         * wasm/spec-tests/block.wast.js: Added.
411         (register):
412         (module):
413         (instance):
414         (assert_malformed):
415         (assert_invalid):
416         (assert_soft_invalid):
417         (assert_unlinkable):
418         (assert_uninstantiable):
419         (assert_trap):
420         (assert_return):
421         (assert_return_nan):
422         * wasm/spec-tests/br.wast.js: Added.
423         (register):
424         (module):
425         (instance):
426         (assert_malformed):
427         (assert_invalid):
428         (assert_soft_invalid):
429         (assert_unlinkable):
430         (assert_uninstantiable):
431         (assert_trap):
432         (assert_return):
433         (assert_return_nan):
434         * wasm/spec-tests/br_if.wast.js: Added.
435         (register):
436         (module):
437         (instance):
438         (assert_malformed):
439         (assert_invalid):
440         (assert_soft_invalid):
441         (assert_unlinkable):
442         (assert_uninstantiable):
443         (assert_trap):
444         (assert_return):
445         (assert_return_nan):
446         * wasm/spec-tests/br_table.wast.js: Added.
447         (register):
448         (module):
449         (instance):
450         (assert_malformed):
451         (assert_invalid):
452         (assert_soft_invalid):
453         (assert_unlinkable):
454         (assert_uninstantiable):
455         (assert_trap):
456         (assert_return):
457         (assert_return_nan):
458         * wasm/spec-tests/break-drop.wast.js: Added.
459         (register):
460         (module):
461         (instance):
462         (assert_malformed):
463         (assert_invalid):
464         (assert_soft_invalid):
465         (assert_unlinkable):
466         (assert_uninstantiable):
467         (assert_trap):
468         (assert_return):
469         (assert_return_nan):
470         * wasm/spec-tests/call.wast.js: Added.
471         (register):
472         (module):
473         (instance):
474         (assert_malformed):
475         (assert_invalid):
476         (assert_soft_invalid):
477         (assert_unlinkable):
478         (assert_uninstantiable):
479         (assert_trap):
480         (assert_return):
481         (assert_return_nan):
482         * wasm/spec-tests/call_indirect.wast.js: Added.
483         (register):
484         (module):
485         (instance):
486         (assert_malformed):
487         (assert_invalid):
488         (assert_soft_invalid):
489         (assert_unlinkable):
490         (assert_uninstantiable):
491         (assert_trap):
492         (assert_return):
493         (assert_return_nan):
494         * wasm/spec-tests/comments.wast.js: Added.
495         (register):
496         (module):
497         (instance):
498         (assert_malformed):
499         (assert_invalid):
500         (assert_soft_invalid):
501         (assert_unlinkable):
502         (assert_uninstantiable):
503         (assert_trap):
504         (assert_return):
505         (assert_return_nan):
506         * wasm/spec-tests/conversions.wast.js: Added.
507         (register):
508         (module):
509         (instance):
510         (assert_malformed):
511         (assert_invalid):
512         (assert_soft_invalid):
513         (assert_unlinkable):
514         (assert_uninstantiable):
515         (assert_trap):
516         (assert_return):
517         (assert_return_nan):
518         * wasm/spec-tests/custom_section.wast.js: Added.
519         (register):
520         (module):
521         (instance):
522         (assert_malformed):
523         (assert_invalid):
524         (assert_soft_invalid):
525         (assert_unlinkable):
526         (assert_uninstantiable):
527         (assert_trap):
528         (assert_return):
529         (assert_return_nan):
530         * wasm/spec-tests/endianness.wast.js: Added.
531         (register):
532         (module):
533         (instance):
534         (assert_malformed):
535         (assert_invalid):
536         (assert_soft_invalid):
537         (assert_unlinkable):
538         (assert_uninstantiable):
539         (assert_trap):
540         (assert_return):
541         (assert_return_nan):
542         * wasm/spec-tests/exports.wast.js: Added.
543         (register):
544         (module):
545         (instance):
546         (assert_malformed):
547         (assert_invalid):
548         (assert_soft_invalid):
549         (assert_unlinkable):
550         (assert_uninstantiable):
551         (assert_trap):
552         (assert_return):
553         (assert_return_nan):
554         * wasm/spec-tests/f32.wast.js: Added.
555         (register):
556         (module):
557         (instance):
558         (assert_malformed):
559         (assert_invalid):
560         (assert_soft_invalid):
561         (assert_unlinkable):
562         (assert_uninstantiable):
563         (assert_trap):
564         (assert_return):
565         (assert_return_nan):
566         * wasm/spec-tests/f32_cmp.wast.js: Added.
567         (register):
568         (module):
569         (instance):
570         (assert_malformed):
571         (assert_invalid):
572         (assert_soft_invalid):
573         (assert_unlinkable):
574         (assert_uninstantiable):
575         (assert_trap):
576         (assert_return):
577         (assert_return_nan):
578         * wasm/spec-tests/f64.wast.js: Added.
579         (register):
580         (module):
581         (instance):
582         (assert_malformed):
583         (assert_invalid):
584         (assert_soft_invalid):
585         (assert_unlinkable):
586         (assert_uninstantiable):
587         (assert_trap):
588         (assert_return):
589         (assert_return_nan):
590         * wasm/spec-tests/f64_cmp.wast.js: Added.
591         (register):
592         (module):
593         (instance):
594         (assert_malformed):
595         (assert_invalid):
596         (assert_soft_invalid):
597         (assert_unlinkable):
598         (assert_uninstantiable):
599         (assert_trap):
600         (assert_return):
601         (assert_return_nan):
602         * wasm/spec-tests/fac.wast.js: Added.
603         (register):
604         (module):
605         (instance):
606         (assert_malformed):
607         (assert_invalid):
608         (assert_soft_invalid):
609         (assert_unlinkable):
610         (assert_uninstantiable):
611         (assert_trap):
612         (assert_return):
613         (assert_return_nan):
614         * wasm/spec-tests/float_exprs.wast.js: Added.
615         (register):
616         (module):
617         (instance):
618         (assert_malformed):
619         (assert_invalid):
620         (assert_soft_invalid):
621         (assert_unlinkable):
622         (assert_uninstantiable):
623         (assert_trap):
624         (assert_return):
625         (assert_return_nan):
626         * wasm/spec-tests/float_literals.wast.js: Added.
627         (register):
628         (module):
629         (instance):
630         (assert_malformed):
631         (assert_invalid):
632         (assert_soft_invalid):
633         (assert_unlinkable):
634         (assert_uninstantiable):
635         (assert_trap):
636         (assert_return):
637         (assert_return_nan):
638         * wasm/spec-tests/float_memory.wast.js: Added.
639         (register):
640         (module):
641         (instance):
642         (assert_malformed):
643         (assert_invalid):
644         (assert_soft_invalid):
645         (assert_unlinkable):
646         (assert_uninstantiable):
647         (assert_trap):
648         (assert_return):
649         (assert_return_nan):
650         * wasm/spec-tests/float_misc.wast.js: Added.
651         (register):
652         (module):
653         (instance):
654         (assert_malformed):
655         (assert_invalid):
656         (assert_soft_invalid):
657         (assert_unlinkable):
658         (assert_uninstantiable):
659         (assert_trap):
660         (assert_return):
661         (assert_return_nan):
662         * wasm/spec-tests/forward.wast.js: Added.
663         (register):
664         (module):
665         (instance):
666         (assert_malformed):
667         (assert_invalid):
668         (assert_soft_invalid):
669         (assert_unlinkable):
670         (assert_uninstantiable):
671         (assert_trap):
672         (assert_return):
673         (assert_return_nan):
674         * wasm/spec-tests/func.wast.js: Added.
675         (register):
676         (module):
677         (instance):
678         (assert_malformed):
679         (assert_invalid):
680         (assert_soft_invalid):
681         (assert_unlinkable):
682         (assert_uninstantiable):
683         (assert_trap):
684         (assert_return):
685         (assert_return_nan):
686         * wasm/spec-tests/func_ptrs.wast.js: Added.
687         (register):
688         (module):
689         (instance):
690         (assert_malformed):
691         (assert_invalid):
692         (assert_soft_invalid):
693         (assert_unlinkable):
694         (assert_uninstantiable):
695         (assert_trap):
696         (assert_return):
697         (assert_return_nan):
698         * wasm/spec-tests/get_local.wast.js: Added.
699         (register):
700         (module):
701         (instance):
702         (assert_malformed):
703         (assert_invalid):
704         (assert_soft_invalid):
705         (assert_unlinkable):
706         (assert_uninstantiable):
707         (assert_trap):
708         (assert_return):
709         (assert_return_nan):
710         * wasm/spec-tests/globals.wast.js: Added.
711         (register):
712         (module):
713         (instance):
714         (assert_malformed):
715         (assert_invalid):
716         (assert_soft_invalid):
717         (assert_unlinkable):
718         (assert_uninstantiable):
719         (assert_trap):
720         (assert_return):
721         (assert_return_nan):
722         * wasm/spec-tests/i32.wast.js: Added.
723         (register):
724         (module):
725         (instance):
726         (assert_malformed):
727         (assert_invalid):
728         (assert_soft_invalid):
729         (assert_unlinkable):
730         (assert_uninstantiable):
731         (assert_trap):
732         (assert_return):
733         (assert_return_nan):
734         * wasm/spec-tests/i64.wast.js: Added.
735         (register):
736         (module):
737         (instance):
738         (assert_malformed):
739         (assert_invalid):
740         (assert_soft_invalid):
741         (assert_unlinkable):
742         (assert_uninstantiable):
743         (assert_trap):
744         (assert_return):
745         (assert_return_nan):
746         * wasm/spec-tests/imports.wast.js: Added.
747         (register):
748         (module):
749         (instance):
750         (assert_malformed):
751         (assert_invalid):
752         (assert_soft_invalid):
753         (assert_unlinkable):
754         (assert_uninstantiable):
755         (assert_trap):
756         (assert_return):
757         (assert_return_nan):
758         * wasm/spec-tests/int_exprs.wast.js: Added.
759         (register):
760         (module):
761         (instance):
762         (assert_malformed):
763         (assert_invalid):
764         (assert_soft_invalid):
765         (assert_unlinkable):
766         (assert_uninstantiable):
767         (assert_trap):
768         (assert_return):
769         (assert_return_nan):
770         * wasm/spec-tests/int_literals.wast.js: Added.
771         (register):
772         (module):
773         (instance):
774         (assert_malformed):
775         (assert_invalid):
776         (assert_soft_invalid):
777         (assert_unlinkable):
778         (assert_uninstantiable):
779         (assert_trap):
780         (assert_return):
781         (assert_return_nan):
782         * wasm/spec-tests/left-to-right.wast.js: Added.
783         (register):
784         (module):
785         (instance):
786         (assert_malformed):
787         (assert_invalid):
788         (assert_soft_invalid):
789         (assert_unlinkable):
790         (assert_uninstantiable):
791         (assert_trap):
792         (assert_return):
793         (assert_return_nan):
794         * wasm/spec-tests/linking.wast.js: Added.
795         (register):
796         (module):
797         (instance):
798         (assert_malformed):
799         (assert_invalid):
800         (assert_soft_invalid):
801         (assert_unlinkable):
802         (assert_uninstantiable):
803         (assert_trap):
804         (assert_return):
805         (assert_return_nan):
806         * wasm/spec-tests/loop.wast.js: Added.
807         (register):
808         (module):
809         (instance):
810         (assert_malformed):
811         (assert_invalid):
812         (assert_soft_invalid):
813         (assert_unlinkable):
814         (assert_uninstantiable):
815         (assert_trap):
816         (assert_return):
817         (assert_return_nan):
818         * wasm/spec-tests/memory.wast.js: Added.
819         (register):
820         (module):
821         (instance):
822         (assert_malformed):
823         (assert_invalid):
824         (assert_soft_invalid):
825         (assert_unlinkable):
826         (assert_uninstantiable):
827         (assert_trap):
828         (assert_return):
829         (assert_return_nan):
830         * wasm/spec-tests/memory_redundancy.wast.js: Added.
831         (register):
832         (module):
833         (instance):
834         (assert_malformed):
835         (assert_invalid):
836         (assert_soft_invalid):
837         (assert_unlinkable):
838         (assert_uninstantiable):
839         (assert_trap):
840         (assert_return):
841         (assert_return_nan):
842         * wasm/spec-tests/memory_trap.wast.js: Added.
843         (register):
844         (module):
845         (instance):
846         (assert_malformed):
847         (assert_invalid):
848         (assert_soft_invalid):
849         (assert_unlinkable):
850         (assert_uninstantiable):
851         (assert_trap):
852         (assert_return):
853         (assert_return_nan):
854         * wasm/spec-tests/names.wast.js: Added.
855         (register):
856         (module):
857         (instance):
858         (assert_malformed):
859         (assert_invalid):
860         (assert_soft_invalid):
861         (assert_unlinkable):
862         (assert_uninstantiable):
863         (assert_trap):
864         (assert_return):
865         (assert_return_nan):
866         * wasm/spec-tests/nop.wast.js: Added.
867         (register):
868         (module):
869         (instance):
870         (assert_malformed):
871         (assert_invalid):
872         (assert_soft_invalid):
873         (assert_unlinkable):
874         (assert_uninstantiable):
875         (assert_trap):
876         (assert_return):
877         (assert_return_nan):
878         * wasm/spec-tests/resizing.wast.js: Added.
879         (register):
880         (module):
881         (instance):
882         (assert_malformed):
883         (assert_invalid):
884         (assert_soft_invalid):
885         (assert_unlinkable):
886         (assert_uninstantiable):
887         (assert_trap):
888         (assert_return):
889         (assert_return_nan):
890         * wasm/spec-tests/return.wast.js: Added.
891         (register):
892         (module):
893         (instance):
894         (assert_malformed):
895         (assert_invalid):
896         (assert_soft_invalid):
897         (assert_unlinkable):
898         (assert_uninstantiable):
899         (assert_trap):
900         (assert_return):
901         (assert_return_nan):
902         * wasm/spec-tests/select.wast.js: Added.
903         (register):
904         (module):
905         (instance):
906         (assert_malformed):
907         (assert_invalid):
908         (assert_soft_invalid):
909         (assert_unlinkable):
910         (assert_uninstantiable):
911         (assert_trap):
912         (assert_return):
913         (assert_return_nan):
914         * wasm/spec-tests/set_local.wast.js: Added.
915         (register):
916         (module):
917         (instance):
918         (assert_malformed):
919         (assert_invalid):
920         (assert_soft_invalid):
921         (assert_unlinkable):
922         (assert_uninstantiable):
923         (assert_trap):
924         (assert_return):
925         (assert_return_nan):
926         * wasm/spec-tests/skip-stack-guard-page.wast.js: Added.
927         (register):
928         (module):
929         (instance):
930         (assert_malformed):
931         (assert_invalid):
932         (assert_soft_invalid):
933         (assert_unlinkable):
934         (assert_uninstantiable):
935         (assert_trap):
936         (assert_return):
937         (assert_return_nan):
938         * wasm/spec-tests/stack.wast.js: Added.
939         (register):
940         (module):
941         (instance):
942         (assert_malformed):
943         (assert_invalid):
944         (assert_soft_invalid):
945         (assert_unlinkable):
946         (assert_uninstantiable):
947         (assert_trap):
948         (assert_return):
949         (assert_return_nan):
950         * wasm/spec-tests/start.wast.js: Added.
951         (register):
952         (module):
953         (instance):
954         (assert_malformed):
955         (assert_invalid):
956         (assert_soft_invalid):
957         (assert_unlinkable):
958         (assert_uninstantiable):
959         (assert_trap):
960         (assert_return):
961         (assert_return_nan):
962         * wasm/spec-tests/store_retval.wast.js: Added.
963         (register):
964         (module):
965         (instance):
966         (assert_malformed):
967         (assert_invalid):
968         (assert_soft_invalid):
969         (assert_unlinkable):
970         (assert_uninstantiable):
971         (assert_trap):
972         (assert_return):
973         (assert_return_nan):
974         * wasm/spec-tests/switch.wast.js: Added.
975         (register):
976         (module):
977         (instance):
978         (assert_malformed):
979         (assert_invalid):
980         (assert_soft_invalid):
981         (assert_unlinkable):
982         (assert_uninstantiable):
983         (assert_trap):
984         (assert_return):
985         (assert_return_nan):
986         * wasm/spec-tests/tee_local.wast.js: Added.
987         (register):
988         (module):
989         (instance):
990         (assert_malformed):
991         (assert_invalid):
992         (assert_soft_invalid):
993         (assert_unlinkable):
994         (assert_uninstantiable):
995         (assert_trap):
996         (assert_return):
997         (assert_return_nan):
998         * wasm/spec-tests/traps.wast.js: Added.
999         (register):
1000         (module):
1001         (instance):
1002         (assert_malformed):
1003         (assert_invalid):
1004         (assert_soft_invalid):
1005         (assert_unlinkable):
1006         (assert_uninstantiable):
1007         (assert_trap):
1008         (assert_return):
1009         (assert_return_nan):
1010         * wasm/spec-tests/typecheck.wast.js: Added.
1011         (register):
1012         (module):
1013         (instance):
1014         (assert_malformed):
1015         (assert_invalid):
1016         (assert_soft_invalid):
1017         (assert_unlinkable):
1018         (assert_uninstantiable):
1019         (assert_trap):
1020         (assert_return):
1021         (assert_return_nan):
1022         * wasm/spec-tests/unreachable.wast.js: Added.
1023         (register):
1024         (module):
1025         (instance):
1026         (assert_malformed):
1027         (assert_invalid):
1028         (assert_soft_invalid):
1029         (assert_unlinkable):
1030         (assert_uninstantiable):
1031         (assert_trap):
1032         (assert_return):
1033         (assert_return_nan):
1034         * wasm/spec-tests/unwind.wast.js: Added.
1035         (register):
1036         (module):
1037         (instance):
1038         (assert_malformed):
1039         (assert_invalid):
1040         (assert_soft_invalid):
1041         (assert_unlinkable):
1042         (assert_uninstantiable):
1043         (assert_trap):
1044         (assert_return):
1045         (assert_return_nan):
1046
1047 2016-12-20  Keith Miller  <keith_miller@apple.com>
1048
1049         Add support for global
1050         https://bugs.webkit.org/show_bug.cgi?id=165171
1051
1052         Reviewed by Filip Pizlo.
1053
1054         * stress/global.js: Added.
1055
1056 2016-12-20  JF Bastien  <jfbastien@apple.com>
1057
1058         WebAssembly API: implement WebAssembly.LinkError
1059         https://bugs.webkit.org/show_bug.cgi?id=165805
1060         <rdar://problem/29747874>
1061
1062         Reviewed by Mark lam.
1063
1064         Update all exception sites which now throw WebAssembly.LinkError.
1065
1066         * wasm/js-api/element-data.js:
1067         * wasm/js-api/element.js:
1068         (assert.throws):
1069         * wasm/js-api/global-error.js:
1070         (new.Number):
1071         * wasm/js-api/table.js:
1072         (assert.throws):
1073         (new.WebAssembly.Table):
1074         * wasm/js-api/test_Data.js:
1075         * wasm/js-api/test_basic_api.js:
1076         (const.c.in.constructorProperties.switch):
1077         * wasm/js-api/test_memory.js:
1078         (test):
1079         (test.testMemImportError): Deleted.
1080
1081 2016-12-20  JF Bastien  <jfbastien@apple.com>
1082
1083         WebAssembly: unique function signatures
1084         https://bugs.webkit.org/show_bug.cgi?id=165957
1085         <rdar://problem/29735737>
1086
1087         Reviewed by Saam Barati.
1088
1089         * wasm/function-tests/table-basic.js: FIXME is now addressed,
1090         though instance to instance calls still need work which bug
1091         #165282 will address
1092         (i.assert.eq.foo):
1093         * wasm/js-api/unique-signature.js: Added.
1094         (CallIndirectWithDuplicateSignatures):
1095
1096 2016-12-19  Mark Lam  <mark.lam@apple.com>
1097
1098         Rolling out r209974 and r209952. They break some websites in mysterious ways. Step 2: Rollout r209952.
1099         https://bugs.webkit.org/show_bug.cgi?id=166049
1100
1101         Not reviewed.
1102
1103         * stress/deeply-nested-finallys.js: Removed.
1104         * stress/test-finally.js: Removed.
1105
1106 2016-12-19  Saam Barati  <sbarati@apple.com>
1107
1108         WebAssembly: Make running Wasm tests take less time by reducing some tests' iteration count and by splitting some tests into different files
1109         https://bugs.webkit.org/show_bug.cgi?id=166017
1110
1111         Reviewed by Yusuke Suzuki.
1112
1113         * wasm/function-tests/trap-load-2.js: Added.
1114         (assert):
1115         (wasmFrameCountFromError):
1116         (continuation):
1117         (i.catch):
1118         * wasm/function-tests/trap-load.js:
1119         (assert.continuation): Deleted.
1120         * wasm/function-tests/trap-store-2.js: Added.
1121         (import.Builder.from.string_appeared_here.assert):
1122         (continuation):
1123         (i.catch):
1124         * wasm/function-tests/trap-store.js:
1125         (assert.continuation): Deleted.
1126         (assert): Deleted.
1127         * wasm/js-api/test_memory.js:
1128         (test):
1129
1130 2016-12-18  Saam Barati  <sbarati@apple.com>
1131
1132         WebAssembly: Implement the WebAssembly.compile and WebAssembly.validate
1133         https://bugs.webkit.org/show_bug.cgi?id=165936
1134
1135         Reviewed by Mark Lam.
1136
1137         * wasm/js-api/Module-compile.js: Added.
1138         (async.testPromiseAPI):
1139         * wasm/js-api/test_basic_api.js:
1140         (const.c.in.constructorProperties.switch):
1141         * wasm/js-api/validate.js: Added.
1142         (assert.truthy.WebAssembly.validate.builder.WebAssembly):
1143
1144 2016-12-16  Mark Lam  <mark.lam@apple.com>
1145
1146         De-duplicate finally blocks.
1147         https://bugs.webkit.org/show_bug.cgi?id=160168
1148
1149         Reviewed by Keith Miller.
1150
1151         * stress/deeply-nested-finallys.js: Added.
1152         - Tests many levels of finally nesting.  This causes the old code to hang (and
1153           crashes eventually) while trying to generate bytecode for the exponentially
1154           duplicated finally blocks.  The new code completes this test almost instantly.
1155
1156         * stress/test-finally.js: Added.
1157         - Tests control flow through various permutations of finally blocks.
1158
1159 2016-12-16  Saam Barati  <sbarati@apple.com>
1160
1161         WebAssembly: WasmB3IRGenerator should throw exceptions instead of crash
1162         https://bugs.webkit.org/show_bug.cgi?id=165834
1163
1164         Reviewed by Keith Miller.
1165
1166         * wasm/function-tests/exceptions.js: Added.
1167         (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
1168         * wasm/function-tests/table-basic.js:
1169         (i.i.42.throw.new.Error):
1170
1171 2016-12-16  Keith Miller  <keith_miller@apple.com>
1172
1173         i64.eqz should use an Int64 zero
1174         https://bugs.webkit.org/show_bug.cgi?id=165942
1175
1176         Reviewed by Mark Lam.
1177
1178         * wasm/wasm.json:
1179
1180 2016-12-15  Keith Miller  <keith_miller@apple.com>
1181
1182         Fix validation of non-void if blocks with no else
1183         https://bugs.webkit.org/show_bug.cgi?id=165938
1184
1185         Reviewed by Saam Barati.
1186
1187         Add a new failing test and a fix an existing one.
1188
1189         * wasm/function-tests/dead-call.js:
1190         * wasm/function-tests/if-no-else-non-void.js: Added.
1191
1192 2016-12-15  Keith Miller  <keith_miller@apple.com>
1193
1194         Wasm should not create empty unlinked callsites
1195         https://bugs.webkit.org/show_bug.cgi?id=165933
1196
1197         Reviewed by Mark Lam.
1198
1199         * wasm/function-tests/dead-call.js: Added.
1200
1201 2016-12-15  JF Bastien  <jfbastien@apple.com>
1202
1203         WebAssembly: improve compilation error messages
1204         https://bugs.webkit.org/show_bug.cgi?id=163919
1205
1206         Reviewed by Saam Barati.
1207
1208         Update error messages in these tests.
1209         Use the assert.throws facility in many of them which weren't already.
1210
1211         * wasm/js-api/element.js:
1212         (assert.throws.new.WebAssembly.Module.builder.WebAssembly):
1213         (assert.throws):
1214         * wasm/js-api/global-error.js:
1215         (assert.throws.new.WebAssembly.Module.bin):
1216         (assert.throws):
1217         (new.Number):
1218         * wasm/js-api/table.js:
1219         (assert.throws.new.WebAssembly.Module.builder.WebAssembly):
1220         (assert.throws):
1221         (assertBadTableImport):
1222         * wasm/js-api/test_Data.js:
1223         (DataSectionWithoutMemory):
1224         * wasm/js-api/test_Start.js:
1225         (InvalidStartFunctionIndex):
1226         * wasm/js-api/test_basic_api.js:
1227         (const.c.in.constructorProperties.switch):
1228
1229 2016-12-15  JF Bastien  <jfbastien@apple.com>
1230
1231         WebAssembly API: improve data section errors
1232         https://bugs.webkit.org/show_bug.cgi?id=165733
1233
1234         Reviewed by Keith Miller.
1235
1236         * wasm/js-api/element-data.js: Added.
1237         (ElementBeforeData.set const):
1238         (ElementBeforeData): check the order of initialization, which is observable on failure
1239         * wasm/js-api/test_Data.js:
1240         (DataSectionWithoutMemory):
1241         (DataSectionOffTheEnd): Deleted.
1242         (DataSectionPartlyOffTheEnd): Deleted.
1243         (DataSectionEmptyOffTheEnd): Deleted.
1244         (DataSectionSeenByStart): Deleted.
1245
1246 2016-12-15  Keith Miller  <keith_miller@apple.com>
1247
1248         Fix 64-bit shift family Wasm opcodes
1249         https://bugs.webkit.org/show_bug.cgi?id=165902
1250
1251         Reviewed by Geoffrey Garen.
1252
1253         Add tests for shift family of instructions. Since
1254         we can't generate i64 values to pass to wasm we only compile
1255         the code for those functions. Attempting to generate any i64
1256         code using these instructions would have been enough to cause
1257         the B3 Validation error anyway.
1258
1259         * wasm/assert.js:
1260         * wasm/function-tests/rotl.js: Added.
1261         * wasm/function-tests/rotr.js: Added.
1262         * wasm/function-tests/shl.js: Added.
1263         * wasm/function-tests/shr-s.js: Added.
1264         * wasm/function-tests/shr-u.js: Added.
1265         * wasm/wasm.json:
1266
1267 2016-12-14  Keith Miller  <keith_miller@apple.com>
1268
1269         WebAssembly: test_BuilderJSON.js is broken
1270         https://bugs.webkit.org/show_bug.cgi?id=165893
1271
1272         Reviewed by Michael Saboff.
1273
1274         * wasm/Builder.js:
1275         (const._isValidValue):
1276         * wasm/self-test/test_BuilderJSON.js:
1277
1278 2016-12-14  Keith Miller  <keith_miller@apple.com>
1279
1280         Unreviewed, fix test.
1281
1282         * wasm/function-tests/i32-const.js:
1283
1284 2016-12-14  Keith Miller  <keith_miller@apple.com>
1285
1286         Wasm should decode constants correctly
1287         https://bugs.webkit.org/show_bug.cgi?id=165886
1288
1289         Reviewed by Saam Barati.
1290
1291         * wasm/Builder.js:
1292         (const._isValidValue):
1293         * wasm/Builder_WebAssemblyBinary.js:
1294         (const.putOp):
1295         * wasm/LowLevelBinary.js:
1296         (export.default.LowLevelBinary.prototype.float):
1297         (export.default.LowLevelBinary.prototype.double):
1298         * wasm/function-tests/f32-const.js: Added.
1299         * wasm/function-tests/f64-const.js: Added.
1300         * wasm/function-tests/i32-const.js: Added.
1301         * wasm/wasm.json:
1302
1303 2016-12-14  Saam Barati  <sbarati@apple.com>
1304
1305         WebAssembly: Add various low hanging fruit that will allow us to run the LLVM torture tests in Wasm
1306         https://bugs.webkit.org/show_bug.cgi?id=165883
1307
1308         Reviewed by Keith Miller.
1309
1310         * wasm/Builder.js:
1311         (export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
1312         * wasm/Builder_WebAssemblyBinary.js:
1313         (const.emitters.Export):
1314         * wasm/js-api/table.js:
1315         (assertBadBinary):
1316         (assertBadTable):
1317         (assert.truthy):
1318         * wasm/js-api/test_memory.js:
1319         (binaryShouldNotParse):
1320         (test):
1321         (test.testMemImportError):
1322         (assert.truthy):
1323         (assert): Deleted.
1324
1325 2016-12-14  Filip Pizlo  <fpizlo@apple.com>
1326
1327         DirectTailCall implementation needs to tell the shuffler what to put into the ArgumentCount explicitly
1328         https://bugs.webkit.org/show_bug.cgi?id=165882
1329
1330         Reviewed by Mark Lam.
1331
1332         * stress/direct-tail-call-arity-mismatch-count-args.js: Added.
1333         (foo):
1334         (bar):
1335
1336 2016-12-14  Keith Miller  <keith_miller@apple.com>
1337
1338         WebAssembly JS API: implement Global
1339         https://bugs.webkit.org/show_bug.cgi?id=164133
1340
1341         Reviewed by Saam Barati.
1342
1343         * wasm/Builder.js:
1344         (export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
1345         * wasm/Builder_WebAssemblyBinary.js:
1346         (const.valueType.WASM.description.type.i32.type.const.putGlobalType):
1347         (const.putOp):
1348         (const.putInitExpr):
1349         (const.emitters.Import):
1350         (const.emitters.Global):
1351         (const.emitters.Export):
1352         (const.emitters.Code):
1353         * wasm/LowLevelBinary.js:
1354         (export.default.LowLevelBinary.prototype.varuint32):
1355         (export.default.LowLevelBinary.prototype.varint32):
1356         * wasm/js-api/global-error.js: Added.
1357         (catch):
1358         (assert.truthy):
1359         * wasm/js-api/global-external-init-from-import.js: Added.
1360         * wasm/js-api/global-internal-init-from-import.js: Added.
1361         * wasm/js-api/global-mutate.js: Added.
1362         (createInternalGlobalModule):
1363         * wasm/js-api/globals-export.js: Added.
1364         * wasm/js-api/globals-import.js: Added.
1365         * wasm/wasm.json:
1366
1367 2016-12-13  Saam Barati  <sbarati@apple.com>
1368
1369         WebAssembly: implement the elements section
1370         https://bugs.webkit.org/show_bug.cgi?id=165715
1371
1372         Reviewed by Keith Miller.
1373
1374         * wasm/Builder.js:
1375         (export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
1376         (export.default.Builder.prototype._registerSectionBuilders.switch):
1377         * wasm/Builder_WebAssemblyBinary.js:
1378         (const.emitters.Element):
1379         * wasm/function-tests/basic-element.js: Added.
1380         * wasm/js-api/element.js: Added.
1381         (assertBadBinary):
1382         (assertBadBinary.badInstantiation):
1383
1384 2016-12-13  Saam Barati  <sbarati@apple.com>
1385
1386         WebAssembly: implement the table section and table import
1387         https://bugs.webkit.org/show_bug.cgi?id=165716
1388
1389         Reviewed by Keith Miller.
1390
1391         * wasm/Builder.js:
1392         (const._importMemoryContinuation):
1393         (const._importTableContinuation):
1394         (export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
1395         (const._importMemoryContinuation.section): Deleted.
1396         (const): Deleted.
1397         (const._importMemoryContinuation.assert): Deleted.
1398         * wasm/Builder_WebAssemblyBinary.js:
1399         (const.putResizableLimits):
1400         (const.putTable):
1401         (const.emitters.Import):
1402         (const.emitters.Table):
1403         * wasm/function-tests/call-indirect-params.js:
1404         * wasm/function-tests/call-indirect.js:
1405         * wasm/function-tests/table-basic-2.js: Added.
1406         (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
1407         (func):
1408         * wasm/function-tests/table-basic.js: Added.
1409         (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
1410         * wasm/js-api/call-indirect-results.js:
1411         (const.wasmModuleWhichImportJS): Deleted.
1412         (MonomorphicImport): Deleted.
1413         * wasm/js-api/call-indirect.js:
1414         (const.wasmModuleWhichImportJS):
1415         (const.makeTable):
1416         (Polyphic2Import):
1417         (VirtualImport):
1418         (MonomorphicImport): Deleted.
1419         * wasm/js-api/table.js: Added.
1420         (assertBadBinary):
1421         (assert.truthy):
1422         (assertBadTable):
1423         (assertBadTableImport):
1424         (assertBadBinary.assertBadTableInstance):
1425         (assertBadTableInstance):
1426         (new.WebAssembly.Table):
1427         * wasm/js-api/test_basic_api.js:
1428         (const.c.in.constructorProperties.switch):
1429
1430 2016-12-13  Commit Queue  <commit-queue@webkit.org>
1431
1432         Unreviewed, rolling out r209725.
1433         https://bugs.webkit.org/show_bug.cgi?id=165811
1434
1435         "Broke ARMv7 builds" (Requested by msaboff on #webkit).
1436
1437         Reverted changeset:
1438
1439         "REGRESSION(r209653): speedometer crashes making virtual slow
1440         path tailcalls"
1441         https://bugs.webkit.org/show_bug.cgi?id=165748
1442         http://trac.webkit.org/changeset/209725
1443
1444 2016-12-12  Michael Saboff  <msaboff@apple.com>
1445
1446         REGRESSION(r209653): speedometer crashes making virtual slow path tailcalls
1447         https://bugs.webkit.org/show_bug.cgi?id=165748
1448
1449         Reviewed by Filip Pizlo.
1450
1451         New regression test.
1452
1453         * stress/regress-165748.js: Added.
1454         (sum1):
1455         (sum2):
1456         (sum3):
1457         (sum4):
1458         (sum5):
1459         (sum6):
1460         (tailCaller):
1461         (test):
1462
1463 2016-12-12  Mark Lam  <mark.lam@apple.com>
1464
1465         Debug JSC test timeout: stress/string-prototype-replace-should-throw-out-of-memory-error-when-using-too-much-memory.js.ftl-no-cjit.
1466         https://bugs.webkit.org/show_bug.cgi?id=164630
1467
1468         Reviewed by Keith Miller.
1469
1470         Speculative fix for timeout issue.  It looks like this test just runs a bit
1471         slower on debug builds.  So, we'll give it a little more time to run.
1472
1473         * stress/string-prototype-replace-should-throw-out-of-memory-error-when-using-too-much-memory.js:
1474
1475 2016-12-11  Saam Barati  <sbarati@apple.com>
1476
1477         We should be able to throw exceptions from Wasm code and when Wasm frames are on the stack
1478         https://bugs.webkit.org/show_bug.cgi?id=165429
1479
1480         Reviewed by Keith Miller.
1481
1482         * wasm/function-tests/trap-load.js: Added.
1483         (assert):
1484         (wasmFrameCountFromError):
1485         (i.catch):
1486         (assert.continuation):
1487         * wasm/function-tests/trap-store.js: Added.
1488         (import.Builder.from.string_appeared_here.assert):
1489         (i.catch):
1490         (assert.continuation):
1491         (assert):
1492         * wasm/js-api/test_memory_constructor.js:
1493         (assert):
1494
1495 2016-12-10  Commit Queue  <commit-queue@webkit.org>
1496
1497         Unreviewed, rolling out r209653, r209654, r209663, and
1498         r209673.
1499         https://bugs.webkit.org/show_bug.cgi?id=165739
1500
1501         speedometer crashes (Requested by pizlo on #webkit).
1502
1503         Reverted changesets:
1504
1505         "JSVALUE64: Pass arguments in platform argument registers when
1506         making JavaScript calls"
1507         https://bugs.webkit.org/show_bug.cgi?id=160355
1508         http://trac.webkit.org/changeset/209653
1509
1510         "Unreviewed build fix for 32 bit builds."
1511         http://trac.webkit.org/changeset/209654
1512
1513         "Unreviewed build fix for the CLOOP after r209653"
1514         http://trac.webkit.org/changeset/209663
1515
1516         "REGRESSION(r209653) Crash in CallFrameShuffler::snapshot()"
1517         https://bugs.webkit.org/show_bug.cgi?id=165728
1518         http://trac.webkit.org/changeset/209673
1519
1520 2016-12-10  Michael Saboff  <msaboff@apple.com>
1521
1522         REGRESSION(r209653) Crash in CallFrameShuffler::snapshot()
1523         https://bugs.webkit.org/show_bug.cgi?id=165728
1524
1525         Reviewed by Filip Pizlo.
1526
1527         New regression test.
1528
1529         * stress/regress-165728.js: Added.
1530         (sum1):
1531         (sum2):
1532         (tailCaller):
1533         (test):
1534
1535 2016-12-10  Keith Miller  <keith_miller@apple.com>
1536
1537         Fix indirect_call if the result type is used.
1538         https://bugs.webkit.org/show_bug.cgi?id=165727
1539
1540         Reviewed by Michael Saboff.
1541
1542         * wasm/js-api/call-indirect-results.js: Added.
1543         (const.wasmModuleWhichImportJS):
1544         (MonomorphicImport):
1545
1546 2016-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1547
1548         [JSC] Module namespace object behaves like immutable prototype exotic object
1549         https://bugs.webkit.org/show_bug.cgi?id=165598
1550
1551         Reviewed by Mark Lam.
1552
1553         * modules/namespace-prototype-assignment.js: Added.
1554         (else):
1555         (reportError):
1556         (shouldEqual):
1557         (shouldThrow):
1558         (stringify):
1559         (makeTestID):
1560         (doInternalSetPrototypeOf):
1561         (ordinarySetPrototypeOf):
1562         (setImmutablePrototype):
1563         (windowProxySetPrototypeOf):
1564         (initSetterExpectation):
1565         (throwIfNoExceptionPending):
1566         (objectSetPrototypeOf):
1567         (setUnderscoreProto):
1568         (reflectSetPrototypeOf):
1569         (setPrototypeOf):
1570         (newObjectProto.toString):
1571         (Symbol):
1572         (test):
1573         (runTests):
1574         * modules/namespace-set-prototype-of.js: Added.
1575         (shouldThrow):
1576         (TypeError.Cannot.set prototype):
1577
1578 2016-12-09  Michael Saboff  <msaboff@apple.com>
1579
1580         JSVALUE64: Pass arguments in platform argument registers when making JavaScript calls
1581         https://bugs.webkit.org/show_bug.cgi?id=160355
1582
1583         Reviewed by Filip Pizlo.
1584
1585         New microbenchmarks to measure call type performance.
1586
1587         * microbenchmarks/calling-computed-args.js: Added.
1588         * microbenchmarks/calling-many-callees.js: Added.
1589         * microbenchmarks/calling-one-callee-fixed.js: Added.
1590         * microbenchmarks/calling-one-callee.js: Added.
1591         * microbenchmarks/calling-poly-callees.js: Added.
1592         * microbenchmarks/calling-poly-extra-arity-callees.js: Added.
1593         * microbenchmarks/calling-tailcall.js: Added.
1594         * microbenchmarks/calling-virtual-arity-fixup-callees.js: Added.
1595         * microbenchmarks/calling-virtual-arity-fixup-stackargs.js: Added.
1596         * microbenchmarks/calling-virtual-callees.js: Added.
1597         * microbenchmarks/calling-virtual-extra-arity-callees.js: Added.
1598
1599 2016-12-09  Keith Miller  <keith_miller@apple.com>
1600
1601         Wasm should support call_indirect
1602         https://bugs.webkit.org/show_bug.cgi?id=165718
1603
1604         Reviewed by Filip Pizlo.
1605
1606         * wasm/Builder.js:
1607         * wasm/function-tests/call-indirect-params.js: Added.
1608         * wasm/function-tests/call-indirect.js: Added.
1609         * wasm/js-api/call-indirect.js: Added.
1610         (const.wasmModuleWhichImportJS):
1611         (MonomorphicImport):
1612         (Polyphic2Import):
1613         (VirtualImport):
1614         * wasm/wasm.json:
1615
1616 2016-12-09  JF Bastien  <jfbastien@apple.com>
1617
1618         WebAssembly: implement data section
1619         https://bugs.webkit.org/show_bug.cgi?id=165696
1620
1621         Reviewed by Keith Miller.
1622
1623         As specified in https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md#data-section
1624         Note that some of the interesting corner cases are ill-defined by the spec: https://github.com/WebAssembly/design/issues/897
1625
1626         * wasm/Builder.js: create a data section from JavaScript
1627         * wasm/Builder_WebAssemblyBinary.js: assemble the data section into the proper binary encoding
1628         (const.emitters.Data):
1629         * wasm/js-api/test_Data.js: Added.
1630         (DataSection):
1631         (DataSectionOffTheEnd):
1632         (DataSectionPartlyOffTheEnd):
1633         (DataSectionEmptyOffTheEnd):
1634         (DataSectionSeenByStart):
1635         * wasm/self-test/test_BuilderJSON.js: make sure the JSON structure is fine (this sanity checks before going to binary)
1636
1637 2016-12-09  JF Bastien  <jfbastien@apple.com>
1638
1639         WebAssembly JS API: implement start function
1640         https://bugs.webkit.org/show_bug.cgi?id=165150
1641
1642         Reviewed by Saam Barati.
1643
1644         * wasm/Builder.js: allow building a .Start()
1645         * wasm/Builder_WebAssemblyBinary.js:
1646         * wasm/js-api/test_Start.js: Added.
1647         (const.emitters.Start): serialize a start section
1648         * wasm/self-test/test_BuilderJSON.js: validate the start section's content
1649
1650 2016-12-09  Saam Barati  <sbarati@apple.com>
1651
1652         WebAssembly JS API: implement importing and defining Memory
1653         https://bugs.webkit.org/show_bug.cgi?id=164134
1654
1655         Reviewed by Keith Miller.
1656
1657         * wasm/Builder.js:
1658         (const._importMemoryContinuation.section):
1659         (const._importMemoryContinuation.assert):
1660         (const._importMemoryContinuation):
1661         (const._exportFunctionContinuation.const): Deleted.
1662         (const._exportFunctionContinuation): Deleted.
1663         * wasm/Builder_WebAssemblyBinary.js:
1664         (const.emitters.Import):
1665         * wasm/js-api/test_basic_api.js:
1666         (const.c.in.constructorProperties.switch):
1667         * wasm/js-api/test_memory.js: Added.
1668         (assert):
1669         (binaryShouldNotParse):
1670         (test):
1671         (test.testMemImportError):
1672         * wasm/js-api/test_memory_constructor.js: Added.
1673         (assert):
1674         (throw.new.Error):
1675         (testInvalidSize):
1676         (assert.testInvalidInitial):
1677         (testInvalidInitial.testInvalidMaximum):
1678         (testInvalidInitial):
1679         (testInvalidMaximum):
1680         * wasm/self-test/test_BuilderJSON.js:
1681
1682 2016-12-08  JF Bastien  <jfbastien@apple.com>
1683
1684         WebAssembly: JSC::link* shouldn't need a CodeBlock
1685         https://bugs.webkit.org/show_bug.cgi?id=165591
1686
1687         Reviewed by Keith Miller.
1688
1689         test that wasm -> JS works, including the IC
1690
1691         * wasm/js-api/test_Instance.js:
1692         (const.wasmModuleWhichImportJS):
1693         (MonomorphicImport):
1694         (Polyphic2Import):
1695         (Polyphic3Import):
1696         (VirtualImport):
1697
1698 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
1699
1700         Green the cloop bot by raising this threshold.
1701
1702         * mozilla/js1_5/Array/regress-101964.js:
1703
1704 2016-12-08  JF Bastien  <jfbastien@apple.com>
1705
1706         WebAssembly JS API: wire up Instance imports
1707         https://bugs.webkit.org/show_bug.cgi?id=165118
1708
1709         Reviewed by Saam Barati.
1710
1711         * wasm/js-api/test_Instance.js: add the test, disabled for now
1712
1713 2016-12-07  Keith Miller  <keith_miller@apple.com>
1714
1715         Add more missing trivial wasm ops.
1716         https://bugs.webkit.org/show_bug.cgi?id=165564
1717
1718         Add tests for drop and tee_local.
1719
1720         Reviewed by Geoffrey Garen.
1721
1722         * wasm/function-tests/drop.js: Added.
1723         * wasm/function-tests/nop.js: Added.
1724         * wasm/function-tests/tee-local.js: Added.
1725
1726 2016-12-06  Keith Miller  <keith_miller@apple.com>
1727
1728         Add support for truncation operators
1729         https://bugs.webkit.org/show_bug.cgi?id=165519
1730
1731         Reviewed by Geoffrey Garen.
1732
1733         * wasm/function-tests/i32-trunc-s-f32.js: Added.
1734         * wasm/function-tests/i32-trunc-s-f64.js: Added.
1735         * wasm/function-tests/i32-trunc-u-f32.js: Added.
1736         * wasm/function-tests/i32-trunc-u-f64.js: Added.
1737         * wasm/function-tests/i64-trunc-s-f32.js: Added.
1738         * wasm/function-tests/i64-trunc-s-f64.js: Added.
1739         * wasm/function-tests/i64-trunc-u-f32.js: Added.
1740         * wasm/function-tests/i64-trunc-u-f64.js: Added.
1741
1742 2016-12-06  Mark Lam  <mark.lam@apple.com>
1743
1744         Introduce the concept of Immutable Prototype Exotic Objects to comply with the spec.
1745         https://bugs.webkit.org/show_bug.cgi?id=165227
1746         <rdar://problem/29442665>
1747
1748         Reviewed by Saam Barati.
1749
1750         * stress/get-from-scope-dynamic-onto-proxy.js:
1751         - Updated error message.
1752
1753         * stress/proxy-dont-infinite-loop.js: Removed.
1754         * stress/proxy-json-path.js: Removed.
1755         * stress/rest-parameter-allocation-elimination-watchpoints-6.js: Removed.
1756         - Removed these tests because the issue they are testing relies on being able to
1757           set Object.prototype.__proto__ to something else (which is now not possible).
1758
1759 2016-12-05  Caitlin Potter  <caitp@igalia.com>
1760
1761         [JSC] report unexpected token when "async" is followed by identifier 
1762         https://bugs.webkit.org/show_bug.cgi?id=165091
1763
1764         Reviewed by Mark Lam.
1765
1766         * stress/bug-165091.js:
1767
1768 2016-12-05  Keith Miller  <keith_miller@apple.com>
1769
1770         Add Wasm i64 to i32 conversion.
1771         https://bugs.webkit.org/show_bug.cgi?id=165378
1772
1773         Reviewed by Filip Pizlo.
1774
1775         It turns out the wrap operation is just B3's Trunc.
1776
1777         * wasm/wasm.json:
1778
1779 2016-12-04  Keith Miller  <keith_miller@apple.com>
1780
1781         Add support for Wasm ctz and popcnt
1782         https://bugs.webkit.org/show_bug.cgi?id=165369
1783
1784         Reviewed by Saam Barati.
1785
1786         * wasm/function-tests/ctz.js: Added.
1787         * wasm/function-tests/popcnt.js: Added.
1788
1789 2016-12-03  JF Bastien  <jfbastien@apple.com>
1790
1791         WebAssembly: update binary format to 0xD version
1792         https://bugs.webkit.org/show_bug.cgi?id=165345
1793
1794         Reviewed by Keith Miller.
1795
1796         As described in the following PR: https://github.com/WebAssembly/design/pull/836
1797         Originally committed in r209175, reverted in r209242, and fixed in r209284.
1798
1799         * wasm/Builder.js:
1800         (const._normalizeFunctionSignature):
1801         * wasm/Builder_WebAssemblyBinary.js:
1802         (const.emitters.Type):
1803         (const.emitters.Code):
1804         * wasm/LowLevelBinary.js:
1805         (export.default.LowLevelBinary.prototype.block_type):
1806         (export.default.LowLevelBinary.prototype.inline_signature_type): Deleted.
1807         * wasm/WASM.js:
1808         * wasm/js-api/test_basic_api.js:
1809         * wasm/self-test/test_BuilderWebAssembly.js:
1810         (EmptyModule):
1811         (CustomSection):
1812         * wasm/self-test/test_WASM.js:
1813         * wasm/wasm.json:
1814
1815 2016-12-02  Keith Miller  <keith_miller@apple.com>
1816
1817         Add Wasm copysign
1818         https://bugs.webkit.org/show_bug.cgi?id=165355
1819
1820         Reviewed by Filip Pizlo.
1821
1822         * wasm/function-tests/copysign.js: Added.
1823
1824 2016-12-03  Commit Queue  <commit-queue@webkit.org>
1825
1826         Unreviewed, rolling out r209298.
1827         https://bugs.webkit.org/show_bug.cgi?id=165359
1828
1829         broke the build (Requested by smfr on #webkit).
1830
1831         Reverted changeset:
1832
1833         "Add Wasm copysign"
1834         https://bugs.webkit.org/show_bug.cgi?id=165355
1835         http://trac.webkit.org/changeset/209298
1836
1837 2016-12-02  Keith Miller  <keith_miller@apple.com>
1838
1839         Add Wasm copysign
1840         https://bugs.webkit.org/show_bug.cgi?id=165355
1841
1842         Reviewed by Filip Pizlo.
1843
1844         * wasm/function-tests/copysign.js: Added.
1845
1846 2016-12-02  Keith Miller  <keith_miller@apple.com>
1847
1848         Unreviewed, fix git having a breakdown over trying to reland a rollout.
1849
1850 2016-12-02  Keith Miller  <keith_miller@apple.com>
1851
1852         Add Wasm floating point nearest and trunc
1853         https://bugs.webkit.org/show_bug.cgi?id=165339
1854
1855         Reviewed by Saam Barati.
1856
1857         * wasm/function-tests/nearest.js: Added.
1858         * wasm/function-tests/trunc.js: Added.
1859
1860 2016-12-02  Caitlin Potter  <caitp@igalia.com>
1861
1862 [JSC] add additional bit to JSTokenType bitfield
1863         https://bugs.webkit.org/show_bug.cgi?id=165091
1864
1865         Reviewed by Geoffrey Garen.
1866
1867         * stress/bug-165091.js: Added.
1868         (shouldThrowSyntaxError):
1869
1870 2016-12-02  Commit Queue  <commit-queue@webkit.org>
1871
1872         Unreviewed, rolling out r209275 and r209276.
1873         https://bugs.webkit.org/show_bug.cgi?id=165348
1874
1875         "broke the arm build" (Requested by keith_miller on #webkit).
1876
1877         Reverted changesets:
1878
1879         "Add Wasm floating point nearest and trunc"
1880         https://bugs.webkit.org/show_bug.cgi?id=165339
1881         http://trac.webkit.org/changeset/209275
1882
1883         "Unreviewed, forgot to change instruction after renaming."
1884         http://trac.webkit.org/changeset/209276
1885
1886 2016-12-02  Keith Miller  <keith_miller@apple.com>
1887
1888         Add Wasm floating point nearest and trunc
1889         https://bugs.webkit.org/show_bug.cgi?id=165339
1890
1891         Reviewed by Filip Pizlo.
1892
1893         * wasm/function-tests/nearest.js: Added.
1894         * wasm/function-tests/trunc.js: Added.
1895
1896 2016-12-02  JF Bastien  <jfbastien@apple.com>
1897
1898         WebAssembly: revert patch causing odd breakage
1899         https://bugs.webkit.org/show_bug.cgi?id=165308
1900
1901         Unreviewed.
1902
1903         Bug #164724 seems to cause build issues which I haven't tracked down yet. WasmOps.h can't be found:
1904         ./Source/JavaScriptCore/wasm/WasmFormat.h:34:10: fatal error: 'WasmOps.h' file not found
1905
1906         It's weird since the file is auto-generated and has been for a while. #164724 merely includes it in WasmFormat.h.
1907
1908         * wasm/Builder.js:
1909         (const._normalizeFunctionSignature):
1910         * wasm/Builder_WebAssemblyBinary.js:
1911         (const.emitters.Type):
1912         (const.emitters.Code):
1913         * wasm/LowLevelBinary.js:
1914         (export.default.LowLevelBinary.prototype.inline_signature_type):
1915         (export.default.LowLevelBinary.prototype.block_type): Deleted.
1916         * wasm/WASM.js:
1917         * wasm/js-api/test_basic_api.js:
1918         * wasm/self-test/test_BuilderWebAssembly.js:
1919         (EmptyModule):
1920         (CustomSection):
1921         * wasm/self-test/test_WASM.js:
1922         * wasm/wasm.json:
1923
1924 2016-12-01  Ryan Haddad  <ryanhaddad@apple.com>
1925
1926         Skip flaky test ChakraCore/test/fieldopts/objtypespec-newobj-invalidation.1.js
1927         https://bugs.webkit.org/show_bug.cgi?id=162567
1928
1929         Reviewed by Saam Barati.
1930
1931         * ChakraCore.yaml:
1932
1933 2016-12-01  Keith Miller  <keith_miller@apple.com>
1934
1935         Add wasm int to floating point opcodes
1936         https://bugs.webkit.org/show_bug.cgi?id=165252
1937
1938         Reviewed by Geoffrey Garen.
1939
1940         Add tests for Wasm integral to floating point conversion opcodes.
1941
1942         * wasm/function-tests/int-to-floating-point.js: Added.
1943         * wasm/wasm.json:
1944
1945 2016-12-01  Geoffrey Garen  <ggaren@apple.com>
1946
1947         Land a test case for <rdar://problem/27889416>
1948         https://bugs.webkit.org/show_bug.cgi?id=165272
1949
1950         Reviewed by Saam Barati.
1951
1952         * stress/marked-argument-buffer.js: Added.
1953         (allocate):
1954         (test.o.toString):
1955         (test):
1956
1957 2016-11-29  Per Arne Vollan  <pvollan@apple.com>
1958
1959         [Win] Skip failing JSC tests.
1960         https://bugs.webkit.org/show_bug.cgi?id=165140
1961
1962         Reviewed by Mark Lam.
1963
1964         * ChakraCore.yaml:
1965         * microbenchmarks/tan.js:
1966
1967 2016-11-30  JF Bastien  <jfbastien@apple.com>
1968
1969         WebAssembly builder: don't throw when checker not implemented
1970         https://bugs.webkit.org/show_bug.cgi?id=165219
1971
1972         Reviewed by Mark Lam.
1973
1974         We should perform whichever checks we've implemented, and assume the rest are OK until bug #163421 is fixed.
1975
1976         * wasm/Builder.js:
1977         * wasm/README.md:
1978         * wasm/function-tests/add-12.js:
1979         * wasm/function-tests/br-if-loop-less-than.js:
1980         * wasm/function-tests/brTableAsIf.js:
1981         * wasm/function-tests/brTableManyValues.js:
1982         * wasm/function-tests/brTableWithLoop.js:
1983         * wasm/function-tests/dumb-eq-if-then-else.js:
1984         * wasm/function-tests/dumb-less-than-fallthrough.js:
1985         * wasm/function-tests/dumb-less-than-ite.js:
1986         * wasm/function-tests/eqz.js:
1987         * wasm/function-tests/factorial.js:
1988         * wasm/function-tests/float-sub.js:
1989         * wasm/function-tests/i32-load.js:
1990         * wasm/function-tests/i32-load8-s.js:
1991         * wasm/function-tests/if-then-else-fallthrough.js:
1992         * wasm/function-tests/if-then-fallthrough.js:
1993         * wasm/function-tests/loop-mult.js:
1994         * wasm/function-tests/loop-sum.js:
1995         * wasm/function-tests/max.js:
1996         * wasm/function-tests/min.js:
1997         * wasm/function-tests/ret5.js:
1998         * wasm/function-tests/select.js:
1999         * wasm/self-test/test_BuilderJSON.js:
2000
2001 2016-11-29  JF Bastien  <jfbastien@apple.com>
2002
2003         WebAssembly JS API: improve Instance
2004         https://bugs.webkit.org/show_bug.cgi?id=164757
2005
2006         Reviewed by Keith Miller.
2007
2008         An Instance's `exports` property wasn't populated with exports.
2009
2010         A follow-up patch will do imports.
2011
2012         A few things of note:
2013
2014          - LowLevelBinary: support 3-byte integers.
2015          - LowLevelBinary: support proper UTF-8 2003 code points (instead of UTF-16).
2016
2017         * wasm/Builder.js:
2018         * wasm/Builder_WebAssemblyBinary.js: wire up exports, stub other things out some more
2019         (const.emitters.Export):
2020         * wasm/LowLevelBinary.js:
2021         (export.default.LowLevelBinary.prototype.uint24): add, used for UTF-8
2022         (export.default.LowLevelBinary.prototype.string): support UTF-8
2023         (export.default.LowLevelBinary.prototype.getUint24): add, used for UTF-8
2024         (export.default.LowLevelBinary.prototype.getVaruint1): was missing
2025         (export.default.LowLevelBinary.prototype.getString): support UTF-8
2026         (export.default.LowLevelBinary):
2027         * wasm/js-api/test_Instance.js: instance.exports.answer() // <-- this is where the magic of this entire patch is
2028         (ExportedAnswerI32):
2029         * wasm/js-api/test_basic_api.js: punt test to later
2030         (const.c.in.constructorProperties.switch):
2031         * wasm/self-test/test_BuilderWebAssembly.js: UTF-8
2032         (CustomSection):
2033         * wasm/self-test/test_LowLevelBinary_string.js: UTF-8 now works
2034         * wasm/self-test/test_LowLevelBinary_uint16.js: was missing one value
2035         * wasm/self-test/test_LowLevelBinary_uint24.js: Copied from JSTests/wasm/self-test/test_LowLevelBinary_uint8.js.
2036         * wasm/self-test/test_LowLevelBinary_uint8.js: was missing one value
2037         * wasm/self-test/test_LowLevelBinary_varuint1.js: Added.
2038         * wasm/utilities.js: this `dump` thing was useful
2039         (const._dump):
2040
2041 2016-11-29  Saam Barati  <sbarati@apple.com>
2042
2043         We should be able optimize the pattern where we spread a function's rest parameter to another call
2044         https://bugs.webkit.org/show_bug.cgi?id=163865
2045
2046         Reviewed by Filip Pizlo.
2047
2048         * microbenchmarks/default-derived-constructor.js: Added.
2049         (createClassHierarchy.let.currentClass):
2050         (createClassHierarchy):
2051         * stress/call-varargs-spread.js: Added.
2052         (assert):
2053         (bar):
2054         (foo):
2055         * stress/load-varargs-on-new-array-with-spread-convert-to-static-loads.js: Added.
2056         (assert):
2057         (baz):
2058         (bar):
2059         (foo):
2060         * stress/new-array-with-spread-with-normal-spread-and-phantom-spread.js: Added.
2061         (assert):
2062         (foo):
2063         (escape):
2064         (bar):
2065         * stress/phantom-new-array-with-spread-osr-exit.js: Added.
2066         (assert):
2067         (baz):
2068         (bar):
2069         (effects):
2070         (foo):
2071         * stress/phantom-spread-forward-varargs.js: Added.
2072         (assert):
2073         (test1.bar):
2074         (test1.foo):
2075         (test1):
2076         (test2.bar):
2077         (test2.foo):
2078         (test3.baz):
2079         (test3.bar):
2080         (test3.foo):
2081         (test4.baz):
2082         (test4.bar):
2083         (test4.foo):
2084         (test5.baz):
2085         (test5.bar):
2086         (test5.foo):
2087         * stress/phantom-spread-osr-exit.js: Added.
2088         (assert):
2089         (baz):
2090         (bar):
2091         (effects):
2092         (foo):
2093         * stress/spread-call-convert-to-static-call.js: Added.
2094         (assert):
2095         (baz):
2096         (bar):
2097         (foo):
2098         * stress/spread-forward-call-varargs-stack-overflow.js: Added.
2099         (assert):
2100         (identity):
2101         (bar):
2102         (foo):
2103         * stress/spread-forward-varargs-rest-parameter-change-iterator-protocol-2.js: Added.
2104         (assert):
2105         (baz.Array.prototype.Symbol.iterator):
2106         (baz):
2107         (bar):
2108         (foo):
2109         (test):
2110         * stress/spread-forward-varargs-rest-parameter-change-iterator-protocol.js: Added.
2111         (assert):
2112         (baz.Array.prototype.Symbol.iterator):
2113         (baz):
2114         (bar):
2115         (foo):
2116         * stress/spread-forward-varargs-stack-overflow.js: Added.
2117         (assert):
2118         (bar):
2119         (foo):
2120
2121 2016-11-29  Caitlin Potter  <caitp@igalia.com>
2122
2123         [JSC] always wrap AwaitExpression operand in a new Promise
2124         https://bugs.webkit.org/show_bug.cgi?id=165181
2125
2126         Reviewed by Yusuke Suzuki.
2127
2128         * stress/async-await-basic.js:
2129         (async.awaitedPromisesAreWrapped):
2130
2131 2016-11-29  Keith Miller  <keith_miller@apple.com>
2132
2133         Add simple way to implement Wasm ops that require more than one B3 opcode
2134         https://bugs.webkit.org/show_bug.cgi?id=165129
2135
2136         Reviewed by Geoffrey Garen.
2137
2138         * wasm/function-tests/eqz.js: Added.
2139         * wasm/function-tests/max.js: Added.
2140         * wasm/function-tests/min.js: Added.
2141         * wasm/wasm.json:
2142
2143 2016-11-21  Yusuke Suzuki  <utatane.tea@gmail.com>
2144
2145         Crash in com.apple.JavaScriptCore: WTF::ThreadSpecific<WTF::WTFThreadData, + 142
2146         https://bugs.webkit.org/show_bug.cgi?id=164898
2147
2148         Reviewed by Darin Adler.
2149
2150         * stress/tagged-template-registry-key-collect.js: Added.
2151         (shouldBe):
2152         (tag):
2153         (i.eval):
2154         * stress/tagged-template-registry-key.js: Added.
2155         (shouldBe):
2156         (tag):
2157         (a):
2158         (b):
2159
2160 2016-11-20  Caitlin Potter  <caitp@igalia.com>
2161
2162         [JSC] speed up parsing of async functions
2163         https://bugs.webkit.org/show_bug.cgi?id=164808
2164
2165         Reviewed by Yusuke Suzuki.
2166
2167         Add tests for line terminator following "async" keyword in async
2168         function syntax.
2169
2170         * stress/async-await-syntax.js:
2171         (shouldBe):
2172
2173 2016-11-19  Mark Lam  <mark.lam@apple.com>
2174
2175         op_mod-* JSC tests needs a longer timeout too.
2176         https://bugs.webkit.org/show_bug.cgi?id=164994
2177
2178         Reviewed by Yusuke Suzuki.
2179
2180         * stress/op_mod-ConstVar.js:
2181         * stress/op_mod-VarConst.js:
2182         * stress/op_mod-VarVar.js:
2183
2184 2016-11-19  Mark Lam  <mark.lam@apple.com>
2185
2186         Add --timeoutMultiplier option to allow some tests more time to run.
2187         https://bugs.webkit.org/show_bug.cgi?id=164951
2188
2189         Reviewed by Yusuke Suzuki.
2190
2191         Extended the timeout for these tests by 50% more because they run quite slow on
2192         low-end machines.
2193
2194         * stress/op_div-ConstVar.js:
2195         * stress/op_div-VarConst.js:
2196         * stress/op_div-VarVar.js:
2197
2198 2016-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
2199
2200         REGRESSION(r208867): JSC test failure: ChakraCore.yaml/ChakraCore/test/strict/05.arguments_sm.js.default
2201         https://bugs.webkit.org/show_bug.cgi?id=164929
2202
2203         Reviewed by Mark Lam.
2204
2205         ES2017 drops arguments.caller and JavaScriptCore is updated to meet the spec.
2206         This patch rebaselines the result of ChakraCore test for JSC.
2207
2208         * ChakraCore/test/strict/05.arguments_sm.baseline-jsc:
2209
2210 2016-11-18  Joseph Pecoraro  <pecoraro@apple.com>
2211
2212         Web Inspector: Generator functions should have a displayable name when shown in stack traces
2213         https://bugs.webkit.org/show_bug.cgi?id=164844
2214         <rdar://problem/29300697>
2215
2216         Reviewed by Yusuke Suzuki.
2217
2218         * stress/generator-function-name.js:
2219         Add another test now that we name the inner generator function
2220         that we do not break the lexical resolution of names.
2221
2222 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2223
2224         [JSC] Drop arguments.caller
2225         https://bugs.webkit.org/show_bug.cgi?id=164859
2226
2227         Reviewed by Saam Barati.
2228
2229         * stress/strict-mode-arguments-caller.js: Added.
2230         (strictArguments):
2231         (shouldBe):
2232
2233 2016-11-17  Keith Miller  <keith_miller@apple.com>
2234
2235         Add rotate to Wasm
2236         https://bugs.webkit.org/show_bug.cgi?id=164871
2237
2238         Reviewed by Filip Pizlo.
2239
2240         * wasm/wasm.json:
2241
2242 2016-11-17  Keith Miller  <keith_miller@apple.com>
2243
2244         Add sqrt to Wasm
2245         https://bugs.webkit.org/show_bug.cgi?id=164877
2246
2247         Reviewed by Mark Lam.
2248
2249         B3 already has a Sqrt opcode we just need to map Wasm to it.
2250
2251         * wasm/wasm.json:
2252
2253 2016-11-17  Saam Barati  <sbarati@apple.com>
2254
2255         Remove async/await compile time flag and enable tests
2256         https://bugs.webkit.org/show_bug.cgi?id=164828
2257         <rdar://problem/28639334>
2258
2259         Reviewed by Yusuke Suzuki.
2260
2261         * stress/async-arrow-functions-lexical-arguments-binding.js:
2262         * stress/async-arrow-functions-lexical-new.target-binding.js:
2263         * stress/async-arrow-functions-lexical-super-binding.js:
2264         * stress/async-arrow-functions-lexical-this-binding.js:
2265         * stress/async-await-basic.js:
2266         * stress/async-await-long-loop.js:
2267         * stress/async-await-module-reserved-word.js:
2268         * stress/async-await-mozilla.js:
2269         (mozSyntaxErrors):
2270         * stress/async-await-reserved-word.js:
2271         * stress/async-await-syntax.js:
2272         * stress/async-await-throw-loop.js:
2273         * stress/async-function-create-nobaseline.js:
2274         * stress/async-function-create-optimized.js:
2275         * stress/async-function-declaration-sinking-no-double-allocate.js:
2276         * stress/async-function-declaration-sinking-osrexit.js:
2277         * stress/async-function-declaration-sinking-put.js:
2278         * stress/async-function-expression-sinking-no-double-allocate.js:
2279         * stress/async-function-expression-sinking-osrexit.js:
2280         * stress/async-function-expression-sinking-put.js:
2281         * test262.yaml:
2282
2283 2016-11-15  Mark Lam  <mark.lam@apple.com>
2284
2285         Make JSC test functions more robust.
2286         https://bugs.webkit.org/show_bug.cgi?id=164807
2287
2288         Reviewed by Keith Miller.
2289
2290         * stress/jsc-test-functions-should-be-more-robust.js: Added.
2291
2292 2016-11-15  Keith Miller  <keith_miller@apple.com>
2293
2294         B3 should support UDiv/UMod
2295         https://bugs.webkit.org/show_bug.cgi?id=164811
2296
2297         Reviewed by Filip Pizlo.
2298
2299         Link new instructions to wasm.
2300
2301         * wasm/wasm.json:
2302
2303 2016-11-15  Saam Barati  <sbarati@apple.com>
2304
2305         Debug JSC test timeout: stress/has-own-property-name-cache-symbols-and-strings.js.ftl-no-cjit-small-pool
2306         https://bugs.webkit.org/show_bug.cgi?id=163012
2307
2308         Unreviewed. This patch makes a test run for less time because it's timing out on the bots.
2309
2310         * stress/has-own-property-name-cache-symbols-and-strings.js:
2311
2312 2016-11-15  Mark Lam  <mark.lam@apple.com>
2313
2314         The jsc shell's setImpureGetterDelegate() should ensure that the set value is an ImpureGetter.
2315         https://bugs.webkit.org/show_bug.cgi?id=164781
2316         <rdar://problem/28418590>
2317
2318         Reviewed by Geoffrey Garen and Michael Saboff.
2319
2320         * stress/jsc-setImpureGetterDelegate-on-bad-type.js: Added.
2321
2322 2016-11-15  Yusuke Suzuki  <utatane.tea@gmail.com>
2323
2324         [DOMJIT] Allow using macro assembler scratches in FTL CheckDOM
2325         https://bugs.webkit.org/show_bug.cgi?id=164727
2326
2327         Reviewed by Filip Pizlo.
2328
2329         * stress/check-dom-with-signature.js: Added.
2330         (shouldBe):
2331         (calling):
2332         (i.array.forEach):
2333
2334 2016-11-14  Caitlin Potter  <caitp@igalia.com>
2335
2336         [JSC] do not reference AwaitExpression Promises in async function Promise chain
2337         https://bugs.webkit.org/show_bug.cgi?id=164753
2338
2339         Reviewed by Yusuke Suzuki.
2340
2341         * asyncFunctionTests.yaml:
2342         * stress/async-await-long-loop.js: Added.
2343         (shouldBe):
2344         (async.longLoop):
2345         * stress/async-await-throw-loop.js: Added.
2346         (shouldBe):
2347         (async.thrower):
2348         (async.throwLoop):
2349
2350 2016-11-14  Keith Miller  <keith_miller@apple.com>
2351
2352         Add Wasm select
2353         https://bugs.webkit.org/show_bug.cgi?id=164743
2354
2355         Reviewed by Saam Barati.
2356
2357         * wasm/function-tests/select.js: Added.
2358
2359 2016-11-14  Caitlin Potter  <caitp@igalia.com>
2360
2361         [JSC] Handle new_async_func / new_async_func_exp in DFG / FTL
2362         https://bugs.webkit.org/show_bug.cgi?id=164037
2363
2364         Reviewed by Yusuke Suzuki.
2365
2366         Add tests based on tests from https://trac.webkit.org/changeset/194216.
2367
2368         * asyncFunctionTests.yaml:
2369         * stress/async-function-create-nobaseline.js: Added.
2370         * stress/async-function-create-optimized.js: Added.
2371         * stress/async-function-declaration-sinking-no-double-allocate.js: Added.
2372         * stress/async-function-declaration-sinking-osrexit.js: Added.
2373         * stress/async-function-declaration-sinking-put.js: Added.
2374         * stress/async-function-expression-sinking-no-double-allocate.js: Added.
2375         * stress/async-function-expression-sinking-osrexit.js: Added.
2376         * stress/async-function-expression-sinking-put.js: Added.
2377
2378 2016-11-14  Mark Lam  <mark.lam@apple.com>
2379
2380         Some of JSStringView::SafeView methods are not idiomatically safe for JSString to StringView conversions.
2381         https://bugs.webkit.org/show_bug.cgi?id=164701
2382         <rdar://problem/27462104>
2383
2384         Reviewed by Darin Adler.
2385
2386         * stress/string-prototype-charCodeAt-on-too-long-rope.js: Added.
2387
2388 2016-11-14  Mark Lam  <mark.lam@apple.com>
2389
2390         RegExpObject::exec/match should handle errors gracefully.
2391         https://bugs.webkit.org/show_bug.cgi?id=155145
2392         <rdar://problem/27435934>
2393
2394         Reviewed by Keith Miller.
2395
2396         * stress/regexp-prototype-exec-on-too-long-rope.js: Added.
2397         * stress/regexp-prototype-match-on-too-long-rope.js: Added.
2398         * stress/regexp-prototype-test-on-too-long-rope.js: Added.
2399
2400 2016-11-14  Mark Lam  <mark.lam@apple.com>
2401
2402         Enhance run-jsc-stress-test script to allow optional test specific options to be added for all test run configurations.
2403         https://bugs.webkit.org/show_bug.cgi?id=164695
2404
2405         Reviewed by Keith Miller.
2406
2407         Replace use of runMisc* test run configurations with equivalents.
2408
2409         * stress/licm-no-pre-header-nested.js:
2410         * stress/licm-no-pre-header.js:
2411         * stress/licm-pre-header-cannot-exit-nested.js:
2412         * stress/licm-pre-header-cannot-exit.js:
2413         * stress/make-dictionary-repatch.js:
2414         * stress/retry-cache-later.js:
2415         * stress/shadow-chicken-reading-from-scope-after-ftl-osr-exit-bytecode-liveness.js:
2416         * stress/slow-path-generator-updating-current-node-dfg.js:
2417         * stress/unshift-array-storage.js:
2418
2419 2016-11-11  Joseph Pecoraro  <pecoraro@apple.com>
2420
2421         test262: DataView with explicit undefined byteLength should be the same as it not being present
2422         https://bugs.webkit.org/show_bug.cgi?id=164453
2423
2424         Reviewed by Darin Adler.
2425
2426         * stress/dataview-construct.js: Added.
2427         (assert):
2428         (shouldThrow):
2429         * test262.yaml:
2430
2431 2016-11-11  Joseph Pecoraro  <pecoraro@apple.com>
2432
2433         test262: DataView get methods should allow for missing offset, set methods should allow for missing value
2434         https://bugs.webkit.org/show_bug.cgi?id=164451
2435
2436         Reviewed by Darin Adler.
2437
2438         * test262.yaml:
2439
2440 2016-11-11  Saam Barati  <sbarati@apple.com>
2441
2442         We should have a more concise way of determining when we're varargs calling a function using rest parameters
2443         https://bugs.webkit.org/show_bug.cgi?id=164258
2444
2445         Reviewed by Yusuke Suzuki.
2446
2447         * microbenchmarks/call-using-spread.js: Added.
2448         (bar):
2449         (foo):
2450         * microbenchmarks/spread-large-array.js: Added.
2451         (foo):
2452         (arrays.push):
2453         * microbenchmarks/spread-small-array.js: Added.
2454         (foo):
2455         * stress/spread-array-iterator-watchpoint-2.js: Added.
2456         (foo):
2457         (arrayIterator.next):
2458         * stress/spread-array-iterator-watchpoint.js: Added.
2459         (foo):
2460         (Array.prototype.Symbol.iterator):
2461         * stress/spread-non-array.js: Added.
2462         (assert):
2463         (foo):
2464         (let.customIterator.Symbol.iterator):
2465         (bar):
2466
2467 2016-11-11  Keith Miller  <keith_miller@apple.com>
2468
2469         Relocate wasm tests and actually add them to the test runner
2470         https://bugs.webkit.org/show_bug.cgi?id=164668
2471
2472         Reviewed by Yusuke Suzuki.
2473
2474         This moves the Wasm tests from their current location down a level.
2475         Without relocating, the tests cannot properly be run by the wasm test runner.
2476
2477         * wasm.yaml:
2478         * wasm/Builder.js: Fix typos, yay lazy synatx checking!
2479         * wasm/LowLevelBinary.js: Fix typos, yay lazy synatx checking!
2480         (export.default.LowLevelBinary.prototype.get return):
2481         * wasm/function-tests/add-12.js: Renamed from JSTests/wasm/js-api/function-tests/add-12.js.
2482         * wasm/function-tests/br-if-loop-less-than.js: Renamed from JSTests/wasm/js-api/function-tests/br-if-loop-less-than.js.
2483         * wasm/function-tests/brTableAsIf.js: Renamed from JSTests/wasm/js-api/function-tests/brTableAsIf.js.
2484         * wasm/function-tests/brTableManyValues.js: Renamed from JSTests/wasm/js-api/function-tests/brTableManyValues.js.
2485         * wasm/function-tests/brTableWithLoop.js: Renamed from JSTests/wasm/js-api/function-tests/brTableWithLoop.js.
2486         * wasm/function-tests/dumb-eq-if-then-else.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-eq-if-then-else.js.
2487         * wasm/function-tests/dumb-less-than-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-fallthrough.js.
2488         * wasm/function-tests/dumb-less-than-ite.js: Renamed from JSTests/wasm/js-api/function-tests/dumb-less-than-ite.js.
2489         * wasm/function-tests/factorial.js: Renamed from JSTests/wasm/js-api/function-tests/factorial.js.
2490         * wasm/function-tests/float-sub.js: Renamed from JSTests/wasm/js-api/function-tests/float-sub.js.
2491         * wasm/function-tests/i32-load.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load.js.
2492         * wasm/function-tests/i32-load8-s.js: Renamed from JSTests/wasm/js-api/function-tests/i32-load8-s.js.
2493         * wasm/function-tests/if-then-else-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-else-fallthrough.js.
2494         * wasm/function-tests/if-then-fallthrough.js: Renamed from JSTests/wasm/js-api/function-tests/if-then-fallthrough.js.
2495         * wasm/function-tests/loop-mult.js: Renamed from JSTests/wasm/js-api/function-tests/loop-mult.js.
2496         * wasm/function-tests/loop-sum.js: Renamed from JSTests/wasm/js-api/function-tests/loop-sum.js.
2497         * wasm/function-tests/ret5.js: Renamed from JSTests/wasm/js-api/function-tests/ret5.js.
2498         * wasm/self-test/test_BuilderJSON.js: Rebasline
2499
2500 2016-11-11  Keith Miller  <keith_miller@apple.com>
2501
2502         Move Wasm tests to JS
2503         https://bugs.webkit.org/show_bug.cgi?id=164611
2504
2505         Reviewed by Geoffrey Garen.
2506
2507         This patch translates most of the tests from testWasm.cpp to the JS testing api. Most of the
2508         ommited tests were earliest tests, which tested trivial things, like adding two
2509         constants. Some tests are ommited for other reasons, however. These are:
2510
2511         1) Tests using I64 since the testing api does not yet know how to handle 64-bit numbers.  2)
2512         Tests that would validate the memory of the module once wasm was done with it since that's
2513         not really possible in JS.
2514
2515         In order to make such a translation easier this patch also adds some features to the JS
2516         testing api:
2517
2518         1) Blocks can now be done lexically by adding a lambda as the last argument of the block
2519         opcode. For example one can do:
2520             ...
2521             .Block("i32", b => b.I32Const(1) )
2522
2523         and the nested lambda will automatically have an end attached.
2524
2525         2) The JS testing api can now handle inline signature types.
2526
2527         3) Relocate some code to make it easier to follow and prevent 44 space indentation.
2528
2529         4) Rename varuint/varint to varuint32/varint32, this lets them be directly called from the
2530         wasm.json without being remapped.
2531
2532         5) Add support for Memory and Function sections to the Builder.
2533
2534         6) Add support for local variables.
2535
2536         On the JSC side, we needed to expose a new function to validate the compiled wasm code
2537         behaves the way we expect. At least until the JS Wasm API is finished. The new validation
2538         function, testWasmModuleFunctions, takes an array buffer containing the wasm binary, the
2539         number of functions in the blob and tests for each of those functions.
2540
2541         * wasm/Builder.js:
2542         (const._maybeRegisterType):
2543         (const): Deleted.
2544         (switch.typeof): Deleted.
2545         * wasm/Builder_WebAssemblyBinary.js:
2546         (const.emitters.Type):
2547         (const.emitters.Import):
2548         (const.emitters.Function):
2549         (const.emitters.Memory):
2550         (const.emitters.Code):
2551         (export.const.Binary):
2552         * wasm/LowLevelBinary.js:
2553         (export.default.LowLevelBinary.prototype.get return):
2554         (export.default.LowLevelBinary.prototype.varuint32):
2555         (export.default.LowLevelBinary.prototype.varint32):
2556         (export.default.LowLevelBinary.prototype.varuint1):
2557         (export.default.LowLevelBinary.prototype.varint7):
2558         (export.default.LowLevelBinary.prototype.varuint7):
2559         (export.default.LowLevelBinary.prototype.inline_signature_type):
2560         (export.default.LowLevelBinary.prototype.string):
2561         (export.default.LowLevelBinary.prototype.getVaruint32):
2562         (export.default.LowLevelBinary.prototype.getVarint32):
2563         (export.default.LowLevelBinary.prototype.getVaruint7):
2564         (export.default.LowLevelBinary.prototype.getString):
2565         (export.default.LowLevelBinary):
2566         (export.default.LowLevelBinary.prototype.varuint): Deleted.
2567         (export.default.LowLevelBinary.prototype.varint): Deleted.
2568         (export.default.LowLevelBinary.prototype.getVaruint): Deleted.
2569         (export.default.LowLevelBinary.prototype.getVarint): Deleted.
2570         * wasm/js-api/test_old_tests.js: Added.
2571         (ret5):
2572         (brTableWithLoop):
2573         (brTableManyValues):
2574         (run.brTableManyValues.brTableAsIf):
2575         (ifThenFallthrough):
2576         (ifThenElseFallthrough):
2577         (dumbLessThanFallthrough):
2578         (run.dumbLessThanFallthrough.floatSub):
2579         (run.floatSub.add12):
2580         (run.add12.factorial):
2581         (i32load):
2582         (run.i32load.i32load8s):
2583         (run.i32load8s.dumbEqIfThenElse):
2584         (run.dumbEqIfThenElse.dumbEqIfThenElse):
2585         (run.dumbEqIfThenElse.dumbLessThanIfThenElse):
2586         (run.dumbLessThanIfThenElse.loopSum):
2587         (run.loopSum.loopMult):
2588         (brIfLoopLessThan):
2589         (run.brIfLoopLessThan.run):
2590         * wasm/self-test/test_LowLevelBinary_varint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varint.js.
2591         * wasm/self-test/test_LowLevelBinary_varuint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varuint.js.
2592
2593         * wasm/Builder.js:
2594         (const._maybeRegisterType):
2595         (const): Deleted.
2596         (switch.typeof): Deleted.
2597         * wasm/Builder_WebAssemblyBinary.js:
2598         (const.emitters.Type):
2599         (const.emitters.Import):
2600         (const.emitters.Function):
2601         (const.emitters.Memory):
2602         (const.emitters.Code):
2603         (export.const.Binary):
2604         * wasm/LowLevelBinary.js:
2605         (export.default.LowLevelBinary.prototype.get return):
2606         (export.default.LowLevelBinary.prototype.varuint32):
2607         (export.default.LowLevelBinary.prototype.varint32):
2608         (export.default.LowLevelBinary.prototype.varuint1):
2609         (export.default.LowLevelBinary.prototype.varint7):
2610         (export.default.LowLevelBinary.prototype.varuint7):
2611         (export.default.LowLevelBinary.prototype.inline_signature_type):
2612         (export.default.LowLevelBinary.prototype.string):
2613         (export.default.LowLevelBinary.prototype.getVaruint32):
2614         (export.default.LowLevelBinary.prototype.getVarint32):
2615         (export.default.LowLevelBinary.prototype.getVaruint7):
2616         (export.default.LowLevelBinary.prototype.getString):
2617         (export.default.LowLevelBinary):
2618         (export.default.LowLevelBinary.prototype.varuint): Deleted.
2619         (export.default.LowLevelBinary.prototype.varint): Deleted.
2620         (export.default.LowLevelBinary.prototype.getVaruint): Deleted.
2621         (export.default.LowLevelBinary.prototype.getVarint): Deleted.
2622         * wasm/js-api/function-tests/add-12.js: Added.
2623         * wasm/js-api/function-tests/br-if-loop-less-than.js: Added.
2624         * wasm/js-api/function-tests/brTableAsIf.js: Added.
2625         * wasm/js-api/function-tests/brTableManyValues.js: Added.
2626         * wasm/js-api/function-tests/brTableWithLoop.js: Added.
2627         * wasm/js-api/function-tests/dumb-eq-if-then-else.js: Added.
2628         * wasm/js-api/function-tests/dumb-less-than-fallthrough.js: Added.
2629         * wasm/js-api/function-tests/dumb-less-than-ite.js: Added.
2630         * wasm/js-api/function-tests/factorial.js: Added.
2631         * wasm/js-api/function-tests/float-sub.js: Added.
2632         * wasm/js-api/function-tests/i32-load.js: Added.
2633         * wasm/js-api/function-tests/i32-load8-s.js: Added.
2634         * wasm/js-api/function-tests/if-then-else-fallthrough.js: Added.
2635         * wasm/js-api/function-tests/if-then-fallthrough.js: Added.
2636         * wasm/js-api/function-tests/loop-mult.js: Added.
2637         * wasm/js-api/function-tests/loop-sum.js: Added.
2638         * wasm/js-api/function-tests/ret5.js: Added.
2639         * wasm/self-test/test_LowLevelBinary_varint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varint.js.
2640         * wasm/self-test/test_LowLevelBinary_varuint32.js: Renamed from JSTests/wasm/self-test/test_LowLevelBinary_varuint.js.
2641
2642 2016-11-11  Saam Barati  <sbarati@apple.com>
2643
2644         We recursively grab a lock in the DFGBytecodeParser causing us to deadlock
2645         https://bugs.webkit.org/show_bug.cgi?id=164650
2646
2647         Reviewed by Geoffrey Garen.
2648
2649         * stress/dont-dead-lock-put-by-val-as-put-by-id.js: Added.
2650         (ident):
2651         (let.o.set foo):
2652         (foo):
2653
2654 2016-11-11  Chris Dumez  <cdumez@apple.com>
2655
2656         Unreviewed, rolling out r208584.
2657
2658         Seems to have regressed Speedometer by 1% on Mac
2659
2660         Reverted changeset:
2661
2662         "We should have a more concise way of determining when we're
2663         varargs calling a function using rest parameters"
2664         https://bugs.webkit.org/show_bug.cgi?id=164258
2665         http://trac.webkit.org/changeset/208584
2666
2667 2016-11-11  Chris Dumez  <cdumez@apple.com>
2668
2669         Unreviewed, rolling out r208117 and r208160.
2670
2671         Regressed Speedometer by >1.5%
2672
2673         Reverted changesets:
2674
2675         "We should have a way of profiling when a get_by_id is pure
2676         and to emit a PureGetById in the DFG/FTL"
2677         https://bugs.webkit.org/show_bug.cgi?id=163305
2678         http://trac.webkit.org/changeset/208117
2679
2680         "Debug JSC test microbenchmarks/pure-get-by-id-cse-2.js timing
2681         out"
2682         https://bugs.webkit.org/show_bug.cgi?id=164227
2683         http://trac.webkit.org/changeset/208160
2684
2685 2016-11-11  Saam Barati  <sbarati@apple.com>
2686
2687         We should have a more concise way of determining when we're varargs calling a function using rest parameters
2688         https://bugs.webkit.org/show_bug.cgi?id=164258
2689
2690         Reviewed by Yusuke Suzuki.
2691
2692         * microbenchmarks/call-using-spread.js: Added.
2693         (bar):
2694         (foo):
2695         * microbenchmarks/spread-large-array.js: Added.
2696         (foo):
2697         (arrays.push):
2698         * microbenchmarks/spread-small-array.js: Added.
2699         (foo):
2700         * stress/spread-array-iterator-watchpoint-2.js: Added.
2701         (foo):
2702         (arrayIterator.next):
2703         * stress/spread-array-iterator-watchpoint.js: Added.
2704         (foo):
2705         (Array.prototype.Symbol.iterator):
2706         * stress/spread-non-array.js: Added.
2707         (assert):
2708         (foo):
2709         (let.customIterator.Symbol.iterator):
2710         (bar):
2711
2712 2016-11-10  Mark Lam  <mark.lam@apple.com>
2713
2714         Fix broken have-a-bad-time-with-arguments.js test.
2715         https://bugs.webkit.org/show_bug.cgi?id=164626
2716
2717         Reviewed by Filip Pizlo.
2718
2719         But also saved a copy of the broken one as broken-have-a-bad-time-with-arguments-for-gc-testing.js
2720         because coincidentally, it stresses the GC in ways that help reveal bugs.
2721
2722         * stress/broken-have-a-bad-time-with-arguments-for-gc-testing.js: Added.
2723         (testFunction):
2724         (warmupFunction):
2725         (let.argsDeclIndex.in.argumentsDecls.let.indexToReturnIndex.in.indicesToReturn.let.insertElementActionIndex.in.insertElementActions.let.tierWarmupCountIndex.in.tierWarmupCounts.let.testArgsIndex.in.testArgsList.catch):
2726         * stress/have-a-bad-time-with-arguments.js:
2727
2728 2016-11-10  JF Bastien  <jfbastien@apple.com>
2729
2730         ASSERTION FAILED: length > offset encountered with wasm.yaml/wasm/js-api/test_Module.js.default-wasm
2731         https://bugs.webkit.org/show_bug.cgi?id=164597
2732
2733         Reviewed by Keith Miller.
2734
2735         Trim the array buffer before returning it: it's optimistically
2736         over-allocated to avoid growing all the time, but when parsed it
2737         can't have extra content.
2738
2739         * wasm/Builder_WebAssemblyBinary.js:
2740         (export.const.Binary):
2741         * wasm/LowLevelBinary.js:
2742         (export.default.LowLevelBinary.prototype.get return):
2743
2744 2016-11-10  Joseph Pecoraro  <pecoraro@apple.com>
2745
2746         test262: DataView / TypedArray methods should throw RangeErrors for negative numbers (ToIndex)
2747         https://bugs.webkit.org/show_bug.cgi?id=164450
2748
2749         Reviewed by Darin Adler.
2750
2751         * stress/dataview-typedarray-toindex.js: Added.
2752         Tests for all cases where ToIndex should be used.
2753
2754         * test262.yaml:
2755         New passing tests.
2756
2757 2016-11-10  Mark Lam  <mark.lam@apple.com>
2758
2759         Graph::methodOfGettingAValueProfileFor() should be returning the profile for the operand node.
2760         https://bugs.webkit.org/show_bug.cgi?id=164600
2761         <rdar://problem/28828676>
2762
2763         Reviewed by Filip Pizlo.
2764
2765         * stress/osr-exit-on-op-negate-should-no-fail-assertions.js: Added.
2766
2767 2016-11-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2768
2769         [JSC] Avoid cloned arguments allocation in ArrayPrototype methods
2770         https://bugs.webkit.org/show_bug.cgi?id=164502
2771
2772         Reviewed by Saam Barati.
2773
2774         * stress/argument-intrinsic-basic.js: Added.
2775         (shouldBe):
2776         (builtin.createBuiltin):
2777         * stress/argument-intrinsic-inlining-with-result-escape.js: Added.
2778         (shouldBe):
2779         (builtin.createBuiltin):
2780         (escape):
2781         * stress/argument-intrinsic-nested-inlining.js: Added.
2782         (shouldBe):
2783         (builtin.createBuiltin):
2784         (builtinCaller1):
2785         (builtinCaller2):
2786         (escape):
2787         * stress/argument-intrinsic-not-convert-to-get-argument.js: Added.
2788         (shouldBe):
2789         (builtin.createBuiltin):
2790         * stress/argument-intrinsic-with-stack-write.js: Added.
2791         (shouldBe):
2792         (builtin.createBuiltin):
2793
2794 2016-11-09  Saam Barati  <sbarati@apple.com>
2795
2796         Math.min()/Math.max() with no arguments is lowered incorrectly in the BytecodeParser
2797         https://bugs.webkit.org/show_bug.cgi?id=164464
2798         <rdar://problem/29131452>
2799
2800         Reviewed by Darin Adler.
2801
2802         * stress/math-max-min-no-arguments.js: Added.
2803         (assert):
2804         (min):
2805         (max):
2806         (test):
2807
2808 2016-11-09  Saam Barati  <sbarati@apple.com>
2809
2810         TypeProfiler and running GC collection on another thread don't play nicely with each other
2811         https://bugs.webkit.org/show_bug.cgi?id=164441
2812         <rdar://problem/29132174>
2813
2814         Reviewed by Geoffrey Garen.
2815
2816         * typeProfiler/type-profiler-gc.js: Added.
2817         (bar):
2818         (foo):
2819
2820 2016-11-04  Mark Lam  <mark.lam@apple.com>
2821
2822         Error description code should be able to handle Symbol values.
2823         https://bugs.webkit.org/show_bug.cgi?id=164436
2824         <rdar://problem/29115583>
2825
2826         Reviewed by Filip Pizlo and Saam Barati.
2827
2828         * stress/error-description-on-symbols-should-not-crash.js: Added.
2829
2830 2016-11-03  Geoffrey Garen  <ggaren@apple.com>
2831
2832         EvalCodeCache should not give up in strict mode and other cases
2833         https://bugs.webkit.org/show_bug.cgi?id=164357
2834
2835         Reviewed by Michael Saboff.
2836
2837         * microbenchmarks/eval-cached.js: Added. 45x faster now.
2838         * stress/eval-cached.js: Added. Try running the same eval text in a bunch
2839         of different scopes and verify that we access the right scope.
2840
2841 2016-11-04  JF Bastien  <jfbastien@apple.com>
2842
2843         WebAssembly JS API: implement more sections
2844         https://bugs.webkit.org/show_bug.cgi?id=164023
2845
2846         Reviewed by Keith Miller.
2847
2848         On the JSC side:
2849
2850          - Put in parser stubs for all WebAssembly sections.
2851          - Parse Import, Export sections.
2852          - Use tryReserveCapacity instead of reserve, and bail out of the parser if it fails. This prevents the parser from bringing everything down when faced with a malicious input.
2853          - Encapsulate all parsed module information into its own structure, making it easier to pass around (from parser to Plan to Module to Instance).
2854          - Create WasmFormat.cpp to hold parsed module information's dtor to avoid including WasmMemory.h needlessly.
2855          - parseCode: avoid overflow through function size.
2856          - Remove all remainders of polyfill-prototype-1, and update license.
2857          - Add missing WasmOps.h and WasmValidateInlines.h auto-generation for cmake build.
2858
2859         On the Builder.js testing side:
2860
2861          - Implement Type, Import (function only), Export (function only) sections.
2862          - Check section order and uniqueness.
2863          - Optionally auto-generate the Type section from subsequent Export / Import / Code entries.
2864          - Allow re-exporting an import.
2865
2866         * wasm/Builder.js: build type, import, and export sections
2867         (const._normalizeFunctionSignature):
2868         * wasm/Builder_WebAssemblyBinary.js: Added. Forked from Builder.js
2869         (const.emitters.Type):
2870         (const.emitters.Import):
2871         (const.emitters.Function):
2872         (const.emitters.Table):
2873         (const.emitters.Memory):
2874         (const.emitters.Global):
2875         (const.emitters.Export):
2876         (const.emitters.Start):
2877         (const.emitters.Element):
2878         (const.emitters.Code):
2879         (const.emitters.Data):
2880         (export.const.Binary):
2881         * wasm/LowLevelBinary.js: Add a few useful outputs
2882         (export.default.LowLevelBinary.prototype.varuint1):
2883         (export.default.LowLevelBinary.prototype.varint7):
2884         * wasm/WASM.js: value type and external kind helpers
2885         * wasm/assert.js: array element-wise equality comparison
2886         (const._eq):
2887         * wasm/js-api/test_Module.js:
2888         (ModuleWithImports):
2889         * wasm/self-test/test_BuilderJSON.js: many more tests for all the new Builder APIs, and update to some older tests which now require a Type section or rejiggered Function signature
2890         (const.assertOpThrows):
2891         (SectionsWithSameCustomName):
2892         (TwoTypeSections):
2893         (EmptyImportSection):
2894         (ImportBeforeTypeSections):
2895         * wasm/self-test/test_BuilderWebAssembly.js: remove a test which wasn't helpful and is now obsolete
2896         (CustomSection):
2897
2898 2016-11-03  Mark Lam  <mark.lam@apple.com>
2899
2900         ClonedArguments need to also support haveABadTime mode.
2901         https://bugs.webkit.org/show_bug.cgi?id=164200
2902         <rdar://problem/27211336>
2903
2904         Reviewed by Geoffrey Garen.
2905
2906         * stress/have-a-bad-time-with-arguments.js: Added.
2907
2908 2016-11-03  Filip Pizlo  <fpizlo@apple.com>
2909
2910         DFG plays fast and loose with the shadow values of a Phi
2911         https://bugs.webkit.org/show_bug.cgi?id=164309
2912
2913         Reviewed by Saam Barati.
2914         
2915         This test demonstrates why the DFG needs to recognize the shadow value of a Phi.
2916
2917         * stress/dfg-ssa-swap.js: Added.
2918         (foo):
2919
2920 2016-11-03  Commit Queue  <commit-queue@webkit.org>
2921
2922         Unreviewed, rolling out r208364.
2923         https://bugs.webkit.org/show_bug.cgi?id=164402
2924
2925         broke the build (Requested by smfr on #webkit).
2926
2927         Reverted changeset:
2928
2929         "DFG plays fast and loose with the shadow values of a Phi"
2930         https://bugs.webkit.org/show_bug.cgi?id=164309
2931         http://trac.webkit.org/changeset/208364
2932
2933 2016-11-03  Filip Pizlo  <fpizlo@apple.com>
2934
2935         DFG plays fast and loose with the shadow values of a Phi
2936         https://bugs.webkit.org/show_bug.cgi?id=164309
2937
2938         Reviewed by Saam Barati.
2939         
2940         This test demonstrates why the DFG needs to recognize the shadow value of a Phi.
2941
2942         * stress/dfg-ssa-swap.js: Added.
2943         (foo):
2944
2945 2016-11-03  Saam Barati  <sbarati@apple.com>
2946
2947         Asking for a value profile prediction should be defensive against not finding a value profile
2948         https://bugs.webkit.org/show_bug.cgi?id=164306
2949
2950         Reviewed by Mark Lam.
2951
2952         * stress/inlined-tail-call-in-inlined-setter-should-not-crash-when-getting-value-profile.js: Added.
2953         (let.o.set foo):
2954         (bar):
2955
2956 2016-11-02  Saam Barati  <sbarati@apple.com>
2957
2958         Allocation elimination of rest parameter doesn't take into account indexed properties on Array.prototype/Object.prototype
2959         https://bugs.webkit.org/show_bug.cgi?id=164301
2960
2961         Reviewed by Geoffrey Garen.
2962
2963         * stress/rest-parameter-allocation-elimination-watchpoints-2.js: Added.
2964         (assert):
2965         (foo):
2966         * stress/rest-parameter-allocation-elimination-watchpoints-3.js: Added.
2967         (assert):
2968         (foo):
2969         * stress/rest-parameter-allocation-elimination-watchpoints-4.js: Added.
2970         (assert):
2971         (foo):
2972         * stress/rest-parameter-allocation-elimination-watchpoints-5.js: Added.
2973         (assert):
2974         (foo):
2975         * stress/rest-parameter-allocation-elimination-watchpoints-6.js: Added.
2976         (assert):
2977         (foo):
2978         * stress/rest-parameter-allocation-elimination-watchpoints.js: Added.
2979         (assert):
2980         (foo):
2981
2982 2016-11-01  Saam Barati  <sbarati@apple.com>
2983
2984         We should be able to eliminate rest parameter allocations
2985         https://bugs.webkit.org/show_bug.cgi?id=163925
2986
2987         Reviewed by Filip Pizlo.
2988
2989         * microbenchmarks/rest-parameter-allocation-elimination.js: Added.
2990         (assert):
2991         (test1.bar):
2992         (test1):
2993         (test2.jaz):
2994         (test2.jaz2.kaz):
2995         (test2.jaz2):
2996         (test2):
2997         (test3.foo):
2998         (test3.baz):
2999         (test3.jaz):
3000         (test3):
3001         (test4.baz):
3002         (test4.jaz):
3003         (test4):
3004         (test5.baz):
3005         (test5.jaz):
3006         (test5):
3007         (test6.baz):
3008         (test6.jaz):
3009         (test6):
3010         (test7.baz):
3011         (test7.jaz):
3012         (test7.check):
3013         (test7):
3014         (test8.baz):
3015         (test8.jaz):
3016         (test8.check):
3017         (test8):
3018         (test9.baz):
3019         (test9.jaz):
3020         (test9.check):
3021         (test9):
3022         (test10.baz):
3023         (test10.jaz):
3024         (test10):
3025         (test11.bar):
3026         (test11.foo):
3027         (test11.makeArguments):
3028         (test11.):
3029         (test12):
3030         (test12.bar):
3031         (test12.foo):
3032         (test12.makeArguments):
3033         (test12.):
3034         (test13.bar):
3035         (test13.top):
3036         (test13.foo):
3037         (test13.makeArguments):
3038         (test13.):
3039         (test13):
3040         (test14.bar):
3041         (test14.top):
3042         (test14.foo):
3043         (test14.makeArguments):
3044         (test14.):
3045         (test14):
3046         (test15.bar):
3047         (test15.top):
3048         (test15.foo):
3049         (test15.makeArguments):
3050         (test15.):
3051         (test15):
3052
3053 2016-11-01  Commit Queue  <commit-queue@webkit.org>
3054
3055         Unreviewed, rolling out r208208 and r208210.
3056         https://bugs.webkit.org/show_bug.cgi?id=164276
3057
3058         This change caused 28 JSC test failures. (Requested by
3059         ryanhaddad on #webkit).
3060
3061         Reverted changesets:
3062
3063         "We should be able to eliminate rest parameter allocations"
3064         https://bugs.webkit.org/show_bug.cgi?id=163925
3065         http://trac.webkit.org/changeset/208208
3066
3067         "Fix the EFL build."
3068         http://trac.webkit.org/changeset/208210
3069
3070 2016-10-31  Filip Pizlo  <fpizlo@apple.com>
3071
3072         JSC should support SharedArrayBuffer
3073         https://bugs.webkit.org/show_bug.cgi?id=163986
3074
3075         Reviewed by Keith Miller.
3076         
3077         This adds our own test for the various corner cases of SharedArrayBuffer. This test is meant to
3078         check all of the things that don't require concurrency.
3079
3080         * stress/SharedArrayBuffer.js: Added.
3081         (checkAtomics):
3082         (shouldFail):
3083         (Symbol):
3084         (runAtomic):
3085
3086 2016-10-31  Saam Barati  <sbarati@apple.com>
3087
3088         We should be able to eliminate rest parameter allocations
3089         https://bugs.webkit.org/show_bug.cgi?id=163925
3090
3091         Reviewed by Filip Pizlo.
3092
3093         * microbenchmarks/rest-parameter-allocation-elimination.js: Added.
3094         (assert):
3095         (test1.bar):
3096         (test1):
3097         (test2.jaz):
3098         (test2.jaz2.kaz):
3099         (test2.jaz2):
3100         (test2):
3101         (test3.foo):
3102         (test3.baz):
3103         (test3.jaz):
3104         (test3):
3105         (test4.baz):
3106         (test4.jaz):
3107         (test4):
3108         (test5.baz):
3109         (test5.jaz):
3110         (test5):
3111         (test6.baz):
3112         (test6.jaz):
3113         (test6):
3114         (test7.baz):
3115         (test7.jaz):
3116         (test7.check):
3117         (test7):
3118         (test8.baz):
3119         (test8.jaz):
3120         (test8.check):
3121         (test8):
3122         (test9.baz):
3123         (test9.jaz):
3124         (test9.check):
3125         (test9):
3126         (test10.baz):
3127         (test10.jaz):
3128         (test10):
3129         (test11.bar):
3130         (test11.foo):
3131         (test11.makeArguments):
3132         (test11.):
3133         (test12):
3134         (test12.bar):
3135         (test12.foo):
3136         (test12.makeArguments):
3137         (test12.):
3138         (test13.bar):
3139         (test13.top):
3140         (test13.foo):
3141         (test13.makeArguments):
3142         (test13.):
3143         (test13):
3144         (test14.bar):
3145         (test14.top):
3146         (test14.foo):
3147         (test14.makeArguments):
3148         (test14.):
3149         (test14):
3150         (test15.bar):
3151         (test15.top):
3152         (test15.foo):
3153         (test15.makeArguments):
3154         (test15.):
3155         (test15):
3156
3157 2016-10-31  Saam Barati  <sbarati@apple.com>
3158
3159         Debug JSC test microbenchmarks/pure-get-by-id-cse-2.js timing out
3160         https://bugs.webkit.org/show_bug.cgi?id=164227
3161
3162         Unreviewed timeout fix.
3163
3164         * microbenchmarks/pure-get-by-id-cse-2.js:
3165
3166 2016-10-31  Keith Miller  <keith_miller@apple.com>
3167
3168         autogenerated files from wasm.json should be in derived sources.
3169         https://bugs.webkit.org/show_bug.cgi?id=164152
3170
3171         Reviewed by Filip Pizlo.
3172
3173         Delete generation script since it is no longer used.
3174
3175         * wasm/generate-wasmops-header.js: Removed.
3176
3177 2016-10-29  Yusuke Suzuki  <utatane.tea@gmail.com>
3178
3179         [JSC] JSON.stringify should handle Proxy which is non JSArray but isArray is true
3180         https://bugs.webkit.org/show_bug.cgi?id=164123
3181
3182         Reviewed by Mark Lam.
3183
3184         * stress/json-stringify-with-non-jsarray-array.js: Added.
3185         (shouldBe):
3186         (shouldBe.JSON.stringify.new.Proxy):
3187
3188 2016-10-29  Saam Barati  <sbarati@apple.com>
3189
3190         We should have a way of profiling when a get_by_id is pure and to emit a PureGetById in the DFG/FTL
3191         https://bugs.webkit.org/show_bug.cgi?id=163305
3192
3193         Reviewed by Keith Miller.
3194
3195         * microbenchmarks/pure-get-by-id-cse-2.js: Added.
3196         (foo):
3197         * microbenchmarks/pure-get-by-id-cse.js: Added.
3198         (foo):
3199         * stress/pure-get-by-id-cse-correctness.js: Added.
3200         (assert):
3201         (foo):
3202         * stress/pure-get-by-id-on-non-object.js: Added.
3203         (assert):
3204         (foo):
3205
3206 2016-10-28  Csaba Osztrogonác  <ossy@webkit.org>
3207
3208         Skip JSTests/microbenchmarks/dense-set.js on memory limited devices
3209         https://bugs.webkit.org/show_bug.cgi?id=164128
3210
3211         Reviewed by Mark Lam.
3212
3213         * microbenchmarks/dense-set.js:
3214
3215 2016-10-20  Caitlin Potter  <caitp@igalia.com>
3216
3217         [JSC] implement runtime for async functions
3218         https://bugs.webkit.org/show_bug.cgi?id=163760
3219
3220         Reviewed by Yusuke Suzuki.
3221
3222         * stress/async-await-basic.js: Added.
3223         (shouldBe):
3224         (shouldBeAsync):
3225         (shouldThrow):
3226         (shouldThrowAsync):
3227         (shouldThrowSyntaxError):
3228         (let.AsyncFunction.async):
3229         (async.asyncFunctionForProto):
3230         (Object.getPrototypeOf.async):
3231         (Object.getPrototypeOf.async.method):
3232         (async):
3233         (async.method):
3234         (async.asyncNonConstructorDecl):
3235         (shouldThrow.new.async):
3236         (shouldThrow.new.async.nonConstructor):
3237         (async.asyncDecl):
3238         (async.f):
3239         (MyError):
3240         (async.asyncDeclThrower):
3241         (shouldThrowAsync.async):
3242         (resolveLater):
3243         (rejectLater):
3244         (async.resumeAfterNormal):
3245         (O.async.resumeAfterNormal):
3246         (resumeAfterNormalArrow.async):
3247         (async.resumeAfterThrow):
3248         (O.async.resumeAfterThrow):
3249         (resumeAfterThrowArrow.async):
3250         (catch):
3251         * stress/async-await-module-reserved-word.js: Added.
3252         (shouldThrow):
3253         (SyntaxError.Canstring_appeared_hereawait.checkModuleSyntaxError.String.raw.await):
3254         (checkModuleSyntaxError.String.raw.await):
3255         (checkModuleSyntaxError.String.raw.async.await):
3256         (SyntaxError.Cannot.declare.named):
3257         * stress/async-await-mozilla.js: Added.
3258         (shouldBe):
3259         (shouldBeAsync):
3260         (shouldThrow):
3261         (shouldThrowAsync):
3262         (assert):
3263         (shouldThrowSyntaxError):
3264         (mozSemantics.async.empty):
3265         (mozSemantics.async.simpleReturn):
3266         (mozSemantics.async.simpleAwait):
3267         (mozSemantics.async.simpleAwaitAsync):
3268         (mozSemantics.async.returnOtherAsync):
3269         (mozSemantics.async.simpleThrower):
3270         (mozSemantics.async.delegatedThrower):
3271         (mozSemantics.async.tryCatch):
3272         (mozSemantics.async.tryCatchThrow):
3273         (mozSemantics.async.wellFinally):
3274         (mozSemantics.async.finallyMayFail):
3275         (mozSemantics.async.embedded.async.inner):
3276         (mozSemantics.async.embedded):
3277         (mozSemantics.async.fib):
3278         (mozSemantics.async.isOdd.async.isEven):
3279         (mozSemantics.async.isOdd):
3280         (mozSemantics.hardcoreFib.async.fib2):
3281         (mozSemantics.namedAsyncExpr.async.simple):
3282         (mozSemantics.async.executionOrder.async.first):
3283         (mozSemantics.async.executionOrder.async.second):
3284         (mozSemantics.async.executionOrder.async.third):
3285         (mozSemantics.async.executionOrder):
3286         (mozSemantics.async.miscellaneous):
3287         (mozSemantics.thrower):
3288         (mozSemantics.async.defaultArgs):
3289         (mozSemantics.shouldThrow):
3290         (mozSemantics):
3291         (mozMethods.X):
3292         (mozMethods.X.prototype.async.getValue):
3293         (mozMethods.X.prototype.setValue):
3294         (mozMethods.X.prototype.async.increment):
3295         (mozMethods.X.prototype.async.getBaseClassName):
3296         (mozMethods.X.async.getStaticValue):
3297         (mozMethods.Y.prototype.async.getBaseClassName):
3298         (mozMethods.Y):
3299         (mozFunctionNameInferrence.async.test):
3300         (mozSyntaxErrors):
3301         * stress/async-await-reserved-word.js: Added.
3302         (assert):
3303         (shouldThrowSyntaxError):
3304         (AsyncFunction.async):
3305         * stress/async_arrow_functions_lexical_arguments_binding.js: Added.
3306         (shouldBe):
3307         (shouldBeAsync):
3308         (shouldThrowAsync):
3309         (noArgumentsArrow2.async):
3310         * stress/async_arrow_functions_lexical_new.target_binding.js: Added.
3311         (shouldBe):
3312         (shouldBeAsync):
3313         (shouldThrowAsync):
3314         (C1):
3315         (C2):
3316         (shouldThrowAsync.async):
3317         * stress/async_arrow_functions_lexical_super_binding.js: Added.
3318         (shouldBe):
3319         (shouldBeAsync):
3320         (BaseClass.prototype.baseClassValue):
3321         (BaseClass.prototype.get property):
3322         (BaseClass):
3323         (ChildClass.prototype.asyncSuperProp):
3324         (ChildClass.prototype.asyncSuperProp2):
3325         (ChildClass):
3326         (ChildClass2):
3327         * stress/async_arrow_functions_lexical_this_binding.js: Added.
3328         (shouldBe):
3329         (shouldBeAsync):
3330         (d.y):
3331
3332 2016-10-28  Csaba Osztrogonác  <ossy@webkit.org>
3333
3334         Skip 2 JS stress tests on memory limited devices
3335         https://bugs.webkit.org/show_bug.cgi?id=164125
3336
3337         Unreviewed quick fix to unbreak JSCOnly ARM bots as soon as possible.
3338
3339         * stress/joined-strings-should-not-exceed-max-string-length.js:
3340         * stress/string-prototype-replace-should-throw-out-of-memory-error-when-using-too-much-memory.js:
3341
3342 2016-10-27  Caitlin Potter  <caitp@igalia.com>
3343
3344         [JSC] forbid lexical redeclaration of generator formal parameters
3345         https://bugs.webkit.org/show_bug.cgi?id=163930
3346
3347         Reviewed by Yusuke Suzuki.
3348
3349         * stress/async-await-syntax.js:
3350         * stress/generator-syntax.js:
3351         (testSyntaxError.gen):
3352         (testSyntaxError.arguments):
3353         (testSyntaxError.eval):
3354         * test262.yaml:
3355
3356 2016-10-26  JF Bastien  <jfbastien@apple.com>
3357
3358         WebAssembly API: implement Instance
3359
3360         As described in: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblyinstance-objects
3361
3362          - Take ownership of Wasm::Plan's compilation result when successfully creating a JSWebAssemblyModule object.
3363          - Construct a basic Instance with a Module.
3364          - Handle second argument (importObject) of WebAssembly.Instance.
3365          - Add reference text from the spec to WebAssembly.Module's code.
3366          - Expose and test an empty 'exports' ModuleNamespaceObject on WebAssembly.Instance.
3367
3368         The implementation isn't complete yet: it relies on further work for which I've filed bugs.
3369
3370         WebAssembly API: implement Instance
3371         https://bugs.webkit.org/show_bug.cgi?id=163998
3372
3373         Reviewed by Keith Miller.
3374
3375         * wasm/js-api/test_Instance.js: Added.
3376         (EmptyModule): use the Builder, create the simplest Module possible, and create an Instance from it
3377         * wasm/js-api/test_basic_api.js:
3378         (const.c.in.constructorProperties.switch): basic tests of the API
3379
3380 2016-10-26  Mark Lam  <mark.lam@apple.com>
3381
3382         JSGenericTypedArrayView::set() should check for exceptions.
3383         https://bugs.webkit.org/show_bug.cgi?id=164007
3384         <rdar://problem/28853775>
3385
3386         Reviewed by Filip Pizlo.
3387
3388         * stress/typed-array-view-set-should-not-crash-on-exception.js: Added.
3389
3390 2016-10-25  Mark Lam  <mark.lam@apple.com>
3391
3392         String.prototype.replace() should throw an OutOfMemoryError when using too much memory.
3393         https://bugs.webkit.org/show_bug.cgi?id=163996
3394         <rdar://problem/28263117>
3395
3396         Reviewed by Geoffrey Garen.
3397
3398         * stress/string-prototype-replace-should-throw-out-of-memory-error-when-using-too-much-memory.js: Added.
3399
3400 2016-10-25  Mark Lam  <mark.lam@apple.com>
3401
3402         JSStringJoiner::joinedLength() should limit joined string lengths to INT_MAX.
3403         https://bugs.webkit.org/show_bug.cgi?id=163937
3404         <rdar://problem/28642990>
3405
3406         Reviewed by Geoffrey Garen.
3407
3408         * stress/joined-strings-should-not-exceed-max-string-length.js: Added.
3409
3410 2016-10-25  JF Bastien  <jfbastien@apple.com>
3411
3412         WebAssembly JS API: simple Module test
3413         https://bugs.webkit.org/show_bug.cgi?id=163963
3414
3415         Reviewed by Filip Pizlo.
3416
3417         * wasm/LowLevelBinary.js:
3418         (export.default.LowLevelBinary.prototype.get return): get the ArrayBuffer
3419         (export.default.LowLevelBinary.prototype.hexdump): Deleted.
3420         (export.default.LowLevelBinary.prototype._maybeGrow): Deleted.
3421         * wasm/js-api/test_Module.js: Added.
3422         (EmptyModule): The most basic module possible
3423
3424 2016-10-25  JF Bastien  <jfbastien@apple.com>
3425
3426         WebAssembly JS API: implement Module
3427
3428         This implementation allows us to:
3429          - Syncrhonously create a WebAssembly.Module with a typed array.
3430          - Creates a compilation plan.
3431          - Parse the Module and creates corresponding code.
3432          - Throw WebAssembly.CompileError with mildly helpful [*] error messages on
3433            failure.
3434
3435         Consult the API documentation for expected behavior: https://github.com/WebAssembly/design/blob/master/JS.md#webassemblymodule-constructor
3436
3437         For now the implementation discards the generated code.
3438
3439         The next steps will be:
3440          - Expose a Module's exports.
3441          - Implement WebAssembly.Instance, which allows instantiating and running a
3442            compiled Module.
3443          - Beef up the testing infrastructure under JSTests/wasm so that more complex
3444            modules can be created and tested (instead of writing the bits by hand).
3445
3446         This patch also:
3447          - Adds assert.instanceof in assert.js.
3448          - Refactors Wasm::Parser and friends to accept const uint8_t* as well as a
3449            Vector, to avoid copying when invoked synchronously.
3450          - Remove useless Structure from some of the wasm constructors: they're already
3451            on the JSGlobalObject, visited properly and all.
3452          - Fix off-by-one error in parsing: Parser::parseUInt32 failed if the integer
3453            was exactly at end of file.
3454
3455          [*] On error messages while parsing: I filed https://bugs.webkit.org/show_bug.cgi?id=163919
3456
3457         WebAssembly JS API: implement Module
3458         https://bugs.webkit.org/show_bug.cgi?id=163903
3459
3460         Reviewed by Keith Miller.
3461
3462         * wasm/assert.js: use underscore in name, and remove when exporting to avoid clasing with builtin names
3463         (const._notUndef):
3464         (const._isUndef):
3465         (const._eq):
3466         (const._ge):
3467         (const._throws):
3468         * wasm/js-api/test_basic_api.js: test the WebAssembly.Module API
3469         (const.c.in.constructorProperties.switch):
3470
3471 2016-10-25  Keith Miller  <keith_miller@apple.com>
3472
3473         Add trivial Wasm conversion opcodes
3474         https://bugs.webkit.org/show_bug.cgi?id=163950
3475
3476         Reviewed by Filip Pizlo.
3477
3478         This patch differentiates between Wasm opcodes that are trivially mapped to a B3 opcode and
3479         those that are not.  Some of the Wasm opcodes that are currently a non-simple opcode will
3480         become simple as we add B3 opcodes for Wasm operations.  The remaining opcodes will need to
3481         be added via patchpoints in a later patch.
3482
3483         * wasm/generate-wasmops-header.js:
3484         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.Wasm.inline.bool.isSimple):
3485         * wasm/wasm.json:
3486
3487 2016-10-24  Yusuke Suzuki  <utatane.tea@gmail.com>
3488
3489         Arrow functions with concise bodies cannot return regular expressions
3490         https://bugs.webkit.org/show_bug.cgi?id=163162
3491
3492         Reviewed by Filip Pizlo.
3493
3494         * ChakraCore/test/Operators/instanceof.baseline-jsc:
3495         * ChakraCore/test/Regex/nul_character.baseline-jsc:
3496         * ChakraCore/test/es5/Lex_u3.baseline-jsc:
3497         * stress/parse-regexp-as-token.js: Added.
3498         (shouldBe):
3499
3500 2016-10-24  Keith Miller  <keith_miller@apple.com>
3501
3502         Wasm should support floating point operations.
3503         https://bugs.webkit.org/show_bug.cgi?id=163770
3504
3505         Reviewed by Michael Saboff.
3506
3507         Add appropriate b3op names for floating point wasm bytecodes, where they exist.
3508         Also, fix some WASM => Wasm in WasmOps.h generator script that I missed
3509         the first time I made the change.
3510
3511         * wasm/generate-wasmops-header.js:
3512         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.WASM.template.typename.Int.inline.bool.isValidOpType): Deleted.
3513         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.WASM.enum.BinaryOpType): Deleted.
3514         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.WASM.enum.UnaryOpType): Deleted.
3515         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.WASM.enum.LoadOpType): Deleted.
3516         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.WASM.enum.StoreOpType): Deleted.
3517         (const.template.pragma.once.ENABLE.WEBASSEMBLY.include.cstdint.namespace.JSC.namespace.WASM.undef.CREATE_ENUM_VALUE.inline.bool.isControlOp): Deleted.
3518         * wasm/wasm.json:
3519
3520 2016-10-21  Saam Barati  <sbarati@apple.com>
3521
3522         SpeculativeJIT::compileTryGetById needs to pass in NeedsToSpill along both the cell speculation and untyped speculation path
3523         https://bugs.webkit.org/show_bug.cgi?id=163622
3524
3525         Reviewed by Yusuke Suzuki.
3526
3527         * stress/try-get-by-id-should-spill-registers-dfg.js: Added.
3528         (let.f.createBuiltin):
3529
3530 2016-10-21  Caitlin Potter  <caitp@igalia.com>
3531
3532         [JSC] don't crash when arguments to `new Function()` produce unexpected AST
3533         https://bugs.webkit.org/show_bug.cgi?id=163748
3534
3535         Reviewed by Mark Lam.
3536
3537         * stress/regress-163748.js: Added.
3538         (assert):
3539         (shouldThrowSyntaxError):
3540         (GeneratorFunction):
3541
3542 2016-10-20  Keith Miller  <keith_miller@apple.com>
3543
3544         Add support for WASM calls
3545         https://bugs.webkit.org/show_bug.cgi?id=161727
3546
3547         Reviewed by Filip Pizlo and Michael Saboff.
3548
3549         Add members of the Call category to the WASMOps special group.
3550
3551         * wasm/generate-wasmops-header.js:
3552
3553 2016-10-20  Yusuke Suzuki  <utatane.tea@gmail.com>
3554
3555         [JSC] Drop isEnvironmentRecord type info flag and use JSType information instead
3556         https://bugs.webkit.org/show_bug.cgi?id=163761
3557
3558         Reviewed by Keith Miller.
3559
3560         * modules/string-prototype-module-scope.js: Added.
3561         (shouldBe):
3562         (catch):
3563         (refer):
3564         * stress/string-prototype-scopes-global-lexical-environment-strict.js: Added.
3565         (shouldBe):
3566         (catch):
3567         * stress/string-prototype-scopes-global-lexical-environment.js: Added.
3568         (shouldBe):
3569         (catch):
3570         * stress/string-prototype-scopes-strict.js: Added.
3571         (shouldBe):
3572         (catch):
3573         (try.refer):
3574         (refer):
3575         * stress/string-prototype-scopes.js: Added.
3576         (shouldBe):
3577         (catch):
3578         (try.refer):
3579         (refer):
3580         (object.toString):
3581         (with):
3582
3583 2016-10-20  JF Bastien  <jfbastien@apple.com>
3584
3585         WebAssembly API: implement exception constructors properly
3586
3587          - Rename WebAssemblyObject to JSWebAssembly for consistency.
3588          - WebAssembly object now has its own prototype: add WebAssemblyPrototype, and
3589            use it to register JSWebAssembly's function properties through auto-generated
3590            .lut.h, instead of manually.
3591          - The error constructors used to throw (e.g. `new WebAssembly.CompileError()`).
3592          - Register WebAssembly's constructors from the global object, and hold a
3593            reference to their structure and prototype so that invoking the constructor
3594            can use the structure directly from the global object.
3595          - Add a prototype base field to global object creation. Previous ones all had
3596            Object's prototype as their base, but WebAssembly's error constructors have
3597            Error as their base.
3598          - Test for the error object's correctness.
3599          - Add missing #if ENABLE(WEBASSEMBLY)
3600
3601         WebAssembly API: implement exception constructors properly
3602         https://bugs.webkit.org/show_bug.cgi?id=163699
3603
3604         Reviewed by Keith Miller.
3605
3606         * wasm/js-api/test_basic_api.js:
3607         (const.c.in.constructorProperties): more tests
3608
3609 2016-10-20  Caitlin Potter  <caitp@igalia.com>
3610
3611         [JSC] disallow references to `await` in AsyncFunction formal parameters
3612         https://bugs.webkit.org/show_bug.cgi?id=163694
3613
3614         Reviewed by Saam Barati.
3615
3616         * stress/async-await-syntax.js:
3617
3618 2016-10-20  Keith Miller  <keith_miller@apple.com>
3619
3620         Invalid assertion in arguments elimination
3621         https://bugs.webkit.org/show_bug.cgi?id=163740
3622         <rdar://problem/27911462>
3623
3624         Reviewed by Michael Saboff.
3625
3626         * stress/direct-arguments-osr-entry.js: Added.
3627         (foo.):
3628         (foo):
3629
3630 2016-10-20  Caitlin Potter  <caitp@igalia.com>
3631
3632         [JSC] throw TypeError when constructing dynamically created JSGeneratorFunction
3633         https://bugs.webkit.org/show_bug.cgi?id=163714
3634
3635         Reviewed by Mark Lam.
3636
3637         Add missing test coverage that dynamically created
3638         JSGeneratorFunctions can not be constructed.
3639
3640         * stress/generator-function-constructor.js:
3641         (shouldThrow):
3642
3643 2016-10-19  JF Bastien  <jfbastien@apple.com>
3644
3645         JavaScript WebAssembly API: baby steps
3646
3647          - Expand WebAssembly constructors into their own files. This requires a lot of
3648            boilerplate, as well as adding the .lut.h files. All of the
3649            JSWebAssembly*.{h,cpp}, as well as Constructor and Prototype files, are
3650            currently the same between the 4 specified WebAssembly constructors. It'll be
3651            easy to implement individual functions on constructed objects as per the
3652            spec, and have each of these files diverge. The error constructors are also
3653            similar, except that their instance derives from ErrorInstance.
3654          - Use constructor macro when initializing the global object.
3655          - Dramatically improve testing of the WebAssembly API by checking for
3656            properties specified in the spec [*].
3657          - Clean up assert.js' exception testing.
3658          - Fix a copy-paste bug in wasm.json: floating-point const return values were
3659            swapped.
3660
3661         [*] https://github.com/WebAssembly/design/blob/master/JS.md
3662
3663         Implement more of the JavaScript WebAssembly API
3664         https://bugs.webkit.org/show_bug.cgi?id=163571
3665
3666         Reviewed by Keith Miller.
3667
3668         * wasm/assert.js:
3669         (export.const.isUndef): add this useful helper
3670         (export.const.throws): fold other throw checks into this one, and check message as well
3671         * wasm/js-api/test_basic_api.js:
3672         (const.checkOwnPropertyDescriptor): check own property descriptor follows the spec
3673         * wasm/self-test/test_BuilderJSON.js:
3674         (const.assertOpThrows): use new assert API
3675         (CheckedOpcodeArgumentsTooMany): ditto
3676         (CheckedOpcodeArgumentsNotEnough): ditto
3677         (CallInvalid): ditto
3678         (I32ConstInvalid): ditto
3679         (F32ConstInvalid): ditto (and this caugth the JSON copy-paste bug)
3680         (F64ConstInvalid): ditto
3681         * wasm/self-test/test_LowLevelBinary_varint.js: use new assert API
3682         * wasm/self-test/test_LowLevelBinary_varuint.js: use new assert API
3683         * wasm/utilities.js: add "global" object, used in basic API test (to access global.WebAssembly).
3684         * wasm/wasm.json: fix copy-paste
3685
3686 2016-10-19  Caitlin Potter  <caitp@igalia.com>
3687
3688         [JSC] forbid "use strict" directive in generator functions with non-simple parameters
3689         https://bugs.webkit.org/show_bug.cgi?id=163683
3690
3691         Reviewed by Geoffrey Garen.
3692
3693         Update various generator*-non-simple-param.js tests to be passing.
3694
3695         * test262.yaml:
3696
3697 2016-10-18  Mark Lam  <mark.lam@apple.com>
3698
3699         Invoking Object.prototype.__proto__ accessors directly should throw a TypeError.
3700         https://bugs.webkit.org/show_bug.cgi?id=154377
3701         <rdar://problem/27330808>
3702
3703         Reviewed by Filip Pizlo and Saam Barati.
3704
3705         * stress/object-prototype-proto-accessors-should-throw-on-undefined-this.js: Added.
3706
3707 2016-10-18  Keith Miller  <keith_miller@apple.com>