v8/test/debugger/debug/debug-compile-optimized.js
Yang Guo dbdf487f5e [debug] test that functions optimize without breakpoints.
This came up in the context of a Twitter discussion, see this particular
tweet https://twitter.com/hashseed/status/905684048382754817 and the
relevant thread.

Change-Id: If2447169df999b64ce701a44321d48ba1bff2a06
Reviewed-on: https://chromium-review.googlesource.com/654598
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47864}
2017-09-07 07:23:39 +00:00

32 lines
577 B
JavaScript

// Copyright 2014 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: --opt --no-always-opt
Debug = debug.Debug;
Debug.setListener(function() {});
function f() {}
f();
f();
%OptimizeFunctionOnNextCall(f);
f();
assertOptimized(f);
var bp = Debug.setBreakPoint(f);
assertUnoptimized(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
f();
assertUnoptimized(f);
Debug.clearBreakPoint(bp);
%OptimizeFunctionOnNextCall(f);
f();
assertOptimized(f);
Debug.setListener(null);