be1a5f7551
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}
43 lines
912 B
JavaScript
43 lines
912 B
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.
|
|
|
|
var error = "error";
|
|
function counter(x) {
|
|
return (function() { if (x-- == 0) throw error;});
|
|
}
|
|
|
|
// TODO(asm): This module is not valid asm.js.
|
|
function Module() {
|
|
"use asm";
|
|
|
|
function w0(f) {
|
|
while (1) f();
|
|
return 108;
|
|
}
|
|
|
|
function w1(f) {
|
|
if (1) while (1) f();
|
|
return 109;
|
|
}
|
|
|
|
function w2(f) {
|
|
if (1) while (1) f();
|
|
else while (1) f();
|
|
return 110;
|
|
}
|
|
|
|
function w3(f) {
|
|
if (0) while (1) f();
|
|
return 111;
|
|
}
|
|
|
|
return { w0: w0, w1: w1, w2: w2, w3: w3 };
|
|
}
|
|
|
|
var m = Module();
|
|
assertThrowsEquals(function() { m.w0(counter(5)) }, error);
|
|
assertThrowsEquals(function() { m.w1(counter(5)) }, error);
|
|
assertThrowsEquals(function() { m.w2(counter(5)) }, error);
|
|
assertEquals(111, m.w3(counter(5)));
|