OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 19 matching lines...) Expand all Loading... |
30 Debug = debug.Debug | 30 Debug = debug.Debug |
31 | 31 |
32 // Tests how debugger can step over not necessarily in the top frame. | 32 // Tests how debugger can step over not necessarily in the top frame. |
33 | 33 |
34 // Simple 3 functions, that protocol their execution state in global | 34 // Simple 3 functions, that protocol their execution state in global |
35 // variable state. | 35 // variable state. |
36 var state; | 36 var state; |
37 | 37 |
38 function f() { | 38 function f() { |
39 var a = 1978; | 39 var a = 1978; |
40 for (state[2] = 0; state[2] < 5; state[2]++) { | 40 for (state[2] = 0; state[2] < 3; state[2]++) { |
41 void String(a); | 41 void String(a); |
42 } | 42 } |
43 } | 43 } |
44 function g() { | 44 function g() { |
45 for (state[1] = 0; state[1] < 5; state[1]++) { | 45 for (state[1] = 0; state[1] < 3; state[1]++) { |
46 f(); | 46 f(); |
47 } | 47 } |
48 } | 48 } |
49 function h() { | 49 function h() { |
50 state = [-1, -1, -1]; | 50 state = [-1, -1, -1]; |
51 for (state[0] = 0; state[0] < 5; state[0]++) { | 51 for (state[0] = 0; state[0] < 3; state[0]++) { |
52 g(); | 52 g(); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 function TestCase(frame_index, step_count, expected_final_state) { | 56 function TestCase(frame_index, step_count, expected_final_state) { |
57 print("Test case, parameters " + frame_index + "/" + step_count); | 57 print("Test case, parameters " + frame_index + "/" + step_count); |
58 | 58 |
59 var listener_exception = null; | 59 var listener_exception = null; |
60 var state_snapshot; | 60 var state_snapshot; |
61 var listener_state; | 61 var listener_state; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 TestCase(undefined, 8, "0,0,3"); | 116 TestCase(undefined, 8, "0,0,3"); |
117 | 117 |
118 // Stepping in the frame #0 (should be exactly the same as above). | 118 // Stepping in the frame #0 (should be exactly the same as above). |
119 TestCase(0, 0, "0,0,-1"); | 119 TestCase(0, 0, "0,0,-1"); |
120 TestCase(0, 1, "0,0,-1"); | 120 TestCase(0, 1, "0,0,-1"); |
121 TestCase(0, 2, "0,0,0"); | 121 TestCase(0, 2, "0,0,0"); |
122 TestCase(0, 5, "0,0,1"); | 122 TestCase(0, 5, "0,0,1"); |
123 TestCase(0, 8, "0,0,3"); | 123 TestCase(0, 8, "0,0,3"); |
124 | 124 |
125 // Stepping in the frame #1. | 125 // Stepping in the frame #1. |
126 TestCase(1, 0, "0,0,5"); | 126 TestCase(1, 0, "0,0,3"); |
127 TestCase(1, 3, "0,1,5"); | 127 TestCase(1, 3, "0,1,3"); |
128 TestCase(1, 8, "0,4,5"); | 128 TestCase(1, 7, "0,3,3"); |
129 | 129 |
130 // Stepping in the frame #2. | 130 // Stepping in the frame #2. |
131 TestCase(2, 3, "1,5,5"); | 131 TestCase(2, 3, "1,3,3"); |
132 TestCase(2, 8, "4,5,5"); | 132 TestCase(2, 7, "3,3,3"); |
OLD | NEW |