| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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: --expose-debug-as debug | |
| 6 | 5 |
| 7 var Debug = debug.Debug; | 6 var Debug = debug.Debug; |
| 8 var break_count = 0; | 7 var break_count = 0; |
| 9 var exception_count = 0; | 8 var exception_count = 0; |
| 10 | 9 |
| 11 function assertCount(expected_breaks, expected_exceptions) { | 10 function assertCount(expected_breaks, expected_exceptions) { |
| 12 assertEquals(expected_breaks, break_count); | 11 assertEquals(expected_breaks, break_count); |
| 13 assertEquals(expected_exceptions, exception_count); | 12 assertEquals(expected_exceptions, exception_count); |
| 14 } | 13 } |
| 15 | 14 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 assertCount(2, 1); | 55 assertCount(2, 1); |
| 57 | 56 |
| 58 Debug.setBreakPoint(f, 1, 0, "x == 1"); | 57 Debug.setBreakPoint(f, 1, 0, "x == 1"); |
| 59 f(1); | 58 f(1); |
| 60 assertCount(3, 1); | 59 assertCount(3, 1); |
| 61 f(2); | 60 f(2); |
| 62 assertCount(3, 1); | 61 assertCount(3, 1); |
| 63 f(1); | 62 f(1); |
| 64 assertCount(4, 1); | 63 assertCount(4, 1); |
| 65 | 64 |
| 66 Debug.setBreakPoint(f, 1, 0, "x > 0"); | 65 assertThrows(() => Debug.setBreakPoint(f, 1, 0, "x > 0")); |
| 67 f(1); | 66 f(1); |
| 68 assertCount(5, 1); | 67 assertCount(5, 2); |
| 69 f(0); | 68 f(0); |
| 70 assertCount(5, 1); | 69 assertCount(5, 2); |
| 71 | 70 |
| 72 Debug.setBreakPoint(g, 2, 0, "1 == 2"); | 71 Debug.setBreakPoint(g, 2, 0, "1 == 2"); |
| 73 g(1); | 72 g(1); |
| 74 assertCount(5, 1); | 73 assertCount(5, 2); |
| 75 | 74 |
| 76 Debug.setBreakPoint(g, 2, 0, "x == 1"); | 75 assertThrows(() => Debug.setBreakPoint(g, 2, 0, "x == 1")); |
| 77 g(1); | 76 g(1); |
| 78 assertCount(6, 2); | 77 assertCount(5, 3); |
| 79 g(2); | 78 g(2); |
| 80 assertCount(6, 2); | 79 assertCount(5, 3); |
| 81 g(1); | 80 g(1); |
| 82 assertCount(7, 3); | 81 assertCount(5, 3); |
| 83 | 82 |
| 84 Debug.setBreakPoint(g, 2, 0, "x > 0"); | 83 assertThrows(() => Debug.setBreakPoint(g, 2, 0, "x > 0")); |
| 85 g(1); | 84 g(1); |
| 86 assertCount(8, 4); | 85 assertCount(5, 4); |
| 87 g(0); | 86 g(0); |
| 88 assertCount(8, 4); | 87 assertCount(5, 4); |
| 89 | 88 |
| 90 h(0); | 89 h(0); |
| 91 assertCount(8, 5); | 90 assertCount(5, 5); |
| 92 Debug.setBreakPoint(h, 3, 0, "x > 0"); | 91 Debug.setBreakPoint(h, 3, 0, "x > 0"); |
| 93 h(1); | 92 h(1); |
| 94 assertCount(9, 6); | 93 assertCount(6, 6); |
| 95 h(0); | 94 h(0); |
| 96 assertCount(9, 6); | 95 assertCount(6, 6); |
| 97 | 96 |
| 98 Debug.clearBreakOnException(); | 97 Debug.clearBreakOnException(); |
| 99 Debug.setListener(null); | 98 Debug.setListener(null); |
| OLD | NEW |