| OLD | NEW | 
|    1 // Copyright 2009 the V8 project authors. All rights reserved. |    1 // Copyright 2009 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 12 matching lines...) Expand all  Loading... | 
|   23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |   23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
|   24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |   24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
|   25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |   25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
|   26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |   26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|   27  |   27  | 
|   28 // Flags: --expose-debug-as debug |   28 // Flags: --expose-debug-as debug | 
|   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 var exception = null; |   32 var exception = null; | 
|   33 var step_out_count = 1; |  | 
|   34  |   33  | 
|   35 // Simple debug event handler which counts the number of breaks hit and steps. |   34 // Simple debug event handler which counts the number of breaks hit and steps. | 
|   36 var break_point_hit_count = 0; |   35 var break_point_hit_count = 0; | 
|   37 function listener(event, exec_state, event_data, data) { |   36 function listener(event, exec_state, event_data, data) { | 
|   38   try { |   37   try { | 
|   39     if (event == Debug.DebugEvent.Break) { |   38     if (event == Debug.DebugEvent.Break) { | 
|   40       break_point_hit_count++; |   39       break_point_hit_count++; | 
|   41       // Continue stepping until returned to bottom frame. |   40       // Continue stepping until returned to bottom frame. | 
|   42       if (exec_state.frameCount() > 1) { |   41       if (exec_state.frameCount() > 1) { | 
|   43         exec_state.prepareStep(Debug.StepAction.StepOut, step_out_count); |   42         exec_state.prepareStep(Debug.StepAction.StepOut); | 
|   44       } |   43       } | 
|   45  |   44  | 
|   46     } |   45     } | 
|   47   } catch(e) { |   46   } catch(e) { | 
|   48     exception = e; |   47     exception = e; | 
|   49   } |   48   } | 
|   50  |   49  | 
|   51 }; |   50 }; | 
|   52  |   51  | 
|   53 function BeginTest(name) { |   52 function BeginTest(name) { | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|   73   } |   72   } | 
|   74   if (x < 2) { |   73   if (x < 2) { | 
|   75     return 1; |   74     return 1; | 
|   76   } else { |   75   } else { | 
|   77     return x*fact(x-1); |   76     return x*fact(x-1); | 
|   78   } |   77   } | 
|   79 } |   78 } | 
|   80  |   79  | 
|   81 BeginTest('Test 1'); |   80 BeginTest('Test 1'); | 
|   82 shouldBreak = function(x) { return x == 3; }; |   81 shouldBreak = function(x) { return x == 3; }; | 
|   83 step_out_count = 1; |  | 
|   84 fact(3); |   82 fact(3); | 
|   85 EndTest(2); |   83 EndTest(2); | 
|   86  |   84  | 
|   87 BeginTest('Test 2'); |   85 BeginTest('Test 2'); | 
|   88 shouldBreak = function(x) { return x == 2; }; |   86 shouldBreak = function(x) { return x == 2; }; | 
|   89 step_out_count = 1; |  | 
|   90 fact(3); |   87 fact(3); | 
|   91 EndTest(3); |   88 EndTest(3); | 
|   92  |   89  | 
|   93 BeginTest('Test 3'); |   90 BeginTest('Test 3'); | 
|   94 shouldBreak = function(x) { return x == 1; }; |   91 shouldBreak = function(x) { return x == 1; }; | 
|   95 step_out_count = 2; |  | 
|   96 fact(3); |   92 fact(3); | 
|   97 EndTest(2); |   93 EndTest(4); | 
|   98  |   94  | 
|   99 BeginTest('Test 4'); |   95 BeginTest('Test 4'); | 
|  100 shouldBreak = function(x) { return x == 1 || x == 3; }; |   96 shouldBreak = function(x) { return x == 1 || x == 3; }; | 
|  101 step_out_count = 2; |  | 
|  102 fact(3); |   97 fact(3); | 
|  103 EndTest(3); |   98 EndTest(5); | 
|  104  |   99  | 
|  105 // Get rid of the debug event listener. |  100 // Get rid of the debug event listener. | 
|  106 Debug.setListener(null); |  101 Debug.setListener(null); | 
| OLD | NEW |