v8/test/mjsunit/code-coverage-block-opt.js
jgruber 6e4d2a60ba [coverage] Refactor tests
Refactor common test code into code-coverage-utils.js and add tests to
verify counter behavior in opt/no-opt situations.

Bug: v8:6000
Change-Id: I07e62345476e8c81521c491ae605ddaf71600667
Reviewed-on: https://chromium-review.googlesource.com/584449
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46888}
2017-07-26 06:40:07 +00:00

26 lines
898 B
JavaScript

// Copyright 2017 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: --allow-natives-syntax --no-always-opt --block-coverage
// Flags: --no-stress-fullcodegen --harmony-async-iteration --opt
// Files: test/mjsunit/code-coverage-utils.js
%DebugToggleBlockCoverage(true);
TestCoverage(
"optimized and inlined functions",
`
function g() { if (true) nop(); } // 0000
function f() { g(); g(); } // 0050
f(); f(); %OptimizeFunctionOnNextCall(f); // 0100
f(); f(); f(); f(); f(); f(); // 0150
`,
[{"start":0,"end":199,"count":1},
{"start":0,"end":33,"count":4}, // TODO(jgruber): Invocation count is off.
{"start":25,"end":33,"count":16},
{"start":50,"end":76,"count":2}] // TODO(jgruber): Invocation count is off.
);
%DebugToggleBlockCoverage(false);