41ef63df21
With bytecode flushing and lazy feedback allocation, we need to call %PrepareForOptimization before we call %OptimizeFunctionOnNextCall Bug: v8:8801, v8:8394 Change-Id: I81918f174b2f97cbaa8b8ef2e459080c2581f535 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1588415 Commit-Queue: Mythri Alle <mythria@chromium.org> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#61122}
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
// Copyright 2019 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.
|
|
|
|
(function() {
|
|
|
|
function Simple() {
|
|
new Error("Simple Error");
|
|
}
|
|
|
|
class CustomError extends Error {};
|
|
function Custom() {
|
|
new CustomError("Custom Error");
|
|
}
|
|
|
|
function Inline() {
|
|
function Inner() {
|
|
new Error("Error from inlined function!");
|
|
}
|
|
function Middle() { Inner(); }
|
|
function Outer() { Middle(); }
|
|
|
|
%PrepareFunctionForOptimization(Outer);
|
|
Outer();
|
|
Outer();
|
|
%OptimizeFunctionOnNextCall(Outer);
|
|
Outer();
|
|
}
|
|
|
|
const kInitialRecursionValue = 10;
|
|
function Recursive() {
|
|
function StepOne(val) {
|
|
if (val <= 0) return new Error("Error in StepOne!");
|
|
StepTwo(val - 3);
|
|
StepTwo(val - 4);
|
|
}
|
|
function StepTwo(val) {
|
|
if (val <= 0) return new Error("Error in StepTwo!");
|
|
StepOne(val - 1);
|
|
StepOne(val - 2);
|
|
}
|
|
|
|
StepOne(kInitialRecursionValue);
|
|
}
|
|
|
|
createSuite('Simple-Capture-Error', 1000, Simple, () => {});
|
|
createSuite('Custom-Capture-Error', 1000, Custom, () => {});
|
|
|
|
createSuite('Inline-Capture-Error', 1000, Inline, () => {});
|
|
createSuite('Recursive-Capture-Error', 1000, Recursive, () => {});
|
|
|
|
})();
|