| 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 // A testing entry. | 973 // A testing entry. |
| 974 function GetPcFromSourcePos(func, source_pos) { | 974 function GetPcFromSourcePos(func, source_pos) { |
| 975 return %GetFunctionCodePositionFromSource(func, source_pos); | 975 return %GetFunctionCodePositionFromSource(func, source_pos); |
| 976 } | 976 } |
| 977 // Function is public. | 977 // Function is public. |
| 978 this.GetPcFromSourcePos = GetPcFromSourcePos; | 978 this.GetPcFromSourcePos = GetPcFromSourcePos; |
| 979 | 979 |
| 980 // LiveEdit main entry point: changes a script text to a new string. | 980 // LiveEdit main entry point: changes a script text to a new string. |
| 981 function SetScriptSource(script, new_source, preview_only, change_log) { | 981 function SetScriptSource(script, new_source, preview_only, change_log) { |
| 982 var old_source = script.source; | 982 var old_source = script.source; |
| 983 var diff = CompareStringsLinewise(old_source, new_source); | 983 var diff = CompareStrings(old_source, new_source); |
| 984 return ApplyPatchMultiChunk(script, diff, new_source, preview_only, | 984 return ApplyPatchMultiChunk(script, diff, new_source, preview_only, |
| 985 change_log); | 985 change_log); |
| 986 } | 986 } |
| 987 // Function is public. | 987 // Function is public. |
| 988 this.SetScriptSource = SetScriptSource; | 988 this.SetScriptSource = SetScriptSource; |
| 989 | 989 |
| 990 function CompareStringsLinewise(s1, s2) { | 990 function CompareStrings(s1, s2) { |
| 991 return %LiveEditCompareStringsLinewise(s1, s2); | 991 return %LiveEditCompareStrings(s1, s2); |
| 992 } | 992 } |
| 993 | 993 |
| 994 // Applies the change to the script. | 994 // Applies the change to the script. |
| 995 // The change is always a substring (change_pos, change_pos + change_len) | 995 // The change is always a substring (change_pos, change_pos + change_len) |
| 996 // being replaced with a completely different string new_str. | 996 // being replaced with a completely different string new_str. |
| 997 // This API is a legacy and is obsolete. | 997 // This API is a legacy and is obsolete. |
| 998 // | 998 // |
| 999 // @param {Script} script that is being changed | 999 // @param {Script} script that is being changed |
| 1000 // @param {Array} change_log a list that collects engineer-readable | 1000 // @param {Array} change_log a list that collects engineer-readable |
| 1001 // description of what happened. | 1001 // description of what happened. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 }; | 1069 }; |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 return ProcessOldNode(old_code_tree); | 1072 return ProcessOldNode(old_code_tree); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 | 1075 |
| 1076 // Functions are public for tests. | 1076 // Functions are public for tests. |
| 1077 this.TestApi = { | 1077 this.TestApi = { |
| 1078 PosTranslator: PosTranslator, | 1078 PosTranslator: PosTranslator, |
| 1079 CompareStringsLinewise: CompareStringsLinewise, | 1079 CompareStrings: CompareStrings, |
| 1080 ApplySingleChunkPatch: ApplySingleChunkPatch | 1080 ApplySingleChunkPatch: ApplySingleChunkPatch |
| 1081 } | 1081 } |
| 1082 } | 1082 } |
| OLD | NEW |