v8/test/mjsunit/asm/infinite-loops-taken.js
titzer@chromium.org e4c6f9488e Implement graph trimming in ControlReducer.
Trimming the graph consists of breaking links from nodes that are not reachable from end to nodes that are reachable from end. Such dead nodes show up in the use lists of the live nodes and though mostly harmless, just clutter up the graph. They also can limit instruction selection opportunities, so it is good to get rid of them.

This CL is one half of the ControlReducer functionality, the other half
being branch folding.

R=bmeurer@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24694 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-17 11:51:57 +00:00

42 lines
847 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();
assertThrows(function() { m.w0(counter(5)) }, error);
assertThrows(function() { m.w1(counter(5)) }, error);
assertThrows(function() { m.w2(counter(5)) }, error);
assertEquals(111, m.w3(counter(5)));