2015-03-10 09:27:33 +00:00
|
|
|
// 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.
|
|
|
|
|
2016-05-09 09:10:19 +00:00
|
|
|
// Flags: --allow-natives-syntax
|
2015-03-10 09:27:33 +00:00
|
|
|
|
|
|
|
function test(e, f, v) {
|
|
|
|
assertEquals(e, f(v));
|
|
|
|
assertEquals(e, f(v));
|
|
|
|
assertEquals(e, f(v));
|
|
|
|
}
|
|
|
|
|
|
|
|
function foo(t) {
|
|
|
|
for (var x in t) {
|
|
|
|
for (var i = 0; i < 2; i++) {
|
|
|
|
%OptimizeOsr();
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2015-03-10 09:27:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 5;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2015-03-10 09:27:33 +00:00
|
|
|
|
|
|
|
test(5, foo, {x:20});
|
|
|
|
|
|
|
|
function bar(t) {
|
|
|
|
var sum = 0;
|
|
|
|
for (var x in t) {
|
|
|
|
for (var i = 0; i < 2; i++) {
|
|
|
|
%OptimizeOsr();
|
|
|
|
sum += t[x];
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-03-10 09:27:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-03-10 09:27:33 +00:00
|
|
|
|
|
|
|
test(62, bar, {x:20,y:11});
|