OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // LiveEdit feature implementation. The script should be executed after | 5 // LiveEdit feature implementation. The script should be executed after |
6 // debug-debugger.js. | 6 // debug-debugger.js. |
7 | 7 |
8 // A LiveEdit namespace. It contains functions that modifies JavaScript code | 8 // A LiveEdit namespace. It contains functions that modifies JavaScript code |
9 // according to changes of script source (if possible). | 9 // according to changes of script source (if possible). |
10 // | 10 // |
11 // When new script source is put in, the difference is calculated textually, | 11 // When new script source is put in, the difference is calculated textually, |
12 // in form of list of delete/add/change chunks. The functions that include | 12 // in form of list of delete/add/change chunks. The functions that include |
13 // change chunk(s) get recompiled, or their enclosing functions are | 13 // change chunk(s) get recompiled, or their enclosing functions are |
14 // recompiled instead. | 14 // recompiled instead. |
15 // If the function may not be recompiled (e.g. it was completely erased in new | 15 // If the function may not be recompiled (e.g. it was completely erased in new |
16 // version of the script) it remains unchanged, but the code that could | 16 // version of the script) it remains unchanged, but the code that could |
17 // create a new instance of this function goes away. An old version of script | 17 // create a new instance of this function goes away. An old version of script |
18 // is created to back up this obsolete function. | 18 // is created to back up this obsolete function. |
19 // All unchanged functions have their positions updated accordingly. | 19 // All unchanged functions have their positions updated accordingly. |
20 // | 20 // |
21 // LiveEdit namespace is declared inside a single function constructor. | 21 // LiveEdit namespace is declared inside a single function constructor. |
| 22 |
| 23 "use strict"; |
| 24 |
22 Debug.LiveEdit = new function() { | 25 Debug.LiveEdit = new function() { |
23 | 26 |
24 // Forward declaration for minifier. | 27 // Forward declaration for minifier. |
25 var FunctionStatus; | 28 var FunctionStatus; |
26 | 29 |
27 var NEEDS_STEP_IN_PROPERTY_NAME = "stack_update_needs_step_in"; | 30 var NEEDS_STEP_IN_PROPERTY_NAME = "stack_update_needs_step_in"; |
28 | 31 |
29 // Applies the change to the script. | 32 // Applies the change to the script. |
30 // The change is in form of list of chunks encoded in a single array as | 33 // The change is in form of list of chunks encoded in a single array as |
31 // a series of triplets (pos1_start, pos1_end, pos2_end) | 34 // a series of triplets (pos1_start, pos1_end, pos2_end) |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 BLOCKED_ON_ACTIVE_STACK: 2, | 949 BLOCKED_ON_ACTIVE_STACK: 2, |
947 BLOCKED_ON_OTHER_STACK: 3, | 950 BLOCKED_ON_OTHER_STACK: 3, |
948 BLOCKED_UNDER_NATIVE_CODE: 4, | 951 BLOCKED_UNDER_NATIVE_CODE: 4, |
949 REPLACED_ON_ACTIVE_STACK: 5, | 952 REPLACED_ON_ACTIVE_STACK: 5, |
950 BLOCKED_UNDER_GENERATOR: 6, | 953 BLOCKED_UNDER_GENERATOR: 6, |
951 BLOCKED_ACTIVE_GENERATOR: 7 | 954 BLOCKED_ACTIVE_GENERATOR: 7 |
952 }; | 955 }; |
953 | 956 |
954 FunctionPatchabilityStatus.SymbolName = function(code) { | 957 FunctionPatchabilityStatus.SymbolName = function(code) { |
955 var enumeration = FunctionPatchabilityStatus; | 958 var enumeration = FunctionPatchabilityStatus; |
956 for (name in enumeration) { | 959 for (var name in enumeration) { |
957 if (enumeration[name] == code) { | 960 if (enumeration[name] == code) { |
958 return name; | 961 return name; |
959 } | 962 } |
960 } | 963 } |
961 }; | 964 }; |
962 | 965 |
963 | 966 |
964 // A logical failure in liveedit process. This means that change_log | 967 // A logical failure in liveedit process. This means that change_log |
965 // is valid and consistent description of what happened. | 968 // is valid and consistent description of what happened. |
966 function Failure(message) { | 969 function Failure(message) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // Function is public. | 1116 // Function is public. |
1114 this.RestartFrame = RestartFrame; | 1117 this.RestartFrame = RestartFrame; |
1115 | 1118 |
1116 // Functions are public for tests. | 1119 // Functions are public for tests. |
1117 this.TestApi = { | 1120 this.TestApi = { |
1118 PosTranslator: PosTranslator, | 1121 PosTranslator: PosTranslator, |
1119 CompareStrings: CompareStrings, | 1122 CompareStrings: CompareStrings, |
1120 ApplySingleChunkPatch: ApplySingleChunkPatch | 1123 ApplySingleChunkPatch: ApplySingleChunkPatch |
1121 }; | 1124 }; |
1122 }; | 1125 }; |
OLD | NEW |