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

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

Issue 10239003: Remove unwarranted assumptions about inlining from a debugger test. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 8 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 | « no previous file | test/mjsunit/debug-evaluate-locals-optimized-double.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 28 matching lines...) Expand all
39 { locals: {a1: 3, b1: 4}, args: { names: ["i", "x1", "y1"], values: [1, 5, 6] } }, 39 { locals: {a1: 3, b1: 4}, args: { names: ["i", "x1", "y1"], values: [1, 5, 6] } },
40 { locals: {a2: 5, b2: 6}, args: { names: ["i"], values: [2] } }, 40 { locals: {a2: 5, b2: 6}, args: { names: ["i"], values: [2] } },
41 { locals: {a3: 7, b3: 8}, args: { names: ["i", "x3", "y3", "z3"], values: [3, 9, 10, undefined] } }, 41 { locals: {a3: 7, b3: 8}, args: { names: ["i", "x3", "y3", "z3"], values: [3, 9, 10, undefined] } },
42 { locals: {a4: 9, b4: 10}, args: { names: ["i", "x4", "y4"], values: [4, 11, 1 2] } } 42 { locals: {a4: 9, b4: 10}, args: { names: ["i", "x4", "y4"], values: [4, 11, 1 2] } }
43 ]; 43 ];
44 44
45 function arraySum(arr) { 45 function arraySum(arr) {
46 return arr.reduce(function (a, b) { return a + b; }, 0); 46 return arr.reduce(function (a, b) { return a + b; }, 0);
47 } 47 }
48 48
49 function isCurrentlyOptimized(fun) {
50 // See runtime.cc.
51 return (%GetOptimizationStatus(fun) & 1) != 0;
52 }
53
49 function listener(event, exec_state, event_data, data) { 54 function listener(event, exec_state, event_data, data) {
50 try { 55 try {
51 if (event == Debug.DebugEvent.Break) 56 if (event == Debug.DebugEvent.Break)
52 { 57 {
53 assertEquals(6, exec_state.frameCount()); 58 assertEquals(6, exec_state.frameCount());
54 59
55 for (var i = 0; i < exec_state.frameCount(); i++) { 60 for (var i = 0; i < exec_state.frameCount(); i++) {
56 var frame = exec_state.frame(i); 61 var frame = exec_state.frame(i);
57 if (i < exec_state.frameCount() - 1) { 62 if (i < exec_state.frameCount() - 1) {
58 var expected_args = expected[i].args; 63 var expected_args = expected[i].args;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 136
132 // Check for construct call. 137 // Check for construct call.
133 if (i == 4) { 138 if (i == 4) {
134 assertEquals(testingConstructCall, frame.isConstructCall()); 139 assertEquals(testingConstructCall, frame.isConstructCall());
135 } else if (i == 2) { 140 } else if (i == 2) {
136 assertTrue(frame.isConstructCall()); 141 assertTrue(frame.isConstructCall());
137 } else { 142 } else {
138 assertFalse(frame.isConstructCall()); 143 assertFalse(frame.isConstructCall());
139 } 144 }
140 145
141 // When function f is optimized (1 means YES, see runtime.cc) we 146 if (i > 4) {
142 // expect an optimized frame for f with g1, g2 and g3 inlined. 147 assertFalse(frame.isOptimizedFrame());
143 if (%GetOptimizationStatus(f) == 1) { 148 assertFalse(frame.isInlinedFrame());
144 if (i == 1 || i == 2 || i == 3) {
145 assertTrue(frame.isOptimizedFrame());
146 assertTrue(frame.isInlinedFrame());
147 assertEquals(4 - i, frame.inlinedFrameIndex());
148 } else if (i == 4) {
149 assertTrue(frame.isOptimizedFrame());
150 assertFalse(frame.isInlinedFrame());
151 } else {
152 assertFalse(frame.isOptimizedFrame());
153 assertFalse(frame.isInlinedFrame());
154 }
155 } 149 }
156 } 150 }
157 151
152 // When function f is optimized we expect an optimized frame for f. We
153 // can't say whether or not the top 3 frames (g1, g2 and g3) are
154 // optimized and inlined.
155 var frame4 = exec_state.frame(4);
156
157 if (isCurrentlyOptimized(f)) {
158 assertTrue(frame4.isOptimizedFrame());
159 assertFalse(frame4.isInlinedFrame());
160 }
161
158 // Indicate that all was processed. 162 // Indicate that all was processed.
159 listenerComplete = true; 163 listenerComplete = true;
160 } 164 }
161 } catch (e) { 165 } catch (e) {
162 exception = e.toString() + e.stack; 166 exception = e.toString() + e.stack;
163 }; 167 };
164 }; 168 };
165 169
166 for (var i = 0; i < 4; i++) f(expected.length - 1, 11, 12); 170 for (var i = 0; i < 4; i++) f(expected.length - 1, 11, 12);
167 %OptimizeFunctionOnNextCall(f); 171 %OptimizeFunctionOnNextCall(f);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 new f(expected.length - 1, 11, 12, 0); 212 new f(expected.length - 1, 11, 12, 0);
209 213
210 // Make sure that the debug event listener was invoked. 214 // Make sure that the debug event listener was invoked.
211 assertFalse(exception, "exception in listener " + exception) 215 assertFalse(exception, "exception in listener " + exception)
212 assertTrue(listenerComplete); 216 assertTrue(listenerComplete);
213 217
214 // Throw away type information for next run. 218 // Throw away type information for next run.
215 gc(); 219 gc();
216 220
217 Debug.setListener(null); 221 Debug.setListener(null);
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/debug-evaluate-locals-optimized-double.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698