| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --allow-natives-syntax --no-always-opt --opt | 5 // Flags: --allow-natives-syntax --no-always-opt --opt |
| 6 | 6 |
| 7 var source = | 7 var source = |
| 8 ` | 8 ` |
| 9 function fib(x) { | 9 function fib(x) { |
| 10 if (x < 2) return 1; | 10 if (x < 2) return 1; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return function nested_3() {} | 43 return function nested_3() {} |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 function nested_4() {} | 47 function nested_4() {} |
| 48 return nested_0(); | 48 return nested_0(); |
| 49 })(); | 49 })(); |
| 50 f()()(); | 50 f()()(); |
| 51 `; | 51 `; |
| 52 | 52 |
| 53 InspectorTest.log("Test collecting code coverage data with Profiler.collectCover
age."); | 53 let {session, contextGroup, Protocol} = InspectorTest.start("Test collecting cod
e coverage data with Profiler.collectCoverage."); |
| 54 | 54 |
| 55 function ClearAndGC() { | 55 function ClearAndGC() { |
| 56 return Protocol.Runtime.evaluate({ expression: "fib = g = f = h = is_optimized
= null;" }) | 56 return Protocol.Runtime.evaluate({ expression: "fib = g = f = h = is_optimized
= null;" }) |
| 57 .then(GC); | 57 .then(GC); |
| 58 } | 58 } |
| 59 | 59 |
| 60 function GC() { | 60 function GC() { |
| 61 return Protocol.HeapProfiler.enable() | 61 return Protocol.HeapProfiler.enable() |
| 62 .then(() => Protocol.HeapProfiler.collectGarbage()) | 62 .then(() => Protocol.HeapProfiler.collectGarbage()) |
| 63 .then(() => Protocol.HeapProfiler.disable()); | 63 .then(() => Protocol.HeapProfiler.disable()); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 .then(() => Protocol.Runtime.evaluate({ expression: "f()" })) | 258 .then(() => Protocol.Runtime.evaluate({ expression: "f()" })) |
| 259 .then(Protocol.Profiler.takePreciseCoverage) | 259 .then(Protocol.Profiler.takePreciseCoverage) |
| 260 .then(LogSorted) | 260 .then(LogSorted) |
| 261 .then(Protocol.Profiler.stopPreciseCoverage) | 261 .then(Protocol.Profiler.stopPreciseCoverage) |
| 262 .then(Protocol.Profiler.disable) | 262 .then(Protocol.Profiler.disable) |
| 263 .then(Protocol.Runtime.disable) | 263 .then(Protocol.Runtime.disable) |
| 264 .then(ClearAndGC) | 264 .then(ClearAndGC) |
| 265 .then(next); | 265 .then(next); |
| 266 }, | 266 }, |
| 267 ]); | 267 ]); |
| OLD | NEW |