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
This commit is contained in:
peter.rybin@gmail.com 2010-09-09 17:45:21 +00:00
parent 624b13a804
commit 4ed429cc43

View File

@ -617,9 +617,33 @@ class FunctionInfoListener {
current_parent_index_ = info.GetParentIndex(); current_parent_index_ = info.GetParentIndex();
} }
// TODO(LiveEdit): Move private method below. public:
// This private section was created here to avoid moving the function // Saves only function code, because for a script function we
// to keep already complex diff simpler. // may never create a SharedFunctionInfo object.
void FunctionCode(Handle<Code> function_code) {
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
info.SetFunctionCode(function_code, Handle<Object>(Heap::null_value()));
}
// Saves full information about a function: its code, its scope info
// and a SharedFunctionInfo object.
void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope) {
if (!shared->IsSharedFunctionInfo()) {
return;
}
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
info.SetFunctionCode(Handle<Code>(shared->code()),
Handle<Object>(shared->scope_info()));
info.SetSharedFunctionInfo(shared);
Handle<Object> scope_info_list(SerializeFunctionScope(scope));
info.SetOuterScopeInfo(scope_info_list);
}
Handle<JSArray> GetResult() { return result_; }
private: private:
Object* SerializeFunctionScope(Scope* scope) { Object* SerializeFunctionScope(Scope* scope) {
HandleScope handle_scope; HandleScope handle_scope;
@ -676,36 +700,6 @@ class FunctionInfoListener {
return *scope_info_list; return *scope_info_list;
} }
public:
// Saves only function code, because for a script function we
// may never create a SharedFunctionInfo object.
void FunctionCode(Handle<Code> function_code) {
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
info.SetFunctionCode(function_code, Handle<Object>(Heap::null_value()));
}
// Saves full information about a function: its code, its scope info
// and a SharedFunctionInfo object.
void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope) {
if (!shared->IsSharedFunctionInfo()) {
return;
}
FunctionInfoWrapper info =
FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
info.SetFunctionCode(Handle<Code>(shared->code()),
Handle<Object>(shared->scope_info()));
info.SetSharedFunctionInfo(shared);
Handle<Object> scope_info_list(SerializeFunctionScope(scope));
info.SetOuterScopeInfo(scope_info_list);
}
Handle<JSArray> GetResult() {
return result_;
}
private:
Handle<JSArray> result_; Handle<JSArray> result_;
int len_; int len_;
int current_parent_index_; int current_parent_index_;