Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: test/mjsunit/debug-evaluate-closure.js

Issue 19569003: Do not materialize context-allocated values for debug-evaluate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Flags: --expose-debug-as debug --allow-natives-syntax 28 // Flags: --expose-debug-as debug --allow-natives-syntax
29 29
30 Debug = debug.Debug; 30 Debug = debug.Debug;
31 var listened = false; 31 var listened = false;
32 32
33 function listener(event, exec_state, event_data, data) { 33 function listener(event, exec_state, event_data, data) {
34 if (event == Debug.DebugEvent.Exception) { 34 if (event != Debug.DebugEvent.Break) return;
35 for (var i = 0; i < exec_state.frameCount(); i++) { 35 try {
36 print(exec_state.frame(i).receiver()); 36 assertEquals("bar return", exec_state.frame(0).evaluate("bar()").value());
37 print(exec_state.frame(i).func().name()); 37 assertEquals("inner bar", exec_state.frame(0).evaluate("inner").value());
38 } 38 assertEquals("outer bar", exec_state.frame(0).evaluate("outer").value());
39 assertEquals("baz inner", exec_state.frame(0).evaluate("baz").value());
40 assertEquals("baz outer", exec_state.frame(1).evaluate("baz").value());
41 exec_state.frame(0).evaluate("w = 'w foo'").value();
42 exec_state.frame(0).evaluate("inner = 'inner foo'").value();
43 exec_state.frame(0).evaluate("outer = 'outer foo'").value();
44 exec_state.frame(0).evaluate("baz = 'baz inner foo'").value();
45 exec_state.frame(1).evaluate("baz = 'baz outer foo'").value();
46 } catch (e) {
47 print(e);
48 print(e.stack);
39 } 49 }
40 listened = true; 50 listened = true;
41 } 51 }
42 52
43 Debug.setListener(listener); 53 Debug.setListener(listener);
44 Debug.setBreakOnException();
45 54
46 assertThrows(function() { delete null['foo']; }); 55 var outer = "outer";
56 var baz = "baz outer"
47 57
48 Debug.clearBreakOnException(); 58 function foo() {
59 var inner = "inner";
60 var baz = "baz inner";
61 var withw = { w: "w" };
62 var withv = { v: "v" };
63
64 with (withv) {
65 var bar = function bar() {
66 inner = "inner bar";
67 outer = "outer bar";
68 v = "v bar";
69 return "bar return";
70 };
71 }
72
73 with (withw) {
74 debugger;
75 }
76
77 assertEquals("inner foo", inner);
78 assertEquals("baz inner foo", baz);
79 assertEquals("w foo", withw.w);
80 assertEquals("v bar", withv.v);
81 }
82
83 foo();
84 assertEquals("outer foo", outer);
85 assertEquals("baz outer foo", baz);
86 assertTrue(listened);
49 Debug.setListener(null); 87 Debug.setListener(null);
50
51 assertTrue(listened);
52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698