d8cfbc633d
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}
27 lines
585 B
JavaScript
27 lines
585 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;
|
|
if (i < 0) {
|
|
j = i+1|0;
|
|
}
|
|
if (i > 0) {
|
|
j = i+1|0;
|
|
}
|
|
return j;
|
|
}
|
|
return { foo: foo };
|
|
}
|
|
|
|
var foo = module(this, {}, new ArrayBuffer(64*1024)).foo;
|
|
assertEquals(0, foo(0));
|
|
assertEquals(0, foo(-1));
|
|
assertEquals(12, foo(11));
|