v8/test/mjsunit/asm/uint32-less-than-shift.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

65 lines
1.2 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(stdlib, foreign, heap) {
'use asm';
function foo1(i1) {
i1 = i1 | 0;
var i10 = 0;
i10 = (i1 >> 5) | 0;
if (i10 >>> 0 < 5) {
return 1;
} else {
return 0;
}
return 0;
}
function foo2(i1) {
i1 = i1 | 0;
var i10 = 0;
i10 = ((i1 | 0) / 32) | 0;
if (i10 >>> 0 < 5) {
return 1;
} else {
return 0;
}
return 0;
}
function foo3(i1) {
i1 = i1 | 0;
var i10 = 0;
i10 = (i1 + 32 | 0) / 32 | 0;
if (i10 >>> 0 < 5) {
return 1;
} else {
return 0;
}
return 0;
}
return {foo1: foo1, foo2: foo2, foo3: foo3};
}
var m = Module(this, {}, undefined);
for (var i = 0; i < 4 * 32; i++) {
assertEquals(1, m.foo1(i));
assertEquals(1, m.foo2(i));
assertEquals(1, m.foo3(i));
}
for (var i = 4 * 32; i < 5 * 32; i++) {
assertEquals(1, m.foo1(i));
assertEquals(1, m.foo2(i));
assertEquals(0, m.foo3(i));
}
for (var i = 5 * 32; i < 10 * 32; i++) {
assertEquals(0, m.foo1(i));
assertEquals(0, m.foo2(i));
assertEquals(0, m.foo3(i));
}