| Index: src/debug/liveedit.cc
|
| diff --git a/src/debug/liveedit.cc b/src/debug/liveedit.cc
|
| index ace829739faeb6dd93286dd27eeb27bc75980889..befd76b2a50ed3fc29edce7cd9365f8d6bc7a7a5 100644
|
| --- a/src/debug/liveedit.cc
|
| +++ b/src/debug/liveedit.cc
|
| @@ -604,12 +604,9 @@ static int GetArrayLength(Handle<JSArray> array) {
|
| 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) {
|
| +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) {
|
| HandleScope scope(isolate());
|
| this->SetField(kFunctionNameOffset_, name);
|
| this->SetSmiValueField(kStartPositionOffset_, start_position);
|
| @@ -617,6 +614,7 @@ void FunctionInfoWrapper::SetInitialProperties(Handle<String> name,
|
| this->SetSmiValueField(kParamNumOffset_, param_num);
|
| this->SetSmiValueField(kLiteralNumOffset_, literal_count);
|
| this->SetSmiValueField(kParentIndexOffset_, parent_index);
|
| + this->SetSmiValueField(kFunctionLiteralIdOffset_, function_literal_id);
|
| }
|
|
|
| void FunctionInfoWrapper::SetSharedFunctionInfo(
|
| @@ -1173,6 +1171,10 @@ static Handle<Script> CreateScriptCopy(Handle<Script> original) {
|
| copy->set_eval_from_shared(original->eval_from_shared());
|
| copy->set_eval_from_position(original->eval_from_position());
|
|
|
| + Handle<FixedArray> infos(isolate->factory()->NewFixedArrayWithSmis(
|
| + original->shared_function_infos()->length(), 0));
|
| + 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);
|
| @@ -1180,8 +1182,8 @@ static Handle<Script> CreateScriptCopy(Handle<Script> original) {
|
| return copy;
|
| }
|
|
|
| -
|
| Handle<Object> LiveEdit::ChangeScriptSource(Handle<Script> original_script,
|
| + int max_function_literal_id,
|
| Handle<String> new_source,
|
| Handle<Object> old_script_name) {
|
| Isolate* isolate = original_script->GetIsolate();
|
| @@ -1200,6 +1202,10 @@ Handle<Object> LiveEdit::ChangeScriptSource(Handle<Script> original_script,
|
| // Drop line ends so that they will be recalculated.
|
| original_script->set_line_ends(isolate->heap()->undefined_value());
|
|
|
| + Handle<FixedArray> infos(isolate->factory()->NewFixedArrayWithSmis(
|
| + max_function_literal_id + 1, 0));
|
| + original_script->set_shared_function_infos(*infos);
|
| +
|
| return old_script_object;
|
| }
|
|
|
| @@ -1856,8 +1862,6 @@ void LiveEditFunctionTracker::VisitFunctionLiteral(FunctionLiteral* node) {
|
| // 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(node).ToHandleChecked();
|
| FunctionDone(info, node->scope());
|
| @@ -1869,7 +1873,7 @@ void LiveEditFunctionTracker::FunctionStarted(FunctionLiteral* fun) {
|
| info.SetInitialProperties(fun->name(), fun->start_position(),
|
| fun->end_position(), fun->parameter_count(),
|
| fun->materialized_literal_count(),
|
| - current_parent_index_);
|
| + current_parent_index_, fun->function_literal_id());
|
| current_parent_index_ = len_;
|
| SetElementSloppy(result_, len_, info.GetJSArray());
|
| len_++;
|
|
|