mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 14:41:29 +00:00

Pick up the current branch head for V8 4.9 https://github.com/v8/v8/commit/1ecba0f PR-URL: https://github.com/nodejs/node/pull/4722 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
42 lines
865 B
JavaScript
42 lines
865 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;});
|
|
}
|
|
|
|
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)));
|