OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 27 matching lines...) Expand all Loading... |
38 var break_count = 0; | 38 var break_count = 0; |
39 | 39 |
40 // Debug event listener which sets a breakpoint first time it is hit | 40 // Debug event listener which sets a breakpoint first time it is hit |
41 // and otherwise counts break points hit and checks that the expected | 41 // and otherwise counts break points hit and checks that the expected |
42 // state is reached. | 42 // state is reached. |
43 function listener(event, exec_state, event_data, data) { | 43 function listener(event, exec_state, event_data, data) { |
44 if (event == Debug.DebugEvent.Break) { | 44 if (event == Debug.DebugEvent.Break) { |
45 break_count++; | 45 break_count++; |
46 if (break_count == 1) { | 46 if (break_count == 1) { |
47 Debug.setBreakPoint(g, 3); | 47 Debug.setBreakPoint(g, 3); |
48 | |
49 for (var i = 0; i < exec_state.frameCount(); i++) { | |
50 var frame = exec_state.frame(i); | |
51 // When function f is optimized (1 means YES, see runtime.cc) we | |
52 // expect an optimized frame for f and g. | |
53 if (%GetOptimizationStatus(f) == 1) { | |
54 if (i == 1) { | |
55 assertTrue(frame.isOptimizedFrame()); | |
56 assertTrue(frame.isInlinedFrame()); | |
57 assertEquals(4 - i, frame.inlinedFrameIndex()); | |
58 } else if (i == 2) { | |
59 assertTrue(frame.isOptimizedFrame()); | |
60 assertFalse(frame.isInlinedFrame()); | |
61 } else { | |
62 assertFalse(frame.isOptimizedFrame()); | |
63 assertFalse(frame.isInlinedFrame()); | |
64 } | |
65 } | |
66 } | |
67 } | 48 } |
68 } | 49 } |
69 } | 50 } |
70 | 51 |
71 function f() { | 52 function f() { |
72 g(); | 53 g(); |
73 } | 54 } |
74 | 55 |
75 function g() { | 56 function g() { |
76 count++; | 57 count++; |
(...skipping 12 matching lines...) Expand all Loading... |
89 // Add the debug event listener. | 70 // Add the debug event listener. |
90 Debug.setListener(listener); | 71 Debug.setListener(listener); |
91 | 72 |
92 f(); | 73 f(); |
93 | 74 |
94 assertEquals(5, count); | 75 assertEquals(5, count); |
95 assertEquals(2, break_count); | 76 assertEquals(2, break_count); |
96 | 77 |
97 // Get rid of the debug event listener. | 78 // Get rid of the debug event listener. |
98 Debug.setListener(null); | 79 Debug.setListener(null); |
OLD | NEW |