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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 for (var i = 0; i < exec_state.frameCount(); i++) { | 44 for (var i = 0; i < exec_state.frameCount(); i++) { |
45 var frame = exec_state.frame(i); | 45 var frame = exec_state.frame(i); |
46 if (i < exec_state.frameCount() - 1) { | 46 if (i < exec_state.frameCount() - 1) { |
47 var expected_a = i * 2 + 1; | 47 var expected_a = i * 2 + 1; |
48 var expected_b = i * 2 + 2; | 48 var expected_b = i * 2 + 2; |
49 var expected_x = (i + 1) * 2 + 1; | 49 var expected_x = (i + 1) * 2 + 1; |
50 var expected_y = (i + 1) * 2 + 2; | 50 var expected_y = (i + 1) * 2 + 2; |
51 | 51 |
52 // All frames except the bottom one has normal variables a and b. | 52 // All frames except the bottom one has normal variables a and b. |
53 assertEquals('a', frame.localName(0)); | 53 var a = ('a' === frame.localName(0)) ? 0 : 1; |
54 assertEquals('b', frame.localName(1)); | 54 var b = 1 - a; |
55 assertEquals(expected_a, frame.localValue(0).value()); | 55 assertEquals('a', frame.localName(a)); |
56 assertEquals(expected_b, frame.localValue(1).value()); | 56 assertEquals('b', frame.localName(b)); |
| 57 assertEquals(expected_a, frame.localValue(a).value()); |
| 58 assertEquals(expected_b, frame.localValue(b).value()); |
57 | 59 |
58 // All frames except the bottom one has arguments variables x and y. | 60 // All frames except the bottom one has arguments variables x and y. |
59 assertEquals('x', frame.argumentName(0)); | 61 assertEquals('x', frame.argumentName(0)); |
60 assertEquals('y', frame.argumentName(1)); | 62 assertEquals('y', frame.argumentName(1)); |
61 assertEquals(expected_x, frame.argumentValue(0).value()); | 63 assertEquals(expected_x, frame.argumentValue(0).value()); |
62 assertEquals(expected_y, frame.argumentValue(1).value()); | 64 assertEquals(expected_y, frame.argumentValue(1).value()); |
63 | 65 |
64 // All frames except the bottom one have two scopes. | 66 // All frames except the bottom one have two scopes. |
65 assertEquals(2, frame.scopeCount()); | 67 assertEquals(2, frame.scopeCount()); |
66 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType()); | 68 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 assertFalse(frame.isOptimizedFrame()); | 114 assertFalse(frame.isOptimizedFrame()); |
113 assertFalse(frame.isInlinedFrame()); | 115 assertFalse(frame.isInlinedFrame()); |
114 } | 116 } |
115 } | 117 } |
116 } | 118 } |
117 | 119 |
118 // Indicate that all was processed. | 120 // Indicate that all was processed. |
119 listenerComplete = true; | 121 listenerComplete = true; |
120 } | 122 } |
121 } catch (e) { | 123 } catch (e) { |
122 exception = e | 124 exception = e.stack; |
123 }; | 125 }; |
124 }; | 126 }; |
125 | 127 |
126 f();f();f(); | 128 f();f();f(); |
127 %OptimizeFunctionOnNextCall(f); | 129 %OptimizeFunctionOnNextCall(f); |
128 f(); | 130 f(); |
129 | 131 |
130 // Add the debug event listener. | 132 // Add the debug event listener. |
131 Debug.setListener(listener); | 133 Debug.setListener(listener); |
132 | 134 |
(...skipping 30 matching lines...) Expand all Loading... |
163 // Test calling f normally and as a constructor. | 165 // Test calling f normally and as a constructor. |
164 f(11, 12); | 166 f(11, 12); |
165 testingConstructCall = true; | 167 testingConstructCall = true; |
166 new f(11, 12); | 168 new f(11, 12); |
167 | 169 |
168 // Make sure that the debug event listener vas invoked. | 170 // Make sure that the debug event listener vas invoked. |
169 assertFalse(exception, "exception in listener " + exception) | 171 assertFalse(exception, "exception in listener " + exception) |
170 assertTrue(listenerComplete); | 172 assertTrue(listenerComplete); |
171 | 173 |
172 Debug.setListener(null); | 174 Debug.setListener(null); |
OLD | NEW |