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 28 matching lines...) Expand all Loading... | |
39 // version of the script) it remains unchanged, but the code that could | 39 // version of the script) it remains unchanged, but the code that could |
40 // create a new instance of this function goes away. An old version of script | 40 // create a new instance of this function goes away. An old version of script |
41 // is created to back up this obsolete function. | 41 // is created to back up this obsolete function. |
42 // All unchanged functions have their positions updated accordingly. | 42 // All unchanged functions have their positions updated accordingly. |
43 // | 43 // |
44 // LiveEdit namespace is declared inside a single function constructor. | 44 // LiveEdit namespace is declared inside a single function constructor. |
45 Debug.LiveEdit = new function() { | 45 Debug.LiveEdit = new function() { |
46 | 46 |
47 // Forward declaration for minifier. | 47 // Forward declaration for minifier. |
48 var FunctionStatus; | 48 var FunctionStatus; |
49 | |
50 const NEEDS_STEP_IN_PROPERTY_NAME = "stack_update_needs_step_in"; | |
Yang
2012/06/14 09:09:28
Do not use const in native javascript.
Peter Rybin
2012/06/14 22:08:03
Done.
| |
49 | 51 |
50 // Applies the change to the script. | 52 // Applies the change to the script. |
51 // The change is in form of list of chunks encoded in a single array as | 53 // The change is in form of list of chunks encoded in a single array as |
52 // a series of triplets (pos1_start, pos1_end, pos2_end) | 54 // a series of triplets (pos1_start, pos1_end, pos2_end) |
53 function ApplyPatchMultiChunk(script, diff_array, new_source, preview_only, | 55 function ApplyPatchMultiChunk(script, diff_array, new_source, preview_only, |
54 change_log) { | 56 change_log) { |
55 | 57 |
56 var old_source = script.source; | 58 var old_source = script.source; |
57 | 59 |
58 // Gather compile information about old version of script. | 60 // Gather compile information about old version of script. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 // Committing all changes. | 156 // Committing all changes. |
155 | 157 |
156 // Check that function being patched is not currently on stack or drop them. | 158 // Check that function being patched is not currently on stack or drop them. |
157 var dropped_functions_number = | 159 var dropped_functions_number = |
158 CheckStackActivations(replaced_function_infos, change_log); | 160 CheckStackActivations(replaced_function_infos, change_log); |
159 | 161 |
160 preview_description.stack_modified = dropped_functions_number != 0; | 162 preview_description.stack_modified = dropped_functions_number != 0; |
161 | 163 |
162 // Our current implementation requires client to manually issue "step in" | 164 // Our current implementation requires client to manually issue "step in" |
163 // command for correct stack state. | 165 // command for correct stack state. |
164 preview_description.stack_update_needs_step_in = | 166 preview_description[NEEDS_STEP_IN_PROPERTY_NAME] = |
165 preview_description.stack_modified; | 167 preview_description.stack_modified; |
166 | 168 |
167 // Start with breakpoints. Convert their line/column positions and | 169 // Start with breakpoints. Convert their line/column positions and |
168 // temporary remove. | 170 // temporary remove. |
169 var break_points_restorer = TemporaryRemoveBreakPoints(script, change_log); | 171 var break_points_restorer = TemporaryRemoveBreakPoints(script, change_log); |
170 | 172 |
171 var old_script; | 173 var old_script; |
172 | 174 |
173 // Create an old script only if there are function that should be linked | 175 // Create an old script only if there are function that should be linked |
174 // to old version. | 176 // to old version. |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1070 | 1072 |
1071 function DescribePositions(node) { | 1073 function DescribePositions(node) { |
1072 return { | 1074 return { |
1073 start_position: node.info.start_position, | 1075 start_position: node.info.start_position, |
1074 end_position: node.info.end_position | 1076 end_position: node.info.end_position |
1075 }; | 1077 }; |
1076 } | 1078 } |
1077 | 1079 |
1078 return ProcessOldNode(old_code_tree); | 1080 return ProcessOldNode(old_code_tree); |
1079 } | 1081 } |
1080 | 1082 |
1083 // Restarts call frame and returns value similar to what LiveEdit returns. | |
1084 function RestartFrame(frame_mirror) { | |
1085 var result = frame_mirror.restart(); | |
1086 if (IS_STRING(result)) { | |
1087 throw Failure("Failed to restrart frame: " + result); | |
1088 } | |
1089 var result = {}; | |
1090 result[NEEDS_STEP_IN_PROPERTY_NAME] = true; | |
1091 return result; | |
1092 } | |
1093 // Function is public. | |
1094 this.RestartFrame = RestartFrame; | |
1081 | 1095 |
1082 // Functions are public for tests. | 1096 // Functions are public for tests. |
1083 this.TestApi = { | 1097 this.TestApi = { |
1084 PosTranslator: PosTranslator, | 1098 PosTranslator: PosTranslator, |
1085 CompareStrings: CompareStrings, | 1099 CompareStrings: CompareStrings, |
1086 ApplySingleChunkPatch: ApplySingleChunkPatch | 1100 ApplySingleChunkPatch: ApplySingleChunkPatch |
1087 }; | 1101 }; |
1088 }; | 1102 }; |
OLD | NEW |