2015-06-09 08:16:32 +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-06-09 08:16:32 +00:00
|
|
|
|
|
|
|
function OSRInsideTry(x) {
|
|
|
|
try {
|
|
|
|
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
|
|
|
|
throw x;
|
|
|
|
} catch (e) {
|
|
|
|
return e + 1;
|
|
|
|
}
|
|
|
|
return x + 2;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(OSRInsideTry);
|
2015-06-09 08:16:32 +00:00
|
|
|
assertEquals(24, OSRInsideTry(23));
|
|
|
|
|
|
|
|
|
|
|
|
function OSRInsideCatch(x) {
|
|
|
|
try {
|
|
|
|
throw x;
|
|
|
|
} catch (e) {
|
|
|
|
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
|
|
|
|
return e + 1;
|
|
|
|
}
|
|
|
|
return x + 2;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(OSRInsideCatch);
|
2015-06-09 08:16:32 +00:00
|
|
|
assertEquals(24, OSRInsideCatch(23));
|
|
|
|
|
|
|
|
|
|
|
|
function OSRInsideFinally_Return(x) {
|
|
|
|
try {
|
|
|
|
throw x;
|
|
|
|
} finally {
|
|
|
|
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
|
|
|
|
return x + 1;
|
|
|
|
}
|
|
|
|
return x + 2;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(OSRInsideFinally_Return);
|
2015-06-09 08:16:32 +00:00
|
|
|
assertEquals(24, OSRInsideFinally_Return(23));
|
|
|
|
|
|
|
|
|
|
|
|
function OSRInsideFinally_ReThrow(x) {
|
|
|
|
try {
|
|
|
|
throw x;
|
|
|
|
} finally {
|
|
|
|
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
|
|
|
|
}
|
|
|
|
return x + 2;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(OSRInsideFinally_ReThrow);
|
2015-06-09 08:16:32 +00:00
|
|
|
assertThrows("OSRInsideFinally_ReThrow(new Error)", Error);
|