| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 15 matching lines...) Expand all Loading... |
| 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 | 30 |
| 31 // Scenario: some function is being edited; the outer function has to have its | 31 // Scenario: some function is being edited; the outer function has to have its |
| 32 // positions patched. Accoring to a special markup of function text | 32 // positions patched. Accoring to a special markup of function text |
| 33 // corresponding byte-code PCs should coincide before change and after it. | 33 // corresponding byte-code PCs should coincide before change and after it. |
| 34 | 34 |
| 35 Debug = debug.Debug | 35 Debug = debug.Debug |
| 36 Debug.setListener(function() {}); |
| 36 | 37 |
| 37 eval( | 38 eval( |
| 38 "function F1() { return 5; }\n" + | 39 "function F1() { return 5; }\n" + |
| 39 "function ChooseAnimal(/*$*/ ) {\n" + | 40 "function ChooseAnimal(/*$*/ ) {\n" + |
| 40 "/*$*/ var x = F1(/*$*/ );\n" + | 41 "/*$*/ var x = F1(/*$*/ );\n" + |
| 41 "/*$*/ var res/*$*/ =/*$*/ (function() { return 'Cat'; } )();\n" + | 42 "/*$*/ var res/*$*/ =/*$*/ (function() { return 'Cat'; } )();\n" + |
| 42 "/*$*/ var y/*$*/ = F2(/*$*/ F1()/*$*/ , F1(/*$*/ )/*$*/ );\n" + | 43 "/*$*/ var y/*$*/ = F2(/*$*/ F1()/*$*/ , F1(/*$*/ )/*$*/ );\n" + |
| 43 "/*$*/ if (/*$*/ x.toString(/*$*/ )) { /*$*/ y = 3;/*$*/ } else {/*$*/ y =
8;/*$*/ }\n" + | 44 "/*$*/ if (/*$*/ x.toString(/*$*/ )) { /*$*/ y = 3;/*$*/ } else {/*$*/ y =
8;/*$*/ }\n" + |
| 44 "/*$*/ var z = /*$*/ x * y;\n" + | 45 "/*$*/ var z = /*$*/ x * y;\n" + |
| 45 "/*$*/ return/*$*/ res/*$*/ + z;/*$*/ }\n" + | 46 "/*$*/ return/*$*/ res/*$*/ + z;/*$*/ }\n" + |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 print(pcArray1); | 118 print(pcArray1); |
| 118 print(pcArray2); | 119 print(pcArray2); |
| 119 | 120 |
| 120 // Function can be marked for recompilation at any point (especially if we are | 121 // Function can be marked for recompilation at any point (especially if we are |
| 121 // running with --stress-opt). When we mark function for recompilation we | 122 // running with --stress-opt). When we mark function for recompilation we |
| 122 // replace it's code with stub. So there is no reliable way to get PCs for | 123 // replace it's code with stub. So there is no reliable way to get PCs for |
| 123 // function. | 124 // function. |
| 124 if (pcArray1 && pcArray2) { | 125 if (pcArray1 && pcArray2) { |
| 125 assertArrayEquals(pcArray1, pcArray2); | 126 assertArrayEquals(pcArray1, pcArray2); |
| 126 } | 127 } |
| 128 |
| 129 Debug.setListener(null); |
| OLD | NEW |