OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 if (event == Debug.DebugEvent.Break) { | 35 if (event == Debug.DebugEvent.Break) { |
36 break_break_point_hit_count++; | 36 break_break_point_hit_count++; |
37 // Continue stepping until returned to bottom frame. | 37 // Continue stepping until returned to bottom frame. |
38 if (exec_state.frameCount() > 1) { | 38 if (exec_state.frameCount() > 1) { |
39 exec_state.prepareStep(Debug.StepAction.StepIn); | 39 exec_state.prepareStep(Debug.StepAction.StepIn); |
40 } | 40 } |
41 } | 41 } |
42 }; | 42 }; |
43 | 43 |
44 // Add the debug event listener. | 44 // Add the debug event listener. |
45 Debug.addListener(listener); | 45 Debug.setListener(listener); |
46 | 46 |
47 // Use 'eval' to ensure that the call to print is through CodeStub CallFunction. | 47 // Use 'eval' to ensure that the call to print is through CodeStub CallFunction. |
48 // See Ia32CodeGenerator::VisitCall and Ia32CodeGenerator::CallWithArguments. | 48 // See Ia32CodeGenerator::VisitCall and Ia32CodeGenerator::CallWithArguments. |
49 function f() { | 49 function f() { |
50 debugger; | 50 debugger; |
51 eval(''); | 51 eval(''); |
52 print('Hello, world!'); | 52 print('Hello, world!'); |
53 }; | 53 }; |
54 | 54 |
55 break_break_point_hit_count = 0; | 55 break_break_point_hit_count = 0; |
56 f(); | 56 f(); |
57 assertEquals(5, break_break_point_hit_count); | 57 assertEquals(5, break_break_point_hit_count); |
58 | 58 |
59 // Use an inner function to ensure that the function call is through CodeStub | 59 // Use an inner function to ensure that the function call is through CodeStub |
60 // CallFunction see Ia32CodeGenerator::VisitCall and | 60 // CallFunction see Ia32CodeGenerator::VisitCall and |
61 // Ia32CodeGenerator::CallWithArguments. | 61 // Ia32CodeGenerator::CallWithArguments. |
62 function g() { | 62 function g() { |
63 function h() {} | 63 function h() {} |
64 debugger; | 64 debugger; |
65 h(); | 65 h(); |
66 }; | 66 }; |
67 | 67 |
68 break_break_point_hit_count = 0; | 68 break_break_point_hit_count = 0; |
69 g(); | 69 g(); |
70 assertEquals(4, break_break_point_hit_count); | 70 assertEquals(4, break_break_point_hit_count); |
71 | 71 |
72 // Get rid of the debug event listener. | 72 // Get rid of the debug event listener. |
73 Debug.removeListener(listener); | 73 Debug.setListener(null); |
OLD | NEW |