OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 | 5 // Flags: --expose-debug-as debug |
6 | 6 |
7 // This test ensures that IC learning doesn't interfere with stepping into | 7 // This test ensures that IC learning doesn't interfere with stepping into |
8 // property accessor. f1()'s ICs are allowed to learn to a monomorphic state, | 8 // property accessor. f1()'s ICs are allowed to learn to a monomorphic state, |
9 // and the breakpoints flooding get() are allowed to expire, then we ensure | 9 // and the breakpoints flooding get() are allowed to expire, then we ensure |
10 // that we can step into get() again later (when k == 1). | 10 // that we can step into get() again later (when k == 1). |
11 function f1() { | 11 function f1() { |
12 for (var k = 0; k < 2; k++) { // Break 1 | 12 for (var k = 0; k < 2; k++) { // Break 1 |
13 var v10 = 0; // Line 2 | 13 var v10 = 0; // Line 2 |
14 for (var i = 0; i < 10; i++) { // Line 3 | 14 for (var i = 0; i < 10; i++) { // Line 3 |
15 var v12 = o.slappy; // Line 4 | 15 var v12 = o.slappy; // Line 4 |
16 var v13 = 3 // Line 5 | 16 var v13 = 3 // Line 5 |
17 } // Line 6 | 17 } // Line 6 |
18 print("break here"); // Break 3 | 18 print("break here"); // Break 3 |
19 } // Line 8 | 19 } // Line 8 |
20 print("exiting f1"); // Line 9 (dummy break) | 20 print("exiting f1"); // Break 4 |
21 } | 21 } |
22 | 22 |
23 function get() { | 23 function get() { |
24 var g0 = 0; // Break 2 | 24 var g0 = 0; // Break 2 |
25 var g1 = 1; | 25 var g1 = 1; |
26 return 3; | 26 return 3; |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 var o = {}; | 30 var o = {}; |
(...skipping 23 matching lines...) Expand all Loading... |
54 // go monomorphic. | 54 // go monomorphic. |
55 assertEquals(break_count, match_value); | 55 assertEquals(break_count, match_value); |
56 } else if (break_count === 3) { | 56 } else if (break_count === 3) { |
57 // 3: back to frame stepping. Does the monomorphic slappy accessor | 57 // 3: back to frame stepping. Does the monomorphic slappy accessor |
58 // call still have the ability to break like before? | 58 // call still have the ability to break like before? |
59 assertEquals(break_count, match_value); | 59 assertEquals(break_count, match_value); |
60 Debug.clearBreakPoint(bp_f1_line7); | 60 Debug.clearBreakPoint(bp_f1_line7); |
61 exec_state.prepareStep(Debug.StepAction.StepFrame, 1); | 61 exec_state.prepareStep(Debug.StepAction.StepFrame, 1); |
62 } else { | 62 } else { |
63 assertEquals(4, break_count); | 63 assertEquals(4, break_count); |
64 assertEquals(2, match_value); | 64 assertEquals(4, match_value); |
65 // Apparently we can still stop in the accessor even though we cleared | 65 // Apparently we can still stop in the accessor even though we cleared |
66 // breakpoints earlier and there was a monomorphic step. | 66 // breakpoints earlier and there was a monomorphic step. |
67 // Allow running to completion now. | 67 // Allow running to completion now. |
68 Debug.clearBreakPoint(bp_f1_line9); | 68 Debug.clearBreakPoint(bp_f1_line9); |
69 } | 69 } |
70 | 70 |
71 break_count++; | 71 break_count++; |
72 } catch (e) { | 72 } catch (e) { |
73 print(e + e.stack); | 73 print(e + e.stack); |
74 exception = e; | 74 exception = e; |
(...skipping 13 matching lines...) Expand all Loading... |
88 bp_f1_line7 = Debug.setBreakPoint(f1, 7); | 88 bp_f1_line7 = Debug.setBreakPoint(f1, 7); |
89 bp_f1_line9 = Debug.setBreakPoint(f1, 9); | 89 bp_f1_line9 = Debug.setBreakPoint(f1, 9); |
90 | 90 |
91 debugger; // Break 0 | 91 debugger; // Break 0 |
92 f1(); | 92 f1(); |
93 Debug.setListener(null); | 93 Debug.setListener(null); |
94 assertTrue(break_count === 5); | 94 assertTrue(break_count === 5); |
95 } | 95 } |
96 | 96 |
97 assertNull(exception); | 97 assertNull(exception); |
OLD | NEW |