v8/test/mjsunit/regress/regress-crbug-530598.js
mstarzinger 9e47ec6eda [turbofan] Fix JSInliner to handle non-returning bodies.
The assumption that every function body produces a value does not hold
for functions that e.g. unconditionally throw or endlessly loop. This
fixes the inlining logic to handle such cases.

R=bmeurer@chromium.org
TEST=mjsunit/regress/regress-crbug-530598
BUG=chromium:530598
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#30738}
2015-09-15 11:19:23 +00:00

26 lines
607 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: --allow-natives-syntax --turbo-inlining
var f1 = (function() {
"use asm";
function g() { throw 0; }
function f() { return g(); }
return f;
})();
assertThrows("f1()");
%OptimizeFunctionOnNextCall(f1);
assertThrows("f1()");
var f2 = (function() {
"use asm";
function g() { for (;;); }
function f(a) { return a || g(); }
return f;
})();
assertTrue(f2(true));
%OptimizeFunctionOnNextCall(f2);
assertTrue(f2(true));