| 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 18 matching lines...) Expand all Loading... |
| 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: a function is being changed, which causes enclosing function to | 31 // Scenario: a function is being changed, which causes enclosing function to |
| 32 // have its positions patched; position changing requires new instance of Code | 32 // have its positions patched; position changing requires new instance of Code |
| 33 // object to be introduced; the function happens to be on stack at this moment; | 33 // object to be introduced; the function happens to be on stack at this moment; |
| 34 // later it will resume over new instance of Code. | 34 // later it will resume over new instance of Code. |
| 35 // Before the change 2 rinfo are 22 characters away from each other. After the | 35 // Before the change 2 rinfo are 22 characters away from each other. After the |
| 36 // change they are 114 characters away from each other. New instance of Code is | 36 // change they are 114 characters away from each other. New instance of Code is |
| 37 // required when those numbers cross the border value of 64 (in any direction). | 37 // required when those numbers cross the border value of 64 (in any direction). |
| 38 | 38 |
| 39 Debug = debug.Debug | 39 Debug = debug.Debug; |
| 40 | 40 |
| 41 eval( | 41 eval( |
| 42 "function BeingReplaced(changer, opt_x, opt_y) {\n" + | 42 "function BeingReplaced(changer, opt_x, opt_y) {\n" + |
| 43 " changer();\n" + | 43 " changer();\n" + |
| 44 " var res = new Object();\n" + | 44 " var res = new Object();\n" + |
| 45 " if (opt_x) { res.y = opt_y; }\n" + | 45 " if (opt_x) { res.y = opt_y; }\n" + |
| 46 " res.a = (function() {})();\n" + | 46 " res.a = (function() {})();\n" + |
| 47 " return res.a;\n" + | 47 " return res.a;\n" + |
| 48 "}" | 48 "}" |
| 49 ); | 49 ); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 // This several iterations should cause call IC for BeingReplaced call. This IC | 74 // This several iterations should cause call IC for BeingReplaced call. This IC |
| 75 // will keep reference to code object of BeingRepalced function. This reference | 75 // will keep reference to code object of BeingRepalced function. This reference |
| 76 // should also be patched. Unfortunately, this is a manually checked fact (from | 76 // should also be patched. Unfortunately, this is a manually checked fact (from |
| 77 // debugger or debug print) and doesn't work as an automatic test. | 77 // debugger or debug print) and doesn't work as an automatic test. |
| 78 CallM(NoOp); | 78 CallM(NoOp); |
| 79 CallM(NoOp); | 79 CallM(NoOp); |
| 80 CallM(NoOp); | 80 CallM(NoOp); |
| 81 | 81 |
| 82 var res = CallM(Changer); | 82 var res = CallM(Changer); |
| 83 assertEquals("Capybara", res); | 83 assertEquals("Capybara", res); |
| OLD | NEW |