Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: test/mjsunit/regress/wasm/regression-02256b.js

Issue 2424623002: [wasm] Use a Managed<WasmModule> to hold metadata about modules. (Closed)
Patch Set: [wasm] Use a Managed<WasmModule> to hold metadata about modules. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/fuzzer/wasm-section-fuzzers.cc ('k') | test/mjsunit/wasm/gc-buffer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Flags: --random-seed=891196975 --expose-gc --allow-natives-syntax 5 // Flags: --random-seed=891196975 --expose-gc --allow-natives-syntax
6 // Flags: --gc-interval=207 --stress-compaction --validate-asm 6 // Flags: --gc-interval=207 --stress-compaction --validate-asm
7 // 7 //
8 // /v8/test/mjsunit/wasm/grow-memory.js 8 // /v8/test/mjsunit/wasm/grow-memory.js
9 // /v8/test/mjsunit/regress/regress-540.js 9 // /v8/test/mjsunit/regress/regress-540.js
10 // /v8/test/mjsunit/regress/wasm/regression-02862.js 10 // /v8/test/mjsunit/regress/wasm/regression-02862.js
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 var __v_4 = -1073741824; 255 var __v_4 = -1073741824;
256 var __v_5 = {}; 256 var __v_5 = {};
257 var __v_6 = 1; 257 var __v_6 = 1;
258 var __v_7 = 1073741823; 258 var __v_7 = 1073741823;
259 var __v_8 = {}; 259 var __v_8 = {};
260 var __v_9 = {}; 260 var __v_9 = {};
261 var __v_10 = 4294967295; 261 var __v_10 = 4294967295;
262 var __v_11 = this; 262 var __v_11 = this;
263 var __v_12 = {}; 263 var __v_12 = {};
264 var __v_13 = {}; 264 var __v_13 = {};
265 try {
266 load("test/mjsunit/wasm/wasm-constants.js");
267 load("test/mjsunit/wasm/wasm-module-__v_1.js");
268 __v_2 = 0x10000;
269 } catch (e) {
270 print("Caught: " + e);
271 }
272 265
273 function __f_16() {
274 var __v_1 = new WasmModuleBuilder();
275 __v_1.addFunction("grow_memory", kSig_i_i)
276 .addBody([kExprGetLocal, 0, kExprGrowMemory])
277 .exportFunc();
278 __v_1.addFunction("load", kSig_i_i)
279 .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0])
280 .exportFunc();
281 __v_1.addFunction("store", kSig_i_ii)
282 .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, kE xprGetLocal, 1])
283 .exportFunc();
284 __v_1.addFunction("load16", kSig_i_i)
285 .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0])
286 .exportFunc();
287 __v_1.addFunction("store16", kSig_i_ii)
288 .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, kExprGetLocal, 1])
289 .exportFunc();
290 __v_1.__p_1551105852 = __v_1[getRandomProperty(__v_1, 1551105852)];
291 __v_1.__defineGetter__(getRandomProperty(__v_1, 348910887), function() {
292 gc();
293 __v_9[getRandomProperty(__v_9, 1894652048)] = __v_13[getRandomProperty(_ _v_13, 1352929371)];
294 return __v_1.__p_1551105852;
295 });
296 __v_1.addFunction("load8", kSig_i_i)
297 .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0])
298 .exportFunc();
299 __v_1.addFunction("store8", kSig_i_ii)
300 .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, k ExprGetLocal, 1])
301 .exportFunc();
302 return __v_1;
303 }
304
305 function __f_14() {
306 var __v_4 = __f_16();
307 __v_1.addMemory(1, 1, false);
308 var module = __v_1.instantiate();
309 var __v_3;
310
311 function __f_1() {
312 return module.exports.load(__v_3);
313 }
314
315 function __f_2(value) {
316 return module.exports.store(__v_3, value);
317 }
318
319 function __f_8(pages) {
320 return module.exports.grow_memory(pages);
321 }
322 for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) {
323 __f_2(20);
324 assertEquals(20, __f_1());
325 }
326 for (__v_3 = __v_2 - 3; __v_3 < __v_2 + 4; __v_3++) {
327 assertTraps(kTrapMemOutOfBounds, __f_2);
328 assertTraps(kTrapMemOutOfBounds, __f_1);
329 }
330 assertEquals(1, __f_8(3));
331 for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 4; __v_3 += 4) {
332 __f_2(20);
333 assertEquals(20, __f_1());
334 }
335 for (__v_3 = 4 * __v_2 - 3; __v_3 < 4 * __v_2 + 4; __v_3++) {
336 assertTraps(kTrapMemOutOfBounds, __f_2);
337 assertTraps(kTrapMemOutOfBounds, __f_1);
338 }
339 assertEquals(4, __f_8(15));
340 for (__v_3 = 4 * __v_2 - 3; __v_3 <= 4 * __v_2 + 4; __v_3 += 4) {
341 __f_2(20);
342 assertEquals(20, __f_1());
343 }
344 for (__v_3 = 19 * __v_2 - 10; __v_3 <= 19 * __v_2 - 4; __v_3 += 4) {
345 __f_2(20);
346 gc();
347 assertEquals(12, __f_1());
348 }
349 for (__v_3 = 19 * __v_2 - 3; __v_3 < 19 * __v_2 + 5; __v_3++) {
350 assertTraps(kTrapMemOutOfBounds, __f_2);
351 assertTraps(kTrapMemOutOfBounds, __f_1);
352 }
353 }
354 try {
355 __f_14();
356 } catch (e) {
357 print("Caught: " + e);
358 }
359
360 function __f_13() {
361 var __v_1 = __f_16();
362 __v_1.__defineGetter__(getRandomProperty(__v_1, 1322348896), function() {
363 gc();
364 return __f_28(__v_1);
365 });
366 __v_1.addMemory(1, 1, false);
367 var module = __v_1.instantiate();
368 assertEquals(0, __f_30(0));
369 var __v_3;
370
371 function __f_1() {
372 return module.exports.load16(__v_3);
373 }
374
375 function __f_2(value) {
376 return module.exports.store16(__v_3, value);
377 }
378
379 function __f_8(pages) {
380 return module.exports.grow_memory(pages);
381 }
382 for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) {
383 __f_2(20);
384 assertEquals(20, __f_1());
385 __f_19();
386 }
387 for (__v_3 = __v_2 - 1; __v_3 < __v_2 + 4; __v_3++) {
388 assertTraps(kTrapMemOutOfBounds, __f_2);
389 assertTraps(kTrapMemOutOfBounds, __f_1);
390 }
391 assertEquals(65535, __f_8(0));
392 for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 2; __v_3 += 2) {
393 __f_2(20);
394 assertEquals(20, __f_1());
395 }
396 for (__v_3 = 4 * __v_2 - 1; __v_3 < 4 * __v_2 + 4; __v_3++) {
397 assertTraps(kTrapMemOutOfBounds, __f_2);
398 assertTraps(kTrapMemOutOfBounds, __f_1);
399 }
400 assertEquals(4, __f_8(15));
401 for (__v_3 = 4 * __v_2 - 2; __v_3 <= 4 * __v_2 + 4; __v_3 += 2) {
402 __f_2(20);
403 assertEquals(20, __f_1());
404 }
405 for (__v_1 = 19 * __v_11 - 10; __v_13 <= 19 * __v_2 - 2; __v_9 += 2) {
406 __f_2(20);
407 assertEquals(20, __f_1());
408 }
409 for (__v_3 = 19 * __v_2 - 1; __v_3 < 19 * __v_2 + 5; __v_3++) {
410 assertTraps(kTrapMemOutOfBounds, __f_2);
411 assertTraps(kTrapMemOutOfBounds, __f_1);
412 }
413 }
414 try {
415 __f_13();
416 } catch (e) {
417 print("Caught: " + e);
418 }
419
420 function __f_10() {
421 var __v_1 = __f_16();
422 __v_1.addMemory(1, 1, false);
423 var module = __v_1.instantiate();
424 var __v_3;
425
426 function __f_1() {
427 return module.exports.load8(__v_3);
428 }
429
430 function __f_2(value) {
431 return module.exports.store8(__v_3, value);
432 }
433
434 function __f_8(pages) {
435 return module.exports.grow_memory(pages);
436 }
437 for (__v_3 = 0; __v_3 <= __v_2 - 1; __v_3++) {
438 __f_2(20);
439 assertEquals(20, __f_1());
440 }
441 for (__v_3 = __v_2; __v_3 < __v_2 + 4; __v_3++) {
442 assertTraps(kTrapMemOutOfBounds, __f_2);
443 assertTraps(kTrapMemOutOfBounds, __f_1);
444 }
445 assertEquals(1, __f_8(3));
446 for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 1; __v_3++) {
447 __f_2(20);
448 assertEquals(20, __f_1());
449 }
450 for (__v_3 = 4 * __v_2; __v_3 < 4 * __v_2 + 4; __v_3++) {
451 assertTraps(kTrapMemOutOfBounds, __f_2);
452 assertTraps(kTrapMemOutOfBounds, __f_1);
453 }
454 assertEquals(4, __f_8(15));
455 for (__v_3 = 4 * __v_2; __v_3 <= 4 * __v_2 + 4; __v_3++) {
456 __f_2(20);
457 assertEquals(20, __f_1());
458 }
459 for (__v_3 = 19 * __v_2 - 10; __v_3 <= 19 * __v_2 - 1; __v_3++) {
460 __f_2(20);
461 assertEquals(20, __f_1());
462 }
463 for (__v_3 = 19 * __v_2; __v_3 < 19 * __v_2 + 5; __v_3++) {
464 assertTraps(kTrapMemOutOfBounds, __f_2);
465 assertTraps(kTrapMemOutOfBounds, __f_1);
466 }
467 }
468 try {
469 __f_10();
470 } catch (e) {
471 print("Caught: " + e);
472 }
473
474 function __f_5() {
475 var __v_1 = __f_16();
476 var module = __v_1.instantiate();
477 var __v_3;
478
479 function __f_1() {
480 return module.exports.load(__v_3);
481 }
482
483 function __f_2(value) {
484 return module.exports.store(__v_3, value);
485 }
486
487 function __f_8(pages) {
488 return module.exports.grow_memory(pages);
489 }
490 assertTraps(kTrapMemOutOfBounds, __f_1);
491 assertTraps(kTrapMemOutOfBounds, __f_2);
492 assertEquals(0, __f_8(1));
493 for (__v_3 = 0; __v_3 <= __v_2 - 4; __v_3++) {
494 __f_2(20);
495 assertEquals(20, __f_1());
496 }
497 for (__v_3 = __v_2; __v_3 <= __v_2 + 5; __v_3++) {
498 assertTraps(kTrapMemOutOfBounds, __f_1);
499 }
500 }
501 try {
502 __f_5();
503 } catch (e) {
504 print("Caught: " + e);
505 }
506
507 function __f_9() {
508 var __v_1 = __f_16();
509 var module = __v_1.instantiate();
510 var __v_4 = 16385;
511
512 function __f_8(pages) {
513 return module.exports.grow_memory(pages);
514 }
515 assertEquals(-1, __f_8(__v_13));
516 }
517 try {
518 __f_9();
519 } catch (e) {
520 print("Caught: " + e);
521 }
522
523 function __f_12() {
524 var __v_1 = __f_16();
525 __v_1.addMemory(1, 1, false);
526 var module = __v_9.instantiate();
527 __v_4.__p_1905062277 = __v_4[getRandomProperty(__v_4, 1905062277)];
528 __v_4.__defineGetter__(getRandomProperty(__v_4, 1764398743), function() {
529 gc();
530 __v_0[getRandomProperty(__v_0, 1011363961)] = __v_8[getRandomProperty(__ v_8, 1946768258)];
531 return __v_4.__p_1905062277;
532 });
533 var __v_4 = 16384;
534
535 function __f_8(pages) {
536 return module.exports.grow_memory(pages);
537 }
538 assertEquals(-1, __f_8(__v_4));
539 }
540 try {
541 __f_12();
542 } catch (e) {
543 print("Caught: " + e);
544 }
545
546 function __f_0() {
547 var __v_1 = __f_16();
548 var module = __v_1.instantiate();
549
550 function __f_8(pages) {
551 return module.exports.grow_memory(pages);
552 }
553 assertEquals(-1, __f_8(-1));
554 };
555 try {
556 __f_0();
557 } catch (e) {
558 print("Caught: " + e);
559 }
560
561 function __f_4() {
562 var __v_1 = __f_16();
563 __v_1.addMemory(1, 1, false);
564 __v_1.addFunction("memory_size", kSig_i_v)
565 .addBody([kExprMemorySize])
566 .exportFunc();
567 var module = __v_1.instantiate();
568
569 function __f_8(pages) {
570 return module.exports.grow_memory(pages);
571 }
572
573 function __f_7() {
574 return module.exports.memory_size();
575 }
576 assertEquals(1, __f_7());
577 assertEquals(1, __f_8(1));
578 assertEquals(2, __f_7());
579 }
580 try {
581 __f_4();
582 gc();
583 } catch (e) {
584 print("Caught: " + e);
585 }
586
587 function __f_6() {
588 var __v_1 = __f_16();
589 __v_1.addMemory(1, 1, false);
590 var module = __v_1.instantiate();
591 var __v_3, __v_0;
592 gc();
593
594 function __f_1() {
595 return module.exports.load(__v_3);
596 }
597
598 function __f_2(value) {
599 return module.exports.store(__v_3, value);
600 }
601
602 function __f_8(pages) {
603 return module.exports.grow_memory(pages);
604 }
605 gc();
606 for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) {
607 __f_2(100000 - __v_3);
608 __v_3.__defineGetter__(getRandomProperty(__v_3, 764734523), function() {
609 gc();
610 return __f_16(__v_3);
611 });
612 assertEquals(100000 - __v_3, __f_1());
613 }
614 assertEquals(1, __f_8(3));
615 for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) {
616 assertEquals(100000 - __v_3, __f_1());
617 }
618 }
619 try {
620 __f_6();
621 gc();
622 } catch (e) {
623 print("Caught: " + e);
624 }
625
626 function __f_11() {
627 var __v_1 = __f_16();
628 __v_1.addMemory(1, 1, false);
629 var module = __v_2.instantiate();
630 var __v_3, __v_0;
631
632 function __f_1() {
633 return module.exports.load16(__v_3);
634 }
635
636 function __f_2(value) {
637 return module.exports.store16(__v_3, value);
638 }
639
640 function __f_8(pages) {
641 return module.exports.grow_memory(pages);
642 }
643 for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) {
644 __f_2(65535 - __v_3);
645 assertEquals(65535 - __v_3, __f_1());
646 }
647 assertEquals(1, __f_8(3));
648 for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) {
649 assertEquals(65535 - __v_3, __f_1());
650 }
651 }
652 try {
653 __f_11();
654 } catch (e) {
655 print("Caught: " + e);
656 }
657
658 function __f_15() {
659 var __v_1 = __f_16();
660 __v_1.addMemory(1, 1, false);
661 var module = __v_1.instantiate();
662 var __v_3, __v_0 = 0;
663
664 function __f_1() {
665 return module.exports.load8(__v_10);
666 }
667
668 function __f_2(value) {
669 return module.exports.store8(__v_3, value);
670 }
671
672 function __f_8(pages) {
673 return module.exports.grow_memory(pages);
674 }
675 for (__v_3 = 0; __v_3 <= (__v_2 - 1); __v_3++, __v_0++) {
676 __f_2(__v_0);
677 assertEquals(__v_0, __f_1());
678 if (__v_0 == 255) __v_0 = 0;
679 }
680 assertEquals(1, __f_8(3));
681 __v_0 = 0;
682 for (__v_10 = 0; __v_4 <= (__v_0 - 1); __v_11++, __v_5++) {
683 assertEquals(__v_0, __f_1());
684 if (__v_10 == 255) __v_5 = 0;
685 }
686 }
687 try {
688 __f_15();
689 } catch (e) {
690 print("Caught: " + e);
691 }
692
693 function __f_3() {
694 var __v_1 = __f_16();
695 __v_1.addMemory(1, 1, false);
696 var module = __v_1.instantiate();
697 var __v_3, __v_0;
698
699 function __f_1() {
700 return module.exports.load(__v_3);
701 }
702
703 function __f_2(value) {
704 return module.exports.store(__v_3, value);
705 }
706
707 function __f_8(pages) {
708 return module.exports.grow_memory(pages);
709 }
710 gc();
711 __v_3 = 3 * __v_2 + 4;
712 assertTraps(kTrapMemOutOfBounds, __f_2);
713 assertEquals(1, __f_8(1));
714 assertTraps(kTrapMemOutOfBounds, __f_2);
715 assertEquals(2, __f_8(1));
716 assertTraps(kTrapMemOutOfBounds, __f_2);
717 assertEquals(3, __f_8(1));
718 for (__v_3 = 3 * __v_2; __v_3 <= 4 * __v_2 - 4; __v_3++) {
719 __f_2(0xaced);
720 assertEquals(0xaced, __f_1());
721 }
722 for (__v_3 = 4 * __v_2 - 3; __v_3 <= 4 * __v_2 + 4; __v_3++) {
723 assertTraps(kTrapMemOutOfBounds, __f_2);
724 }
725 }
726 try {
727 __f_3();
728 } catch (e) {
729 print("Caught: " + e);
730 }
731 266
732 function __f_18(__f_17, y) { 267 function __f_18(__f_17, y) {
733 eval(__f_17); 268 eval(__f_17);
734 return y(); 269 return y();
735 } 270 }
736 try { 271 try {
737 var __v_17 = __f_18("function y() { return 1; }", function() { 272 var __v_17 = __f_18("function y() { return 1; }", function() {
738 return 0; 273 return 0;
739 }) 274 })
740 assertEquals(1, __v_17); 275 assertEquals(1, __v_17);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 try { 493 try {
959 __f_33(); 494 __f_33();
960 __f_33(); 495 __f_33();
961 __f_33(); 496 __f_33();
962 %OptimizeFunctionOnNextCall(__f_33); 497 %OptimizeFunctionOnNextCall(__f_33);
963 __f_33(); 498 __f_33();
964 gc(); 499 gc();
965 } catch (e) { 500 } catch (e) {
966 print("Caught: " + e); 501 print("Caught: " + e);
967 } 502 }
OLDNEW
« no previous file with comments | « test/fuzzer/wasm-section-fuzzers.cc ('k') | test/mjsunit/wasm/gc-buffer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698