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

Side by Side Diff: test/mjsunit/debug-liveedit-2.js

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 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-clearbreakpointgroup.js ('k') | test/mjsunit/debug-liveedit-breakpoints.js » ('j') | 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 13 matching lines...) Expand all
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 30
31 31
32 Debug = debug.Debug 32 Debug = debug.Debug
33 33
34 34 eval("function ChooseAnimal(p) {\n " +
35 eval( 35 " if (p == 7) {\n" + // Use p
36 "function ChooseAnimal(p) {\n " + 36 " return;\n" +
37 " if (p == 7) {\n" + // Use p 37 " }\n" +
38 " return;\n" + 38 " return function Chooser() {\n" +
39 " }\n" + 39 " return 'Cat';\n" +
40 " return function Chooser() {\n" + 40 " };\n" +
41 " return 'Cat';\n" + 41 "}\n");
42 " };\n" +
43 "}\n"
44 );
45 42
46 var old_closure = ChooseAnimal(19); 43 var old_closure = ChooseAnimal(19);
47 44
48 assertEquals("Cat", old_closure()); 45 assertEquals("Cat", old_closure());
49 46
50 var script = Debug.findScript(ChooseAnimal); 47 var script = Debug.findScript(ChooseAnimal);
51 48
52 var orig_animal = "'Cat'"; 49 var orig_animal = "'Cat'";
53 var patch_pos = script.source.indexOf(orig_animal); 50 var patch_pos = script.source.indexOf(orig_animal);
54 var new_animal_patch = "'Capybara' + p"; 51 var new_animal_patch = "'Capybara' + p";
55 52
56 // We patch innermost function "Chooser". 53 // We patch innermost function "Chooser".
57 // However, this does not actually patch existing "Chooser" instances, 54 // However, this does not actually patch existing "Chooser" instances,
58 // because old value of parameter "p" was not saved. 55 // because old value of parameter "p" was not saved.
59 // Instead it patches ChooseAnimal. 56 // Instead it patches ChooseAnimal.
60 var change_log = new Array(); 57 var change_log = new Array();
61 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, orig_animal.leng th, new_animal_patch, change_log); 58 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, orig_animal.leng th, new_animal_patch, change_log);
62 print("Change log: " + JSON.stringify(change_log) + "\n"); 59 print("Change log: " + JSON.stringify(change_log) + "\n");
63 60
64 var new_closure = ChooseAnimal(19); 61 var new_closure = ChooseAnimal(19);
65 // New instance of closure is patched. 62 // New instance of closure is patched.
66 assertEquals("Capybara19", new_closure()); 63 assertEquals("Capybara19", new_closure());
67 64
68 // Old instance of closure is not patched. 65 // Old instance of closure is not patched.
69 assertEquals("Cat", old_closure()); 66 assertEquals("Cat", old_closure());
70
OLDNEW
« no previous file with comments | « test/mjsunit/debug-clearbreakpointgroup.js ('k') | test/mjsunit/debug-liveedit-breakpoints.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698