| 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 | 5 // Flags: --allow-natives-syntax --no-always-opt |
| 6 | 6 |
| 7 // Test precise code coverage. | 7 // Test precise code coverage. |
| 8 | 8 |
| 9 function GetCoverage(source) { | 9 function GetCoverage(source) { |
| 10 for (var script of %DebugCollectCoverage()) { | 10 for (var script of %DebugCollectCoverage()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // This does not happen with precise coverage enabled. | 64 // This does not happen with precise coverage enabled. |
| 65 %DebugTogglePreciseCoverage(true); | 65 %DebugTogglePreciseCoverage(true); |
| 66 | 66 |
| 67 TestCoverage( | 67 TestCoverage( |
| 68 "call an IIFE", | 68 "call an IIFE", |
| 69 ` | 69 ` |
| 70 (function f() {})(); | 70 (function f() {})(); |
| 71 `, | 71 `, |
| 72 ` | 72 ` |
| 73 [([function f() {}](f:1))();](anonymous:1) | 73 [([function f() {}](f:1))();](:1) |
| 74 ` | 74 ` |
| 75 ); | 75 ); |
| 76 | 76 |
| 77 TestCoverage( | 77 TestCoverage( |
| 78 "call locally allocated function", | 78 "call locally allocated function", |
| 79 ` | 79 ` |
| 80 for (var i = 0; i < 10; i++) { | 80 for (var i = 0; i < 10; i++) { |
| 81 let f = () => 1; | 81 let f = () => 1; |
| 82 i += f(); | 82 i += f(); |
| 83 } | 83 } |
| 84 `, | 84 `, |
| 85 ` | 85 ` |
| 86 [for (var i = 0; i < 10; i++) { | 86 [for (var i = 0; i < 10; i++) { |
| 87 let f = [() => 1](f:5); | 87 let f = [() => 1](f:5); |
| 88 i += f(); | 88 i += f(); |
| 89 }](anonymous:1) | 89 }](:1) |
| 90 ` | 90 ` |
| 91 ); | 91 ); |
| 92 | 92 |
| 93 %DebugTogglePreciseCoverage(false); | 93 %DebugTogglePreciseCoverage(false); |
| OLD | NEW |