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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 var orig_body = "{}"; | 53 var orig_body = "{}"; |
54 var patch_pos = script.source.indexOf(orig_body); | 54 var patch_pos = script.source.indexOf(orig_body); |
55 // Line long enough to change rinfo encoding. | 55 // Line long enough to change rinfo encoding. |
56 var new_body_patch = "{return 'Capybara';" + | 56 var new_body_patch = "{return 'Capybara';" + |
57 " "
+ | 57 " "
+ |
58 "}"; | 58 "}"; |
59 | 59 |
60 var change_log = new Array(); | 60 var change_log = new Array(); |
61 function Changer() { | 61 function Changer() { |
62 Debug.LiveEditChangeScript(script, patch_pos, orig_body.length, new_body_patch
, change_log); | 62 Debug.LiveEdit.ApplyPatch(script, patch_pos, orig_body.length, new_body_patch,
change_log); |
63 print("Change log: " + JSON.stringify(change_log) + "\n"); | 63 print("Change log: " + JSON.stringify(change_log) + "\n"); |
64 } | 64 } |
65 | 65 |
66 function NoOp() { | 66 function NoOp() { |
67 } | 67 } |
68 | 68 |
69 function CallM(changer) { | 69 function CallM(changer) { |
70 // We expect call IC here after several function runs. | 70 // We expect call IC here after several function runs. |
71 return BeingReplaced(changer); | 71 return BeingReplaced(changer); |
72 } | 72 } |
73 | 73 |
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 |