Revision: 3055 Author: [email protected] Date: Tue Oct 13 02:37:17 2009 Log: Remove a redundant field in the FunctionLiteral class. The boolean contains_array_literal_ implies materialized_literal_count_ > 0, and we appear not to need to know about array literals specifically.
Review URL: http://codereview.chromium.org/272043 http://code.google.com/p/v8/source/detail?r=3055 Modified: /branches/bleeding_edge/src/ast.h /branches/bleeding_edge/src/codegen.cc /branches/bleeding_edge/src/compiler.cc /branches/bleeding_edge/src/factory.cc /branches/bleeding_edge/src/factory.h /branches/bleeding_edge/src/parser.cc /branches/bleeding_edge/src/parser.h ======================================= --- /branches/bleeding_edge/src/ast.h Mon Oct 12 08:06:28 2009 +++ /branches/bleeding_edge/src/ast.h Tue Oct 13 02:37:17 2009 @@ -1254,7 +1254,6 @@ Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, - bool contains_array_literal, int expected_property_count, bool has_only_this_property_assignments, bool has_only_simple_this_property_assignments, @@ -1267,7 +1266,6 @@ scope_(scope), body_(body), materialized_literal_count_(materialized_literal_count), - contains_array_literal_(contains_array_literal), expected_property_count_(expected_property_count), has_only_this_property_assignments_(has_only_this_property_assignments), has_only_simple_this_property_assignments_( @@ -1300,7 +1298,6 @@ bool is_expression() const { return is_expression_; } int materialized_literal_count() { return materialized_literal_count_; } - bool contains_array_literal() { return contains_array_literal_; } int expected_property_count() { return expected_property_count_; } bool has_only_this_property_assignments() { return has_only_this_property_assignments_; @@ -1335,7 +1332,6 @@ Scope* scope_; ZoneList<Statement*>* body_; int materialized_literal_count_; - bool contains_array_literal_; int expected_property_count_; bool has_only_this_property_assignments_; bool has_only_simple_this_property_assignments_; ======================================= --- /branches/bleeding_edge/src/codegen.cc Mon Oct 12 08:06:28 2009 +++ /branches/bleeding_edge/src/codegen.cc Tue Oct 13 02:37:17 2009 @@ -322,7 +322,6 @@ Handle<JSFunction> function = Factory::NewFunctionBoilerplate(node->name(), node->materialized_literal_count(), - node->contains_array_literal(), code); CodeGenerator::SetFunctionInfo(function, node, false, script_); ======================================= --- /branches/bleeding_edge/src/compiler.cc Thu Oct 1 03:33:05 2009 +++ /branches/bleeding_edge/src/compiler.cc Tue Oct 13 02:37:17 2009 @@ -197,7 +197,6 @@ Handle<JSFunction> fun = Factory::NewFunctionBoilerplate(lit->name(), lit->materialized_literal_count(), - lit->contains_array_literal(), code); ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); ======================================= --- /branches/bleeding_edge/src/factory.cc Fri Oct 2 06:43:16 2009 +++ /branches/bleeding_edge/src/factory.cc Tue Oct 13 02:37:17 2009 @@ -477,7 +477,6 @@ Handle<JSFunction> Factory::NewFunctionBoilerplate(Handle<String> name, int number_of_literals, - bool contains_array_literal, Handle<Code> code) { Handle<JSFunction> function = NewFunctionBoilerplate(name); function->set_code(*code); @@ -485,7 +484,7 @@ // If the function contains object, regexp or array literals, // allocate extra space for a literals array prefix containing the // object, regexp and array constructor functions. - if (number_of_literals > 0 || contains_array_literal) { + if (number_of_literals > 0) { literals_array_size += JSFunction::kLiteralsPrefixSize; } Handle<FixedArray> literals = ======================================= --- /branches/bleeding_edge/src/factory.h Fri Oct 2 06:43:16 2009 +++ /branches/bleeding_edge/src/factory.h Tue Oct 13 02:37:17 2009 @@ -264,7 +264,6 @@ static Handle<JSFunction> NewFunctionBoilerplate(Handle<String> name, int number_of_literals, - bool contains_array_literal, Handle<Code> code); static Handle<JSFunction> NewFunctionBoilerplate(Handle<String> name); ======================================= --- /branches/bleeding_edge/src/parser.cc Mon Oct 12 06:14:06 2009 +++ /branches/bleeding_edge/src/parser.cc Tue Oct 13 02:37:17 2009 @@ -674,9 +674,6 @@ return next_index; } int materialized_literal_count() { return materialized_literal_count_; } - - void set_contains_array_literal() { contains_array_literal_ = true; } - bool contains_array_literal() { return contains_array_literal_; } void SetThisPropertyAssignmentInfo( bool only_this_property_assignments, @@ -700,17 +697,11 @@ void AddProperty() { expected_property_count_++; } int expected_property_count() { return expected_property_count_; } private: - // Captures the number of nodes that need materialization in the - // function. regexp literals, and boilerplate for object literals. + // Captures the number of literals that need materialization in the + // function. Includes regexp literals, and boilerplate for object + // and array literals. int materialized_literal_count_; - // Captures whether or not the function contains array literals. If - // the function contains array literals, we have to allocate space - // for the array constructor in the literals array of the function. - // This array constructor is used when creating the actual array - // literals. - bool contains_array_literal_; - // Properties count estimation. int expected_property_count_; @@ -728,7 +719,6 @@ TemporaryScope::TemporaryScope(Parser* parser) : materialized_literal_count_(0), - contains_array_literal_(false), expected_property_count_(0), only_this_property_assignments_(false), only_simple_this_property_assignments_(false), @@ -1236,7 +1226,6 @@ top_scope_, body.elements(), temp_scope.materialized_literal_count(), - temp_scope.contains_array_literal(), temp_scope.expected_property_count(), temp_scope.only_this_property_assignments(), temp_scope.only_simple_this_property_assignments(), @@ -1903,7 +1892,7 @@ const int literals = fun->NumberOfLiterals(); Handle<Code> code = Handle<Code>(fun->shared()->code()); Handle<JSFunction> boilerplate = - Factory::NewFunctionBoilerplate(name, literals, false, code); + Factory::NewFunctionBoilerplate(name, literals, code); // Copy the function data to the boilerplate. Used by // builtins.cc:HandleApiCall to perform argument type checks and to @@ -3306,7 +3295,6 @@ Expect(Token::RBRACK, CHECK_OK); // Update the scope information before the pre-parsing bailout. - temp_scope_->set_contains_array_literal(); int literal_index = temp_scope_->NextMaterializedLiteralIndex(); if (is_pre_parsing_) return NULL; @@ -3636,7 +3624,6 @@ int materialized_literal_count; int expected_property_count; - bool contains_array_literal; bool only_this_property_assignments; bool only_simple_this_property_assignments; Handle<FixedArray> this_property_assignments; @@ -3650,12 +3637,10 @@ only_this_property_assignments = false; only_simple_this_property_assignments = false; this_property_assignments = Factory::empty_fixed_array(); - contains_array_literal = entry.contains_array_literal(); } else { ParseSourceElements(&body, Token::RBRACE, CHECK_OK); materialized_literal_count = temp_scope.materialized_literal_count(); expected_property_count = temp_scope.expected_property_count(); - contains_array_literal = temp_scope.contains_array_literal(); only_this_property_assignments = temp_scope.only_this_property_assignments(); only_simple_this_property_assignments = @@ -3671,7 +3656,6 @@ entry.set_end_pos(end_pos); entry.set_literal_count(materialized_literal_count); entry.set_property_count(expected_property_count); - entry.set_contains_array_literal(contains_array_literal); } FunctionLiteral* function_literal = @@ -3679,7 +3663,6 @@ top_scope_, body.elements(), materialized_literal_count, - contains_array_literal, expected_property_count, only_this_property_assignments, only_simple_this_property_assignments, ======================================= --- /branches/bleeding_edge/src/parser.h Tue Aug 18 00:14:02 2009 +++ /branches/bleeding_edge/src/parser.h Tue Oct 13 02:37:17 2009 @@ -69,17 +69,10 @@ int property_count() { return backing_[kPropertyCountOffset]; } void set_property_count(int value) { backing_[kPropertyCountOffset] = value; } - - bool contains_array_literal() { - return backing_[kContainsArrayLiteralOffset] != 0; - } - void set_contains_array_literal(bool value) { - backing_[kContainsArrayLiteralOffset] = value ? 1 : 0; - } bool is_valid() { return backing_.length() > 0; } - static const int kSize = 5; + static const int kSize = 4; private: Vector<unsigned> backing_; @@ -87,7 +80,6 @@ static const int kEndPosOffset = 1; static const int kLiteralCountOffset = 2; static const int kPropertyCountOffset = 3; - static const int kContainsArrayLiteralOffset = 4; }; --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
