e4c6f9488e
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
54 lines
919 B
JavaScript
54 lines
919 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() {
|
|
"use asm";
|
|
|
|
function w0(a) {
|
|
a = a | 0;
|
|
if (a) while (1);
|
|
return 42;
|
|
}
|
|
|
|
function w1(a) {
|
|
a = a | 0;
|
|
while (1) return 42;
|
|
return 106;
|
|
}
|
|
|
|
function d0(a) {
|
|
a = a | 0;
|
|
if (a) do ; while(1);
|
|
return 42;
|
|
}
|
|
|
|
function d1(a) {
|
|
a = a | 0;
|
|
do return 42; while(1);
|
|
return 107;
|
|
}
|
|
|
|
function f0(a) {
|
|
a = a | 0;
|
|
if (a) for (;;) ;
|
|
return 42;
|
|
}
|
|
|
|
function f1(a) {
|
|
a = a | 0;
|
|
for(;;) return 42;
|
|
return 108;
|
|
}
|
|
|
|
return { w0: w0, w1: w1, d0: d0, d1: d1, f0: f0, f1: f1 };
|
|
}
|
|
|
|
var m = Module();
|
|
assertEquals(42, m.w0(0));
|
|
assertEquals(42, m.w1(0));
|
|
assertEquals(42, m.d0(0));
|
|
assertEquals(42, m.d1(0));
|
|
assertEquals(42, m.f0(0));
|
|
assertEquals(42, m.f1(0));
|