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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 | 82 |
83 function f() { | 83 function f() { |
84 var a = 5; | 84 var a = 5; |
85 var b = 0; | 85 var b = 0; |
86 with ({b:6}) { | 86 with ({b:6}) { |
87 return g(); | 87 return g(); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 function checkFrame2(frame) { | 91 function checkFrame2(frame) { |
92 // Frame 2 (f) has normal variables a and b (and arguments). | 92 // Frame 2 (f) has normal variables a and b. |
adamk
2016/03/14 22:22:11
No need to allocate arguments, as it's not referre
| |
93 var count = frame.localCount(); | 93 var count = frame.localCount(); |
94 assertEquals(3, count); | 94 assertEquals(2, count); |
95 for (var i = 0; i < count; ++i) { | 95 for (var i = 0; i < count; ++i) { |
96 var name = frame.localName(i); | 96 var name = frame.localName(i); |
97 var value = frame.localValue(i).value(); | 97 var value = frame.localValue(i).value(); |
98 if (name == 'a') { | 98 if (name == 'a') { |
99 assertEquals(5, value); | 99 assertEquals(5, value); |
100 } else if (name == 'b') { | 100 } else { |
101 assertEquals('b', name); | |
101 assertEquals(0, value); | 102 assertEquals(0, value); |
102 } else { | |
103 assertEquals('arguments', name); | |
104 } | 103 } |
105 } | 104 } |
106 } | 105 } |
107 | 106 |
108 | 107 |
109 function listener(event, exec_state, event_data, data) { | 108 function listener(event, exec_state, event_data, data) { |
110 try { | 109 try { |
111 if (event == Debug.DebugEvent.Break) | 110 if (event == Debug.DebugEvent.Break) |
112 { | 111 { |
113 checkFrame0(exec_state.frame(0)); | 112 checkFrame0(exec_state.frame(0)); |
(...skipping 30 matching lines...) Expand all Loading... | |
144 // Add the debug event listener. | 143 // Add the debug event listener. |
145 Debug.setListener(listener); | 144 Debug.setListener(listener); |
146 | 145 |
147 var f_result = f(); | 146 var f_result = f(); |
148 | 147 |
149 assertEquals(4, f_result); | 148 assertEquals(4, f_result); |
150 | 149 |
151 // Make sure that the debug event listener was invoked. | 150 // Make sure that the debug event listener was invoked. |
152 assertFalse(exception, "exception in listener") | 151 assertFalse(exception, "exception in listener") |
153 assertTrue(listenerComplete); | 152 assertTrue(listenerComplete); |
OLD | NEW |