v8/test/mjsunit/compiler/osr-two.js
Sigurd Schneider c244072529 [mjsunit] Improve performance of osr-{one,two}
Bug: v8:7783
Change-Id: I49a6d1a4b22dcfdda206b1c00cfff16310a0458c
Reviewed-on: https://chromium-review.googlesource.com/1071609
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53336}
2018-05-24 13:09:00 +00:00

25 lines
479 B
JavaScript

// Copyright 2013 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: --use-osr --allow-natives-syntax
function f(x) {
var sum = 0;
var outer = 10;
while (outer > 0) {
var inner = 10;
while (inner > 0) {
sum += x;
inner--;
if (inner == 5) {
%OptimizeOsr();
}
}
outer--;
}
return sum;
}
assertEquals(500, f(5));