blob: 7754b4c6cb7943f6a895e98aba26145c70cc083b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// 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.
const source =
`
function f(a, b, c) {
return 'bye';
};
f({}, [], true);
f(3, 2.3, {a: 42});
f(undefined, null, Symbol('hello'));
`;
let {session, contextGroup, Protocol} = InspectorTest.start("Test collecting type profile data with Profiler.takeTypeProfile.");
(async function testTypeProfile() {
await Protocol.Profiler.enable();
await Protocol.Profiler.startTypeProfile();
Protocol.Runtime.enable();
let {result: {scriptId}} = await Protocol.Runtime.compileScript({
expression: source,
sourceURL: arguments.callee.name,
persistScript: true
});
Protocol.Runtime.runScript({ scriptId });
let typeProfiles = await Protocol.Profiler.takeTypeProfile();
await session.logTypeProfile(typeProfiles.result.result[0],
source);
Protocol.Profiler.stoptTypeProfile();
Protocol.Profiler.disable();
await Protocol.Runtime.disable();
InspectorTest.completeTest();
})();
|