v8/test/mjsunit/asm/do-while-false.js
clemensh be1a5f7551 [asm] Fix lots of invalid asm.js tests
I identified lots of asm.js tests that are actually not valid according
to the spec, hence they execute in default-javascript-mode.
This CL fixes most of them by adding additional type annotations.

The atomic tests are totally non-spec-compliant by expecting a fourth
argument, and infinite-loops-taken expects a function-type parameter,
so I did not fix those.
I also did not fix the regression tests.

R=titzer@chromium.org, bradnelson@chromium.org
BUG=v8:4203

Review-Url: https://codereview.chromium.org/2663243002
Cr-Commit-Position: refs/heads/master@{#43179}
2017-02-14 09:26:52 +00:00

79 lines
1.5 KiB
JavaScript

// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function Module() {
"use asm";
function d0() {
do { } while(false);
return 110;
}
function d1() {
do { return 111; } while(false);
return 112;
}
function d2() {
do { break; } while(false);
return 113;
}
function d3(a) {
a = a | 0;
do { if (a) return 114; } while(false);
return 115;
}
function d4(a) {
a = a | 0;
do { if (a) return 116; else break; } while(false);
return 117;
}
function d5(a) {
a = a | 0;
do { if (a) return 118; } while(false);
return 119;
}
function d6(a) {
a = a | 0;
do {
if ((a | 0) == 0) return 120;
if ((a | 0) == 1) break;
if ((a | 0) == 2) return 122;
if ((a | 0) == 3) continue;
if ((a | 0) == 4) return 124;
} while(false);
return 125;
}
return {d0: d0, d1: d1, d2: d2, d3: d3, d4: d4, d5: d5, d6: d6};
}
var m = Module();
assertEquals(110, m.d0());
assertEquals(111, m.d1());
assertEquals(113, m.d2());
assertEquals(114, m.d3(1));
assertEquals(115, m.d3(0));
assertEquals(116, m.d4(1));
assertEquals(117, m.d4(0));
assertEquals(118, m.d5(1));
assertEquals(119, m.d5(0));
assertEquals(120, m.d6(0));
assertEquals(125, m.d6(1));
assertEquals(122, m.d6(2));
assertEquals(125, m.d6(3));
assertEquals(124, m.d6(4));
assertEquals(125, m.d6(5));