v8/test/mjsunit/asm/do-while.js
bmeurer@chromium.org 95095af57f [turbofan] Improve typed lowering for JSToBoolean.
- JSToBoolean(x:string) => BooleanNot(NumberEqual(x.length, #0))
- JSToBoolean(phi(x1,...,xn):primitive) => phi(JSToBoolean(x1),...,JSToBoolean(xn))

TEST=cctest,mjsunit/asm/do-while,mjsunit/boolean,unittests
R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/681223002

Cr-Commit-Position: refs/heads/master@{#24919}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24919 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-28 08:34:15 +00:00

31 lines
661 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.
function Module(stdlib, foreign, buffer) {
"use asm";
function f(i) {
var j;
i = i|0;
do {
if (i > 0) {
j = i != 0;
i = (i - 1) | 0;
} else {
j = 0;
}
} while (j);
return i;
}
return {f:f};
}
var m = Module(this, {}, new ArrayBuffer(64*1024));
assertEquals(-1, m.f("-1"));
assertEquals(0, m.f(-Math.infinity));
assertEquals(0, m.f(undefined));
assertEquals(0, m.f(0));
assertEquals(0, m.f(1));
assertEquals(0, m.f(100));