v8/test/mjsunit/regress/regress-1257.js
jgruber 3ae2b9ebf0 [mjsunit] Speed up regress-1257
This test used to run 10M loop iterations to trigger OSR. Let's run 5
instead and trigger OSR manually through the runtime.

Bug: v8:7093
Change-Id: Ie0cdb9389ca465bf433e81a17fa60c300edc3e29
Reviewed-on: https://chromium-review.googlesource.com/785693
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49579}
2017-11-22 14:28:09 +00:00

35 lines
670 B
JavaScript

// Copyright 2017 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
function g(y) { assertEquals(y, 12); }
var X = 0;
function foo () {
var cnt = 0;
var l = -1;
var x = 0;
while (1) switch (l) {
case -1:
var y = x + 12;
l = 0;
break;
case 0:
if (cnt++ == 5) {
%OptimizeOsr();
l = 1;
}
break;
case 1:
// This case will contain deoptimization
// because it has no type feedback.
g(y);
return;
};
}
foo();