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

Side by Side Diff: test/mjsunit/debug-step.js

Issue 16567: Enable register allocation for return statements. Make sure to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 11 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
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 18 matching lines...) Expand all
29 // Get the Debug object exposed from the debug context global object. 29 // Get the Debug object exposed from the debug context global object.
30 Debug = debug.Debug 30 Debug = debug.Debug
31 31
32 // Simple debug event handler which first time hit will perform 1000 steps and 32 // Simple debug event handler which first time hit will perform 1000 steps and
33 // second time hit will evaluate and store the value of "i". If requires that 33 // second time hit will evaluate and store the value of "i". If requires that
34 // the global property "state" is initially zero. 34 // the global property "state" is initially zero.
35 35
36 var bp1, bp2; 36 var bp1, bp2;
37 37
38 function listener(event, exec_state, event_data, data) { 38 function listener(event, exec_state, event_data, data) {
39 if (event == Debug.DebugEvent.Break) 39 if (event == Debug.DebugEvent.Break) {
40 {
41 if (state == 0) { 40 if (state == 0) {
42 exec_state.prepareStep(Debug.StepAction.StepIn, 1000); 41 exec_state.prepareStep(Debug.StepAction.StepIn, 1000);
43 state = 1; 42 state = 1;
44 } else if (state == 1) { 43 } else if (state == 1) {
45 result = exec_state.frame().evaluate("i").value(); 44 result = exec_state.frame().evaluate("i").value();
46 // Clear the break point on line 2 if set. 45 // Clear the break point on line 2 if set.
47 if (bp2) { 46 if (bp2) {
48 Debug.clearBreakPoint(bp2); 47 Debug.clearBreakPoint(bp2);
49 } 48 }
50 } 49 }
(...skipping 10 matching lines...) Expand all
61 } 60 }
62 }; 61 };
63 62
64 // Set a breakpoint on the for statement (line 1). 63 // Set a breakpoint on the for statement (line 1).
65 bp1 = Debug.setBreakPoint(f, 1); 64 bp1 = Debug.setBreakPoint(f, 1);
66 65
67 // Check that performing 1000 steps will make i 499. 66 // Check that performing 1000 steps will make i 499.
68 state = 0; 67 state = 0;
69 result = -1; 68 result = -1;
70 f(); 69 f();
71 print(state);
72 assertEquals(499, result); 70 assertEquals(499, result);
73 71
74 // Check that performing 1000 steps with a break point on the statement in the 72 // Check that performing 1000 steps with a break point on the statement in the
75 // for loop (line 2) will only make i 0 as a real break point breaks even when 73 // for loop (line 2) will only make i 0 as a real break point breaks even when
76 // multiple steps have been requested. 74 // multiple steps have been requested.
77 state = 0; 75 state = 0;
78 result = -1; 76 result = -1;
79 bp2 = Debug.setBreakPoint(f, 2); 77 bp2 = Debug.setBreakPoint(f, 2);
80 f(); 78 f();
81 assertEquals(0, result); 79 assertEquals(0, result);
82 80
83 // Get rid of the debug event listener. 81 // Get rid of the debug event listener.
84 Debug.removeListener(listener); 82 Debug.removeListener(listener);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698