Refactor SetFunctionInfo to reduce long argument list.

Review URL: http://codereview.chromium.org/165527

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2687 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
sgjesse@chromium.org 2009-08-14 11:05:42 +00:00
parent f04005b576
commit 7b05678316
3 changed files with 14 additions and 31 deletions

View File

@ -243,23 +243,18 @@ bool CodeGenerator::ShouldGenerateLog(Expression* type) {
// in the full script source. When counting characters in the script source the // in the full script source. When counting characters in the script source the
// the first character is number 0 (not 1). // the first character is number 0 (not 1).
void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun, void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun,
int length, FunctionLiteral* lit,
int function_token_position,
int start_position,
int end_position,
bool is_expression,
bool is_toplevel, bool is_toplevel,
Handle<Script> script, Handle<Script> script) {
Handle<String> inferred_name) { fun->shared()->set_length(lit->num_parameters());
fun->shared()->set_length(length); fun->shared()->set_formal_parameter_count(lit->num_parameters());
fun->shared()->set_formal_parameter_count(length);
fun->shared()->set_script(*script); fun->shared()->set_script(*script);
fun->shared()->set_function_token_position(function_token_position); fun->shared()->set_function_token_position(lit->function_token_position());
fun->shared()->set_start_position(start_position); fun->shared()->set_start_position(lit->start_position());
fun->shared()->set_end_position(end_position); fun->shared()->set_end_position(lit->end_position());
fun->shared()->set_is_expression(is_expression); fun->shared()->set_is_expression(lit->is_expression());
fun->shared()->set_is_toplevel(is_toplevel); fun->shared()->set_is_toplevel(is_toplevel);
fun->shared()->set_inferred_name(*inferred_name); fun->shared()->set_inferred_name(*lit->inferred_name());
} }
@ -317,11 +312,7 @@ Handle<JSFunction> CodeGenerator::BuildBoilerplate(FunctionLiteral* node) {
node->materialized_literal_count(), node->materialized_literal_count(),
node->contains_array_literal(), node->contains_array_literal(),
code); code);
CodeGenerator::SetFunctionInfo(function, node->num_parameters(), CodeGenerator::SetFunctionInfo(function, node, false, script_);
node->function_token_position(),
node->start_position(), node->end_position(),
node->is_expression(), false, script_,
node->inferred_name());
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
// Notify debugger that a new function has been added. // Notify debugger that a new function has been added.

View File

@ -219,11 +219,8 @@ static Handle<JSFunction> MakeFunction(bool is_global,
lit->contains_array_literal(), lit->contains_array_literal(),
code); code);
CodeGenerator::SetFunctionInfo(fun, lit->scope()->num_parameters(), ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
RelocInfo::kNoPosition, CodeGenerator::SetFunctionInfo(fun, lit, true, script);
lit->start_position(), lit->end_position(),
lit->is_expression(), true, script,
lit->inferred_name());
// Hint to the runtime system used when allocating space for initial // Hint to the runtime system used when allocating space for initial
// property space by setting the expected number of properties for // property space by setting the expected number of properties for

View File

@ -299,14 +299,9 @@ class CodeGenerator: public AstVisitor {
#endif #endif
static void SetFunctionInfo(Handle<JSFunction> fun, static void SetFunctionInfo(Handle<JSFunction> fun,
int length, FunctionLiteral* lit,
int function_token_position,
int start_position,
int end_position,
bool is_expression,
bool is_toplevel, bool is_toplevel,
Handle<Script> script, Handle<Script> script);
Handle<String> inferred_name);
// Accessors // Accessors
MacroAssembler* masm() { return masm_; } MacroAssembler* masm() { return masm_; }