v8/test/mjsunit/asm/redundancy2.js
Benedikt Meurer d8cfbc633d [turbofan] Split pure nodes in the scheduler if beneficial.
If a (pure) node has two or more uses, but there exists a path from the
common dominator of these uses to end, which does not contain a use,
then we split the node such that no unnecessary computation takes place.
Note however, that this only applies if the node cannot be hoisted out
of a loop.

BUG=v8:3864
LOG=n
R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#26404}
2015-02-03 14:51:08 +00:00

30 lines
616 B
JavaScript

// Copyright 2015 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.
// Flags: --turbo-splitting
function module(stdlib, foreign, heap) {
"use asm";
function foo(i) {
var j = 0;
i = i|0;
switch (i) {
case 0:
j = i+1|0;
break;
case 1:
j = i+1|0;
break;
default:
j = i;
break;
}
return j;
}
return { foo: foo };
}
var foo = module(this, {}, new ArrayBuffer(64*1024)).foo;
print(foo(1));