Revision: 2687
Author: [email protected]
Date: Fri Aug 14 04:05:42 2009
Log: Refactor SetFunctionInfo to reduce long argument list.
Review URL: http://codereview.chromium.org/165527
http://code.google.com/p/v8/source/detail?r=2687
Modified:
/branches/bleeding_edge/src/codegen.cc
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/ia32/codegen-ia32.h
=======================================
--- /branches/bleeding_edge/src/codegen.cc Thu Jul 30 04:53:29 2009
+++ /branches/bleeding_edge/src/codegen.cc Fri Aug 14 04:05:42 2009
@@ -243,23 +243,18 @@
// in the full script source. When counting characters in the script
source the
// the first character is number 0 (not 1).
void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun,
- int length,
- int function_token_position,
- int start_position,
- int end_position,
- bool is_expression,
+ FunctionLiteral* lit,
bool is_toplevel,
- Handle<Script> script,
- Handle<String> inferred_name) {
- fun->shared()->set_length(length);
- fun->shared()->set_formal_parameter_count(length);
+ Handle<Script> script) {
+ fun->shared()->set_length(lit->num_parameters());
+ fun->shared()->set_formal_parameter_count(lit->num_parameters());
fun->shared()->set_script(*script);
- fun->shared()->set_function_token_position(function_token_position);
- fun->shared()->set_start_position(start_position);
- fun->shared()->set_end_position(end_position);
- fun->shared()->set_is_expression(is_expression);
+
fun->shared()->set_function_token_position(lit->function_token_position());
+ fun->shared()->set_start_position(lit->start_position());
+ fun->shared()->set_end_position(lit->end_position());
+ fun->shared()->set_is_expression(lit->is_expression());
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 @@
node->materialized_literal_count(),
node->contains_array_literal(),
code);
- CodeGenerator::SetFunctionInfo(function, node->num_parameters(),
- node->function_token_position(),
- node->start_position(),
node->end_position(),
- node->is_expression(), false, script_,
- node->inferred_name());
+ CodeGenerator::SetFunctionInfo(function, node, false, script_);
#ifdef ENABLE_DEBUGGER_SUPPORT
// Notify debugger that a new function has been added.
=======================================
--- /branches/bleeding_edge/src/compiler.cc Thu Aug 13 03:25:35 2009
+++ /branches/bleeding_edge/src/compiler.cc Fri Aug 14 04:05:42 2009
@@ -219,11 +219,8 @@
lit->contains_array_literal(),
code);
- CodeGenerator::SetFunctionInfo(fun, lit->scope()->num_parameters(),
- RelocInfo::kNoPosition,
- lit->start_position(),
lit->end_position(),
- lit->is_expression(), true, script,
- lit->inferred_name());
+ ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
+ CodeGenerator::SetFunctionInfo(fun, lit, true, script);
// Hint to the runtime system used when allocating space for initial
// property space by setting the expected number of properties for
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.h Wed Aug 5 05:52:31 2009
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.h Fri Aug 14 04:05:42 2009
@@ -299,14 +299,9 @@
#endif
static void SetFunctionInfo(Handle<JSFunction> fun,
- int length,
- int function_token_position,
- int start_position,
- int end_position,
- bool is_expression,
+ FunctionLiteral* lit,
bool is_toplevel,
- Handle<Script> script,
- Handle<String> inferred_name);
+ Handle<Script> script);
// Accessors
MacroAssembler* masm() { return masm_; }
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---