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

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

Issue 7343005: Support scope information and evaluation in optimized frames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 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
« no previous file with comments | « test/mjsunit/debug-evaluate-locals-optimized.js ('k') | no next file » | 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 26 matching lines...) Expand all
37 37
38 function listener(event, exec_state, event_data, data) { 38 function listener(event, exec_state, event_data, data) {
39 try { 39 try {
40 if (event == Debug.DebugEvent.Break) 40 if (event == Debug.DebugEvent.Break)
41 { 41 {
42 assertEquals(6, exec_state.frameCount()); 42 assertEquals(6, exec_state.frameCount());
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 // All frames except the bottom one has normal variables a and b. 47 var expected_a = i * 2 + 1 + (i * 2 + 1) / 100;
48 var expected_b = i * 2 + 2 + (i * 2 + 2) / 100;
49 var expected_x = (i + 1) * 2 + 1 + ((i + 1) * 2 + 1) / 100;
50 var expected_y = (i + 1) * 2 + 2 + ((i + 1) * 2 + 2) / 100;
51
52 // All frames except the bottom one has normal variables a and b.
48 assertEquals('a', frame.localName(0)); 53 assertEquals('a', frame.localName(0));
49 assertEquals('b', frame.localName(1)); 54 assertEquals('b', frame.localName(1));
50 assertEquals(i * 2 + 1 + (i * 2 + 1) / 100, 55 assertEquals(expected_a, frame.localValue(0).value());
51 frame.localValue(0).value()); 56 assertEquals(expected_b, frame.localValue(1).value());
52 assertEquals(i * 2 + 2 + (i * 2 + 2) / 100,
53 frame.localValue(1).value());
54 57
55 // All frames except the bottom one has arguments variables x and y. 58 // All frames except the bottom one has arguments variables x and y.
56 assertEquals('x', frame.argumentName(0)); 59 assertEquals('x', frame.argumentName(0));
57 assertEquals('y', frame.argumentName(1)); 60 assertEquals('y', frame.argumentName(1));
58 assertEquals((i + 1) * 2 + 1 + ((i + 1) * 2 + 1) / 100, 61 assertEquals(expected_x, frame.argumentValue(0).value());
59 frame.argumentValue(0).value()); 62 assertEquals(expected_y, frame.argumentValue(1).value());
60 assertEquals((i + 1) * 2 + 2 + ((i + 1) * 2 + 2) / 100, 63
61 frame.argumentValue(1).value()); 64 // All frames except the bottom one have two scopes.
65 assertEquals(2, frame.scopeCount());
66 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType());
67 assertEquals(debug.ScopeType.Global, frame.scope(1).scopeType());
68 assertEquals(expected_a, frame.scope(0).scopeObject().value()['a']);
69 assertEquals(expected_b, frame.scope(0).scopeObject().value()['b']);
70 assertEquals(expected_x, frame.scope(0).scopeObject().value()['x']);
71 assertEquals(expected_y, frame.scope(0).scopeObject().value()['y']);
72
73 // Evaluate in the inlined frame.
74 assertEquals(expected_a, frame.evaluate('a').value());
75 assertEquals(expected_x, frame.evaluate('x').value());
76 assertEquals(expected_x, frame.evaluate('arguments[0]').value());
77 assertEquals(expected_a + expected_b + expected_x + expected_y,
78 frame.evaluate('a + b + x + y').value());
79 assertEquals(expected_x + expected_y,
80 frame.evaluate('arguments[0] + arguments[1]').value());
81 } else {
82 // The bottom frame only have the global scope.
83 assertEquals(1, frame.scopeCount());
84 assertEquals(debug.ScopeType.Global, frame.scope(0).scopeType());
62 } 85 }
63 86
64 // Check the frame function. 87 // Check the frame function.
65 switch (i) { 88 switch (i) {
66 case 0: assertEquals(h, frame.func().value()); break; 89 case 0: assertEquals(h, frame.func().value()); break;
67 case 1: assertEquals(g3, frame.func().value()); break; 90 case 1: assertEquals(g3, frame.func().value()); break;
68 case 2: assertEquals(g2, frame.func().value()); break; 91 case 2: assertEquals(g2, frame.func().value()); break;
69 case 3: assertEquals(g1, frame.func().value()); break; 92 case 3: assertEquals(g1, frame.func().value()); break;
70 case 4: assertEquals(f, frame.func().value()); break; 93 case 4: assertEquals(f, frame.func().value()); break;
71 case 5: break; 94 case 5: break;
72 default: assertUnreachable(); 95 default: assertUnreachable();
73 } 96 }
74 97
75 // Check for construct call. 98 // Check for construct call.
76 assertEquals(testingConstructCall && i == 4, frame.isConstructCall()); 99 assertEquals(testingConstructCall && i == 4, frame.isConstructCall());
77 100
78 // When function f is optimized (2 means YES, see runtime.cc) we 101 // When function f is optimized (1 means YES, see runtime.cc) we
79 // expect an optimized frame for f with g1, g2 and g3 inlined. 102 // expect an optimized frame for f with g1, g2 and g3 inlined.
80 if (%GetOptimizationStatus(f) == 2) { 103 if (%GetOptimizationStatus(f) == 1) {
81 if (i == 1 || i == 2 || i == 3) { 104 if (i == 1 || i == 2 || i == 3) {
82 assertTrue(frame.isOptimizedFrame()); 105 assertTrue(frame.isOptimizedFrame());
83 assertTrue(frame.isInlinedFrame()); 106 assertTrue(frame.isInlinedFrame());
107 assertEquals(4 - i, frame.inlinedFrameIndex());
84 } else if (i == 4) { 108 } else if (i == 4) {
85 assertTrue(frame.isOptimizedFrame()); 109 assertTrue(frame.isOptimizedFrame());
86 assertFalse(frame.isInlinedFrame()); 110 assertFalse(frame.isInlinedFrame());
87 } else { 111 } else {
88 assertFalse(frame.isOptimizedFrame()); 112 assertFalse(frame.isOptimizedFrame());
89 assertFalse(frame.isInlinedFrame()); 113 assertFalse(frame.isInlinedFrame());
90 } 114 }
91 } 115 }
92 } 116 }
93 117
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Test calling f normally and as a constructor. 174 // Test calling f normally and as a constructor.
151 f(11.11, 12.12); 175 f(11.11, 12.12);
152 testingConstructCall = true; 176 testingConstructCall = true;
153 new f(11.11, 12.12); 177 new f(11.11, 12.12);
154 178
155 // Make sure that the debug event listener vas invoked. 179 // Make sure that the debug event listener vas invoked.
156 assertFalse(exception, "exception in listener " + exception) 180 assertFalse(exception, "exception in listener " + exception)
157 assertTrue(listenerComplete); 181 assertTrue(listenerComplete);
158 182
159 Debug.setListener(null); 183 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-evaluate-locals-optimized.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698