From 4ed429cc4347bd22b8d6476e8ca0cfd4fc359046 Mon Sep 17 00:00:00 2001 From: "peter.rybin@gmail.com" Date: Thu, 9 Sep 2010 17:45:21 +0000 Subject: [PATCH] Landing 3338012: Move a function below to private section. Review URL: http://codereview.chromium.org/3295023 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5434 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/liveedit.cc | 60 ++++++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/src/liveedit.cc b/src/liveedit.cc index 5a8749e..41523a8 100644 --- a/src/liveedit.cc +++ b/src/liveedit.cc @@ -617,9 +617,33 @@ class FunctionInfoListener { current_parent_index_ = info.GetParentIndex(); } -// TODO(LiveEdit): Move private method below. -// This private section was created here to avoid moving the function -// to keep already complex diff simpler. + public: + // Saves only function code, because for a script function we + // may never create a SharedFunctionInfo object. + void FunctionCode(Handle function_code) { + FunctionInfoWrapper info = + FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_)); + info.SetFunctionCode(function_code, Handle(Heap::null_value())); + } + + // Saves full information about a function: its code, its scope info + // and a SharedFunctionInfo object. + void FunctionInfo(Handle shared, Scope* scope) { + if (!shared->IsSharedFunctionInfo()) { + return; + } + FunctionInfoWrapper info = + FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_)); + info.SetFunctionCode(Handle(shared->code()), + Handle(shared->scope_info())); + info.SetSharedFunctionInfo(shared); + + Handle scope_info_list(SerializeFunctionScope(scope)); + info.SetOuterScopeInfo(scope_info_list); + } + + Handle GetResult() { return result_; } + private: Object* SerializeFunctionScope(Scope* scope) { HandleScope handle_scope; @@ -676,36 +700,6 @@ class FunctionInfoListener { return *scope_info_list; } - public: - // Saves only function code, because for a script function we - // may never create a SharedFunctionInfo object. - void FunctionCode(Handle function_code) { - FunctionInfoWrapper info = - FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_)); - info.SetFunctionCode(function_code, Handle(Heap::null_value())); - } - - // Saves full information about a function: its code, its scope info - // and a SharedFunctionInfo object. - void FunctionInfo(Handle shared, Scope* scope) { - if (!shared->IsSharedFunctionInfo()) { - return; - } - FunctionInfoWrapper info = - FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_)); - info.SetFunctionCode(Handle(shared->code()), - Handle(shared->scope_info())); - info.SetSharedFunctionInfo(shared); - - Handle scope_info_list(SerializeFunctionScope(scope)); - info.SetOuterScopeInfo(scope_info_list); - } - - Handle GetResult() { - return result_; - } - - private: Handle result_; int len_; int current_parent_index_; -- 2.7.4