Commit 5502a851 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

inspector: liveedit: update all constant pools in new_script

Change-Id: I3605ecf593c32743f5401b5e8a2d57e877ebcc7c
Reviewed-on: https://chromium-review.googlesource.com/c/1306898Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57132}
parent 2e2604b9
...@@ -1177,14 +1177,15 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, ...@@ -1177,14 +1177,15 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script,
if (!js_function->is_compiled()) continue; if (!js_function->is_compiled()) continue;
JSFunction::EnsureFeedbackVector(js_function); JSFunction::EnsureFeedbackVector(js_function);
} }
}
if (!new_sfi->HasBytecodeArray()) continue; SharedFunctionInfo::ScriptIterator it(isolate, *new_script);
FixedArray* constants = new_sfi->GetBytecodeArray()->constant_pool(); while (SharedFunctionInfo* sfi = it.Next()) {
if (!sfi->HasBytecodeArray()) continue;
FixedArray* constants = sfi->GetBytecodeArray()->constant_pool();
for (int i = 0; i < constants->length(); ++i) { for (int i = 0; i < constants->length(); ++i) {
if (!constants->get(i)->IsSharedFunctionInfo()) continue; if (!constants->get(i)->IsSharedFunctionInfo()) continue;
SharedFunctionInfo* inner_sfi = SharedFunctionInfo* inner_sfi =
SharedFunctionInfo::cast(constants->get(i)); SharedFunctionInfo::cast(constants->get(i));
// See if there is a mapping from this function's start position to a // See if there is a mapping from this function's start position to a
// unchanged function's id. // unchanged function's id.
auto unchanged_it = auto unchanged_it =
...@@ -1197,13 +1198,11 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script, ...@@ -1197,13 +1198,11 @@ void LiveEdit::PatchScript(Isolate* isolate, Handle<Script> script,
SharedFunctionInfo::cast(new_script->shared_function_infos() SharedFunctionInfo::cast(new_script->shared_function_infos()
->Get(unchanged_it->second) ->Get(unchanged_it->second)
->GetHeapObject()); ->GetHeapObject());
// Now some sanity checks. Make sure that this inner_sfi is not the if (old_unchanged_inner_sfi == inner_sfi) continue;
// unchanged SFI yet...
DCHECK_NE(old_unchanged_inner_sfi, inner_sfi); DCHECK_NE(old_unchanged_inner_sfi, inner_sfi);
// ... and that the unchanged SFI has already been processed and patched // Now some sanity checks. Make sure that the unchanged SFI has already
// to be on the new script ... // been processed and patched to be on the new script ...
DCHECK_EQ(old_unchanged_inner_sfi->script(), *new_script); DCHECK_EQ(old_unchanged_inner_sfi->script(), *new_script);
constants->set(i, old_unchanged_inner_sfi); constants->set(i, old_unchanged_inner_sfi);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment