e20ef0249f
We need this benchmark to measure speedup of getPossibleBreakpoints method by [1]. [1] https://chromium-review.googlesource.com/c/591027/ R=dgozman@chromium.org Bug: none Change-Id: I617a435d5a162800caae2fb85596839a57d4d9bd Reviewed-on: https://chromium-review.googlesource.com/592308 Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#46992}
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
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.
|
|
|
|
(function() {
|
|
function benchy(name, test, testSetup) {
|
|
new BenchmarkSuite(name, [10000], [
|
|
new Benchmark(name, false, false, 0, test, testSetup, TearDown)
|
|
]);
|
|
}
|
|
|
|
benchy('Debugger.paused', DebuggerPaused, Setup);
|
|
benchy('Debugger.getPossibleBreakpoints',
|
|
DebuggerGetPossibleBreakpoints,
|
|
SetupGetPossibleBreakpoints);
|
|
|
|
function Setup() {
|
|
SendMessage('Debugger.enable');
|
|
// Force lazy compilation of inspector related scripts.
|
|
SendMessage('Runtime.evaluate', {expression: ''});
|
|
}
|
|
|
|
function TearDown() {
|
|
SendMessage('Debugger.disable');
|
|
}
|
|
|
|
function DebuggerPaused() {
|
|
for (var i = 0; i < 10; ++i) {
|
|
debugger;
|
|
}
|
|
}
|
|
|
|
let scriptId;
|
|
function SetupGetPossibleBreakpoints() {
|
|
Setup();
|
|
let expression = '';
|
|
for (let i = 0; i < 20; ++i) {
|
|
expression += `function foo${i}(){
|
|
if (a) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}\n`;
|
|
}
|
|
listener = function(msg) {
|
|
if (msg.method === "Debugger.scriptParsed") {
|
|
scriptId = msg.params.scriptId;
|
|
listener = null;
|
|
}
|
|
}
|
|
SendMessage('Runtime.evaluate', {expression});
|
|
}
|
|
|
|
function DebuggerGetPossibleBreakpoints() {
|
|
SendMessage('Debugger.getPossibleBreakpoints', {
|
|
start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}
|
|
});
|
|
}
|
|
})();
|