| Index: src/debug/liveedit.cc
|
| diff --git a/src/debug/liveedit.cc b/src/debug/liveedit.cc
|
| index 3ced3cc427405584f1dfed241f62d992a302cf87..ace829739faeb6dd93286dd27eeb27bc75980889 100644
|
| --- a/src/debug/liveedit.cc
|
| +++ b/src/debug/liveedit.cc
|
| @@ -604,9 +604,12 @@
|
| return Smi::cast(length)->value();
|
| }
|
|
|
| -void FunctionInfoWrapper::SetInitialProperties(
|
| - Handle<String> name, int start_position, int end_position, int param_num,
|
| - int literal_count, int parent_index, int function_literal_id) {
|
| +
|
| +void FunctionInfoWrapper::SetInitialProperties(Handle<String> name,
|
| + int start_position,
|
| + int end_position, int param_num,
|
| + int literal_count,
|
| + int parent_index) {
|
| HandleScope scope(isolate());
|
| this->SetField(kFunctionNameOffset_, name);
|
| this->SetSmiValueField(kStartPositionOffset_, start_position);
|
| @@ -614,7 +617,6 @@
|
| this->SetSmiValueField(kParamNumOffset_, param_num);
|
| this->SetSmiValueField(kLiteralNumOffset_, literal_count);
|
| this->SetSmiValueField(kParentIndexOffset_, parent_index);
|
| - this->SetSmiValueField(kFunctionLiteralIdOffset_, function_literal_id);
|
| }
|
|
|
| void FunctionInfoWrapper::SetSharedFunctionInfo(
|
| @@ -1036,36 +1038,15 @@
|
| isolate->compilation_cache()->Remove(shared_info);
|
| }
|
|
|
| -void LiveEdit::FunctionSourceUpdated(Handle<JSArray> shared_info_array,
|
| - int new_function_literal_id) {
|
| +
|
| +void LiveEdit::FunctionSourceUpdated(Handle<JSArray> shared_info_array) {
|
| SharedInfoWrapper shared_info_wrapper(shared_info_array);
|
| Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo();
|
|
|
| - shared_info->set_function_literal_id(new_function_literal_id);
|
| DeoptimizeDependentFunctions(*shared_info);
|
| shared_info_array->GetIsolate()->compilation_cache()->Remove(shared_info);
|
| }
|
|
|
| -void LiveEdit::FixupScript(Handle<Script> script, int max_function_literal_id) {
|
| - Isolate* isolate = script->GetIsolate();
|
| - Handle<FixedArray> old_infos(script->shared_function_infos(), isolate);
|
| - Handle<FixedArray> new_infos(
|
| - isolate->factory()->NewFixedArray(max_function_literal_id + 1));
|
| - script->set_shared_function_infos(*new_infos);
|
| - SharedFunctionInfo::ScriptIterator iterator(isolate, old_infos);
|
| - while (SharedFunctionInfo* shared = iterator.Next()) {
|
| - // We can't use SharedFunctionInfo::SetScript(info, undefined_value()) here,
|
| - // as we severed the link from the Script to the SharedFunctionInfo above.
|
| - Handle<SharedFunctionInfo> info(shared, isolate);
|
| - info->set_script(isolate->heap()->undefined_value());
|
| - Handle<Object> new_noscript_list = WeakFixedArray::Add(
|
| - isolate->factory()->noscript_shared_function_infos(), info);
|
| - isolate->heap()->SetRootNoScriptSharedFunctionInfos(*new_noscript_list);
|
| -
|
| - // Put the SharedFunctionInfo at its new, correct location.
|
| - SharedFunctionInfo::SetScript(info, script);
|
| - }
|
| -}
|
|
|
| void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper,
|
| Handle<Object> script_handle) {
|
| @@ -1192,16 +1173,13 @@
|
| copy->set_eval_from_shared(original->eval_from_shared());
|
| copy->set_eval_from_position(original->eval_from_position());
|
|
|
| - Handle<FixedArray> infos(isolate->factory()->NewFixedArray(
|
| - original->shared_function_infos()->length()));
|
| - copy->set_shared_function_infos(*infos);
|
| -
|
| // Copy all the flags, but clear compilation state.
|
| copy->set_flags(original->flags());
|
| copy->set_compilation_state(Script::COMPILATION_STATE_INITIAL);
|
|
|
| return copy;
|
| }
|
| +
|
|
|
| Handle<Object> LiveEdit::ChangeScriptSource(Handle<Script> original_script,
|
| Handle<String> new_source,
|
| @@ -1878,8 +1856,10 @@
|
| // Recurse using the regular traversal.
|
| AstTraversalVisitor::VisitFunctionLiteral(node);
|
| // FunctionDone are called in post-order.
|
| + // TODO(jgruber): If required, replace the (linear cost)
|
| + // FindSharedFunctionInfo call with a more efficient implementation.
|
| Handle<SharedFunctionInfo> info =
|
| - script_->FindSharedFunctionInfo(isolate_, node).ToHandleChecked();
|
| + script_->FindSharedFunctionInfo(node).ToHandleChecked();
|
| FunctionDone(info, node->scope());
|
| }
|
|
|
| @@ -1889,7 +1869,7 @@
|
| info.SetInitialProperties(fun->name(), fun->start_position(),
|
| fun->end_position(), fun->parameter_count(),
|
| fun->materialized_literal_count(),
|
| - current_parent_index_, fun->function_literal_id());
|
| + current_parent_index_);
|
| current_parent_index_ = len_;
|
| SetElementSloppy(result_, len_, info.GetJSArray());
|
| len_++;
|
|
|