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

Unified Diff: src/debug/liveedit.js

Issue 2577063002: Reland of "Store SharedFunctionInfos of a Script in a FixedArray indexed by their ID" (Closed)
Patch Set: fix Created 4 years 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/debug/liveedit.cc ('k') | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/liveedit.js
diff --git a/src/debug/liveedit.js b/src/debug/liveedit.js
index d85e827115bbe3b68f648ce7730d90a92f57f78a..0076543f8b73c04f70af479ceb1a07068dba02fd 100644
--- a/src/debug/liveedit.js
+++ b/src/debug/liveedit.js
@@ -29,6 +29,7 @@
var FindScriptSourcePosition = global.Debug.findScriptSourcePosition;
var GlobalArray = global.Array;
var MathFloor = global.Math.floor;
+ var MathMax = global.Math.max;
var SyntaxError = global.SyntaxError;
// -------------------------------------------------------------------
@@ -75,6 +76,10 @@
}
throw failure;
}
+
+ var max_function_literal_id = new_compile_info.reduce(
+ (max, info) => MathMax(max, info.function_literal_id), 0);
+
var root_new_node = BuildCodeInfoTree(new_compile_info);
// Link recompiled script data with other data.
@@ -177,8 +182,7 @@
// Update the script text and create a new script representing an old
// version of the script.
- old_script = %LiveEditReplaceScript(script, new_source,
- old_script_name);
+ old_script = %LiveEditReplaceScript(script, new_source, old_script_name);
var link_to_old_script_report = new GlobalArray();
change_log.push( { linked_to_old_script: link_to_old_script_report } );
@@ -192,12 +196,6 @@
preview_description.created_script_name = old_script_name;
}
- // Link to an actual script all the functions that we are going to use.
- for (var i = 0; i < link_to_original_script_list.length; i++) {
- %LiveEditFunctionSetScript(
- link_to_original_script_list[i].info.shared_function_info, script);
- }
-
for (var i = 0; i < replace_code_list.length; i++) {
PatchFunctionCode(replace_code_list[i], change_log);
}
@@ -212,13 +210,25 @@
position_patch_report);
if (update_positions_list[i].live_shared_function_infos) {
- update_positions_list[i].live_shared_function_infos.
- forEach(function (info) {
- %LiveEditFunctionSourceUpdated(info.raw_array);
- });
+ var new_function_literal_id =
+ update_positions_list[i]
+ .corresponding_node.info.function_literal_id;
+ update_positions_list[i].live_shared_function_infos.forEach(function(
+ info) {
+ %LiveEditFunctionSourceUpdated(
+ info.raw_array, new_function_literal_id);
+ });
}
}
+ %LiveEditFixupScript(script, max_function_literal_id);
+
+ // Link all the functions we're going to use to an actual script.
+ for (var i = 0; i < link_to_original_script_list.length; i++) {
+ %LiveEditFunctionSetScript(
+ link_to_original_script_list[i].info.shared_function_info, script);
+ }
+
preview_description.updated = true;
return preview_description;
}
@@ -658,6 +668,8 @@
old_children[old_index].corresponding_node = UNDEFINED;
old_node.status = FunctionStatus.CHANGED;
}
+ } else {
+ ProcessNode(old_children[old_index], new_children[new_index]);
}
} else {
old_children[old_index].status = FunctionStatus.DAMAGED;
@@ -761,6 +773,7 @@
this.scope_info = raw_array[4];
this.outer_index = raw_array[5];
this.shared_function_info = raw_array[6];
+ this.function_literal_id = raw_array[8];
this.next_sibling_index = null;
this.raw_array = raw_array;
}
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698