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

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

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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
« no previous file with comments | « test/mjsunit/compiler/simple-osr.js ('k') | test/mjsunit/elements-kind.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 31
32 listenerComplete = false; 32 listenerComplete = false;
33 exception = false; 33 exception = false;
34 34
35 35
36 function h() { 36 function h() {
37 var a = 1; 37 var a = 1;
38 var b = 2; 38 var b = 2;
39 var eval = 5; // Overriding eval should not break anything. 39 var eval = 5; // Overriding eval should not break anything.
40 debugger; // Breakpoint. 40 debugger; // Breakpoint.
41 return a;
41 } 42 }
42 43
43 function checkFrame0(frame) { 44 function checkFrame0(frame) {
44 // Frame 0 (h) has normal variables a and b. 45 // Frame 0 (h) has normal variables a and b.
45 var count = frame.localCount(); 46 var count = frame.localCount();
46 assertEquals(3, count); 47 assertEquals(3, count);
47 for (var i = 0; i < count; ++i) { 48 for (var i = 0; i < count; ++i) {
48 var name = frame.localName(i); 49 var name = frame.localName(i);
49 var value = frame.localValue(i).value(); 50 var value = frame.localValue(i).value();
50 if (name == 'a') { 51 if (name == 'a') {
51 assertEquals(1, value); 52 assertEquals(1, value);
52 } else if (name !='eval') { 53 } else if (name !='eval') {
53 assertEquals('b', name); 54 assertEquals('b', name);
54 assertEquals(2, value); 55 assertEquals(2, value);
55 } 56 }
56 } 57 }
57 } 58 }
58 59
59 60
60 function g() { 61 function g() {
61 var a = 3; 62 var a = 3;
62 eval("var b = 4;"); 63 eval("var b = 4;");
63 h(); 64 return h() + a;
64 } 65 }
65 66
66 function checkFrame1(frame) { 67 function checkFrame1(frame) {
67 // Frame 1 (g) has normal variable a (and arguments). 68 // Frame 1 (g) has normal variable a (and arguments).
68 var count = frame.localCount(); 69 var count = frame.localCount();
69 assertEquals(2, count); 70 assertEquals(2, count);
70 for (var i = 0; i < count; ++i) { 71 for (var i = 0; i < count; ++i) {
71 var name = frame.localName(i); 72 var name = frame.localName(i);
72 var value = frame.localValue(i).value(); 73 var value = frame.localValue(i).value();
73 if (name == 'a') { 74 if (name == 'a') {
74 assertEquals(3, value); 75 assertEquals(3, value);
75 } else { 76 } else {
76 assertEquals('arguments', name); 77 assertEquals('arguments', name);
77 } 78 }
78 } 79 }
79 } 80 }
80 81
81 82
82 function f() { 83 function f() {
83 var a = 5; 84 var a = 5;
84 var b = 0; 85 var b = 0;
85 with ({b:6}) { 86 with ({b:6}) {
86 g(); 87 return g();
87 } 88 }
88 } 89 }
89 90
90 function checkFrame2(frame) { 91 function checkFrame2(frame) {
91 // Frame 2 (f) has normal variables a and b (and arguments). 92 // Frame 2 (f) has normal variables a and b (and arguments).
92 var count = frame.localCount(); 93 var count = frame.localCount();
93 assertEquals(3, count); 94 assertEquals(3, count);
94 for (var i = 0; i < count; ++i) { 95 for (var i = 0; i < count; ++i) {
95 var name = frame.localName(i); 96 var name = frame.localName(i);
96 var value = frame.localValue(i).value(); 97 var value = frame.localValue(i).value();
(...skipping 21 matching lines...) Expand all
118 assertEquals(2, exec_state.frame(0).evaluate('b').value()); 119 assertEquals(2, exec_state.frame(0).evaluate('b').value());
119 assertEquals(5, exec_state.frame(0).evaluate('eval').value()); 120 assertEquals(5, exec_state.frame(0).evaluate('eval').value());
120 assertEquals(3, exec_state.frame(1).evaluate('a').value()); 121 assertEquals(3, exec_state.frame(1).evaluate('a').value());
121 assertEquals(4, exec_state.frame(1).evaluate('b').value()); 122 assertEquals(4, exec_state.frame(1).evaluate('b').value());
122 assertEquals("function", 123 assertEquals("function",
123 typeof exec_state.frame(1).evaluate('eval').value()); 124 typeof exec_state.frame(1).evaluate('eval').value());
124 assertEquals(5, exec_state.frame(2).evaluate('a').value()); 125 assertEquals(5, exec_state.frame(2).evaluate('a').value());
125 assertEquals(6, exec_state.frame(2).evaluate('b').value()); 126 assertEquals(6, exec_state.frame(2).evaluate('b').value());
126 assertEquals("function", 127 assertEquals("function",
127 typeof exec_state.frame(2).evaluate('eval').value()); 128 typeof exec_state.frame(2).evaluate('eval').value());
129 assertEquals("foo",
130 exec_state.frame(0).evaluate('a = "foo"').value());
131 assertEquals("bar",
132 exec_state.frame(1).evaluate('a = "bar"').value());
128 // Indicate that all was processed. 133 // Indicate that all was processed.
129 listenerComplete = true; 134 listenerComplete = true;
130 } 135 }
131 } catch (e) { 136 } catch (e) {
132 exception = e 137 exception = e
133 print("Caught something. " + e + " " + e.stack); 138 print("Caught something. " + e + " " + e.stack);
134 }; 139 };
135 }; 140 };
136 141
137 // Add the debug event listener. 142 // Add the debug event listener.
138 Debug.setListener(listener); 143 Debug.setListener(listener);
139 144
140 f(); 145 var f_result = f();
146
147 assertEquals('foobar', f_result);
141 148
142 // Make sure that the debug event listener was invoked. 149 // Make sure that the debug event listener was invoked.
143 assertFalse(exception, "exception in listener") 150 assertFalse(exception, "exception in listener")
144 assertTrue(listenerComplete); 151 assertTrue(listenerComplete);
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/simple-osr.js ('k') | test/mjsunit/elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698