Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: test/mjsunit/debug-liveedit-patch-positions-replace.js

Issue 1697016: LiveEdit: clean JS sources a bit (Closed)
Patch Set: tab Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/debug-liveedit-patch-positions.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.LiveEdit.ApplyPatch(script, patch_pos, orig_body.length, new_body_patch, change_log); 62 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, orig_body.leng th, 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);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-liveedit-patch-positions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698