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

Unified Diff: src/liveedit-debugger.js

Issue 1652008: LiveEdit: calculate a real script difference (Closed)
Patch Set: static assert Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/liveedit.cc ('k') | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/liveedit-debugger.js
diff --git a/src/liveedit-debugger.js b/src/liveedit-debugger.js
index 2b1abecec7b76de5511f10271e78159c5e3ae4a4..d2aee87949b59f363f6e240798b5bf1452bda60a 100644
--- a/src/liveedit-debugger.js
+++ b/src/liveedit-debugger.js
@@ -36,19 +36,19 @@ Debug.LiveEdit = new function() {
// being replaced with a completely different string new_str.
//
// Only one function will have its Code changed in result of this function.
- // All nested functions (should they have any instances at the moment) are left
- // unchanged and re-linked to a newly created script instance representing old
- // version of the source. (Generally speaking,
+ // All nested functions (should they have any instances at the moment) are
+ // left unchanged and re-linked to a newly created script instance
+ // representing old version of the source. (Generally speaking,
// during the change all nested functions are erased and completely different
// set of nested functions are introduced.) All other functions just have
// their positions updated.
//
// @param {Script} script that is being changed
- // @param {Array} change_log a list that collects engineer-readable description
- // of what happened.
+ // @param {Array} change_log a list that collects engineer-readable
+ // description of what happened.
function ApplyPatch(script, change_pos, change_len, new_str,
change_log) {
-
+
// Fully compiles source string as a script. Returns Array of
// FunctionCompileInfo -- a descriptions of all functions of the script.
// Elements of array are ordered by start positions of functions (from top
@@ -58,8 +58,8 @@ Debug.LiveEdit = new function() {
// The script is used for compilation, because it produces code that
// needs to be linked with some particular script (for nested functions).
function DebugGatherCompileInfo(source) {
- // Get function info, elements are partially sorted (it is a tree
- // of nested functions serialized as parent followed by serialized children.
+ // Get function info, elements are partially sorted (it is a tree of
+ // nested functions serialized as parent followed by serialized children.
var raw_compile_info = %LiveEditGatherCompileInfo(script, source);
// Sort function infos by start position field.
@@ -117,7 +117,8 @@ Debug.LiveEdit = new function() {
return compile_info;
}
- // Given a positions, finds a function that fully includes the entire change.
+ // Given a positions, finds a function that fully includes the entire
+ // change.
function FindChangedFunction(compile_info, offset, len) {
// First condition: function should start before the change region.
// Function #0 (whole-script function) always does, but we want
@@ -269,7 +270,8 @@ Debug.LiveEdit = new function() {
// Update the script text and create a new script representing an old
// version of the script.
- var old_script = %LiveEditReplaceScript(script, new_source, old_script_name);
+ var old_script = %LiveEditReplaceScript(script, new_source,
+ old_script_name);
PatchCode(new_compile_info[function_being_patched],
FindFunctionInfo(function_being_patched));
@@ -477,6 +479,12 @@ Debug.LiveEdit = new function() {
}
// Function is public.
this.SetScriptSource = SetScriptSource;
+
+ function CompareStringsLinewise(s1, s2) {
+ return %LiveEditCompareStringsLinewise(s1, s2);
+ }
+ // Function is public (for tests).
+ this.CompareStringsLinewise = CompareStringsLinewise;
// Finds a difference between 2 strings in form of a single chunk.
« no previous file with comments | « src/liveedit.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698