| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 LAST(ADD_TERM); | 245 LAST(ADD_TERM); |
| 246 } | 246 } |
| 247 | 247 |
| 248 | 248 |
| 249 // A temporary scope stores information during parsing, just like | 249 // A temporary scope stores information during parsing, just like |
| 250 // a plain scope. However, temporary scopes are not kept around | 250 // a plain scope. However, temporary scopes are not kept around |
| 251 // after parsing or referenced by syntax trees so they can be stack- | 251 // after parsing or referenced by syntax trees so they can be stack- |
| 252 // allocated and hence used by the pre-parser. | 252 // allocated and hence used by the pre-parser. |
| 253 class TemporaryScope BASE_EMBEDDED { | 253 class TemporaryScope BASE_EMBEDDED { |
| 254 public: | 254 public: |
| 255 explicit TemporaryScope(TemporaryScope** variable); | 255 TemporaryScope(TemporaryScope** variable, Isolate* isolate); |
| 256 ~TemporaryScope(); | 256 ~TemporaryScope(); |
| 257 | 257 |
| 258 int NextMaterializedLiteralIndex() { | 258 int NextMaterializedLiteralIndex() { |
| 259 int next_index = | 259 int next_index = |
| 260 materialized_literal_count_ + JSFunction::kLiteralsPrefixSize; | 260 materialized_literal_count_ + JSFunction::kLiteralsPrefixSize; |
| 261 materialized_literal_count_++; | 261 materialized_literal_count_++; |
| 262 return next_index; | 262 return next_index; |
| 263 } | 263 } |
| 264 int materialized_literal_count() { return materialized_literal_count_; } | 264 int materialized_literal_count() { return materialized_literal_count_; } |
| 265 | 265 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 // Captures the number of loops inside the scope. | 300 // Captures the number of loops inside the scope. |
| 301 int loop_count_; | 301 int loop_count_; |
| 302 | 302 |
| 303 // Bookkeeping | 303 // Bookkeeping |
| 304 TemporaryScope** variable_; | 304 TemporaryScope** variable_; |
| 305 TemporaryScope* parent_; | 305 TemporaryScope* parent_; |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 | 308 |
| 309 TemporaryScope::TemporaryScope(TemporaryScope** variable) | 309 TemporaryScope::TemporaryScope(TemporaryScope** variable, Isolate* isolate) |
| 310 : materialized_literal_count_(0), | 310 : materialized_literal_count_(0), |
| 311 expected_property_count_(0), | 311 expected_property_count_(0), |
| 312 only_simple_this_property_assignments_(false), | 312 only_simple_this_property_assignments_(false), |
| 313 this_property_assignments_( | 313 this_property_assignments_(isolate->factory()->empty_fixed_array()), |
| 314 Isolate::Current()->factory()->empty_fixed_array()), | |
| 315 loop_count_(0), | 314 loop_count_(0), |
| 316 variable_(variable), | 315 variable_(variable), |
| 317 parent_(*variable) { | 316 parent_(*variable) { |
| 318 *variable = this; | 317 *variable = this; |
| 319 } | 318 } |
| 320 | 319 |
| 321 | 320 |
| 322 TemporaryScope::~TemporaryScope() { | 321 TemporaryScope::~TemporaryScope() { |
| 323 *variable_ = parent_; | 322 *variable_ = parent_; |
| 324 } | 323 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 Scope::Type type = | 651 Scope::Type type = |
| 653 in_global_context | 652 in_global_context |
| 654 ? Scope::GLOBAL_SCOPE | 653 ? Scope::GLOBAL_SCOPE |
| 655 : Scope::EVAL_SCOPE; | 654 : Scope::EVAL_SCOPE; |
| 656 Handle<String> no_name = isolate()->factory()->empty_symbol(); | 655 Handle<String> no_name = isolate()->factory()->empty_symbol(); |
| 657 | 656 |
| 658 FunctionLiteral* result = NULL; | 657 FunctionLiteral* result = NULL; |
| 659 { Scope* scope = NewScope(top_scope_, type, inside_with()); | 658 { Scope* scope = NewScope(top_scope_, type, inside_with()); |
| 660 LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, | 659 LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, |
| 661 scope); | 660 scope); |
| 662 TemporaryScope temp_scope(&this->temp_scope_); | 661 TemporaryScope temp_scope(&this->temp_scope_, isolate()); |
| 663 if (strict_mode == kStrictMode) { | 662 if (strict_mode == kStrictMode) { |
| 664 top_scope_->EnableStrictMode(); | 663 top_scope_->EnableStrictMode(); |
| 665 } | 664 } |
| 666 ZoneList<Statement*>* body = new ZoneList<Statement*>(16); | 665 ZoneList<Statement*>* body = new ZoneList<Statement*>(16); |
| 667 bool ok = true; | 666 bool ok = true; |
| 668 int beg_loc = scanner().location().beg_pos; | 667 int beg_loc = scanner().location().beg_pos; |
| 669 ParseSourceElements(body, Token::EOS, &ok); | 668 ParseSourceElements(body, Token::EOS, &ok); |
| 670 if (ok && top_scope_->is_strict_mode()) { | 669 if (ok && top_scope_->is_strict_mode()) { |
| 671 CheckOctalLiteral(beg_loc, scanner().location().end_pos, &ok); | 670 CheckOctalLiteral(beg_loc, scanner().location().end_pos, &ok); |
| 672 } | 671 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 741 |
| 743 { | 742 { |
| 744 // Parse the function literal. | 743 // Parse the function literal. |
| 745 Handle<String> no_name = isolate()->factory()->empty_symbol(); | 744 Handle<String> no_name = isolate()->factory()->empty_symbol(); |
| 746 Scope* scope = NewScope(top_scope_, Scope::GLOBAL_SCOPE, inside_with()); | 745 Scope* scope = NewScope(top_scope_, Scope::GLOBAL_SCOPE, inside_with()); |
| 747 if (!info->closure().is_null()) { | 746 if (!info->closure().is_null()) { |
| 748 scope = Scope::DeserializeScopeChain(info, scope); | 747 scope = Scope::DeserializeScopeChain(info, scope); |
| 749 } | 748 } |
| 750 LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, | 749 LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, |
| 751 scope); | 750 scope); |
| 752 TemporaryScope temp_scope(&this->temp_scope_); | 751 TemporaryScope temp_scope(&this->temp_scope_, isolate()); |
| 753 | 752 |
| 754 if (shared_info->strict_mode()) { | 753 if (shared_info->strict_mode()) { |
| 755 top_scope_->EnableStrictMode(); | 754 top_scope_->EnableStrictMode(); |
| 756 } | 755 } |
| 757 | 756 |
| 758 FunctionLiteralType type = | 757 FunctionLiteralType type = |
| 759 shared_info->is_expression() ? EXPRESSION : DECLARATION; | 758 shared_info->is_expression() ? EXPRESSION : DECLARATION; |
| 760 bool ok = true; | 759 bool ok = true; |
| 761 result = ParseFunctionLiteral(name, | 760 result = ParseFunctionLiteral(name, |
| 762 false, // Strict mode name already checked. | 761 false, // Strict mode name already checked. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 | 944 |
| 946 DISALLOW_COPY_AND_ASSIGN(InitializationBlockFinder); | 945 DISALLOW_COPY_AND_ASSIGN(InitializationBlockFinder); |
| 947 }; | 946 }; |
| 948 | 947 |
| 949 | 948 |
| 950 // A ThisNamedPropertyAssigmentFinder finds and marks statements of the form | 949 // A ThisNamedPropertyAssigmentFinder finds and marks statements of the form |
| 951 // this.x = ...;, where x is a named property. It also determines whether a | 950 // this.x = ...;, where x is a named property. It also determines whether a |
| 952 // function contains only assignments of this type. | 951 // function contains only assignments of this type. |
| 953 class ThisNamedPropertyAssigmentFinder : public ParserFinder { | 952 class ThisNamedPropertyAssigmentFinder : public ParserFinder { |
| 954 public: | 953 public: |
| 955 ThisNamedPropertyAssigmentFinder() | 954 explicit ThisNamedPropertyAssigmentFinder(Isolate* isolate) |
| 956 : only_simple_this_property_assignments_(true), | 955 : isolate_(isolate), |
| 956 only_simple_this_property_assignments_(true), |
| 957 names_(NULL), | 957 names_(NULL), |
| 958 assigned_arguments_(NULL), | 958 assigned_arguments_(NULL), |
| 959 assigned_constants_(NULL) {} | 959 assigned_constants_(NULL) {} |
| 960 | 960 |
| 961 void Update(Scope* scope, Statement* stat) { | 961 void Update(Scope* scope, Statement* stat) { |
| 962 // Bail out if function already has property assignment that are | 962 // Bail out if function already has property assignment that are |
| 963 // not simple this property assignments. | 963 // not simple this property assignments. |
| 964 if (!only_simple_this_property_assignments_) { | 964 if (!only_simple_this_property_assignments_) { |
| 965 return; | 965 return; |
| 966 } | 966 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 977 // Returns whether only statements of the form this.x = y; where y is either a | 977 // Returns whether only statements of the form this.x = y; where y is either a |
| 978 // constant or a function argument was encountered. | 978 // constant or a function argument was encountered. |
| 979 bool only_simple_this_property_assignments() { | 979 bool only_simple_this_property_assignments() { |
| 980 return only_simple_this_property_assignments_; | 980 return only_simple_this_property_assignments_; |
| 981 } | 981 } |
| 982 | 982 |
| 983 // Returns a fixed array containing three elements for each assignment of the | 983 // Returns a fixed array containing three elements for each assignment of the |
| 984 // form this.x = y; | 984 // form this.x = y; |
| 985 Handle<FixedArray> GetThisPropertyAssignments() { | 985 Handle<FixedArray> GetThisPropertyAssignments() { |
| 986 if (names_ == NULL) { | 986 if (names_ == NULL) { |
| 987 return FACTORY->empty_fixed_array(); | 987 return isolate_->factory()->empty_fixed_array(); |
| 988 } | 988 } |
| 989 ASSERT(names_ != NULL); | 989 ASSERT(names_ != NULL); |
| 990 ASSERT(assigned_arguments_ != NULL); | 990 ASSERT(assigned_arguments_ != NULL); |
| 991 ASSERT_EQ(names_->length(), assigned_arguments_->length()); | 991 ASSERT_EQ(names_->length(), assigned_arguments_->length()); |
| 992 ASSERT_EQ(names_->length(), assigned_constants_->length()); | 992 ASSERT_EQ(names_->length(), assigned_constants_->length()); |
| 993 Handle<FixedArray> assignments = | 993 Handle<FixedArray> assignments = |
| 994 FACTORY->NewFixedArray(names_->length() * 3); | 994 isolate_->factory()->NewFixedArray(names_->length() * 3); |
| 995 for (int i = 0; i < names_->length(); i++) { | 995 for (int i = 0; i < names_->length(); i++) { |
| 996 assignments->set(i * 3, *names_->at(i)); | 996 assignments->set(i * 3, *names_->at(i)); |
| 997 assignments->set(i * 3 + 1, Smi::FromInt(assigned_arguments_->at(i))); | 997 assignments->set(i * 3 + 1, Smi::FromInt(assigned_arguments_->at(i))); |
| 998 assignments->set(i * 3 + 2, *assigned_constants_->at(i)); | 998 assignments->set(i * 3 + 2, *assigned_constants_->at(i)); |
| 999 } | 999 } |
| 1000 return assignments; | 1000 return assignments; |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 private: | 1003 private: |
| 1004 bool IsThisPropertyAssignment(Assignment* assignment) { | 1004 bool IsThisPropertyAssignment(Assignment* assignment) { |
| 1005 if (assignment != NULL) { | 1005 if (assignment != NULL) { |
| 1006 Property* property = assignment->target()->AsProperty(); | 1006 Property* property = assignment->target()->AsProperty(); |
| 1007 return assignment->op() == Token::ASSIGN | 1007 return assignment->op() == Token::ASSIGN |
| 1008 && property != NULL | 1008 && property != NULL |
| 1009 && property->obj()->AsVariableProxy() != NULL | 1009 && property->obj()->AsVariableProxy() != NULL |
| 1010 && property->obj()->AsVariableProxy()->is_this(); | 1010 && property->obj()->AsVariableProxy()->is_this(); |
| 1011 } | 1011 } |
| 1012 return false; | 1012 return false; |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 void HandleThisPropertyAssignment(Scope* scope, Assignment* assignment) { | 1015 void HandleThisPropertyAssignment(Scope* scope, Assignment* assignment) { |
| 1016 // Check that the property assigned to is a named property, which is not | 1016 // Check that the property assigned to is a named property, which is not |
| 1017 // __proto__. | 1017 // __proto__. |
| 1018 Property* property = assignment->target()->AsProperty(); | 1018 Property* property = assignment->target()->AsProperty(); |
| 1019 ASSERT(property != NULL); | 1019 ASSERT(property != NULL); |
| 1020 Literal* literal = property->key()->AsLiteral(); | 1020 Literal* literal = property->key()->AsLiteral(); |
| 1021 uint32_t dummy; | 1021 uint32_t dummy; |
| 1022 if (literal != NULL && | 1022 if (literal != NULL && |
| 1023 literal->handle()->IsString() && | 1023 literal->handle()->IsString() && |
| 1024 !String::cast(*(literal->handle()))->Equals(HEAP->Proto_symbol()) && | 1024 !String::cast(*(literal->handle()))->Equals( |
| 1025 isolate_->heap()->Proto_symbol()) && |
| 1025 !String::cast(*(literal->handle()))->AsArrayIndex(&dummy)) { | 1026 !String::cast(*(literal->handle()))->AsArrayIndex(&dummy)) { |
| 1026 Handle<String> key = Handle<String>::cast(literal->handle()); | 1027 Handle<String> key = Handle<String>::cast(literal->handle()); |
| 1027 | 1028 |
| 1028 // Check whether the value assigned is either a constant or matches the | 1029 // Check whether the value assigned is either a constant or matches the |
| 1029 // name of one of the arguments to the function. | 1030 // name of one of the arguments to the function. |
| 1030 if (assignment->value()->AsLiteral() != NULL) { | 1031 if (assignment->value()->AsLiteral() != NULL) { |
| 1031 // Constant assigned. | 1032 // Constant assigned. |
| 1032 Literal* literal = assignment->value()->AsLiteral(); | 1033 Literal* literal = assignment->value()->AsLiteral(); |
| 1033 AssignmentFromConstant(key, literal->handle()); | 1034 AssignmentFromConstant(key, literal->handle()); |
| 1034 return; | 1035 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1048 } | 1049 } |
| 1049 // It is not a simple "this.x = value;" assignment with a constant | 1050 // It is not a simple "this.x = value;" assignment with a constant |
| 1050 // or parameter value. | 1051 // or parameter value. |
| 1051 AssignmentFromSomethingElse(); | 1052 AssignmentFromSomethingElse(); |
| 1052 } | 1053 } |
| 1053 | 1054 |
| 1054 void AssignmentFromParameter(Handle<String> name, int index) { | 1055 void AssignmentFromParameter(Handle<String> name, int index) { |
| 1055 EnsureAllocation(); | 1056 EnsureAllocation(); |
| 1056 names_->Add(name); | 1057 names_->Add(name); |
| 1057 assigned_arguments_->Add(index); | 1058 assigned_arguments_->Add(index); |
| 1058 assigned_constants_->Add(FACTORY->undefined_value()); | 1059 assigned_constants_->Add(isolate_->factory()->undefined_value()); |
| 1059 } | 1060 } |
| 1060 | 1061 |
| 1061 void AssignmentFromConstant(Handle<String> name, Handle<Object> value) { | 1062 void AssignmentFromConstant(Handle<String> name, Handle<Object> value) { |
| 1062 EnsureAllocation(); | 1063 EnsureAllocation(); |
| 1063 names_->Add(name); | 1064 names_->Add(name); |
| 1064 assigned_arguments_->Add(-1); | 1065 assigned_arguments_->Add(-1); |
| 1065 assigned_constants_->Add(value); | 1066 assigned_constants_->Add(value); |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 void AssignmentFromSomethingElse() { | 1069 void AssignmentFromSomethingElse() { |
| 1069 // The this assignment is not a simple one. | 1070 // The this assignment is not a simple one. |
| 1070 only_simple_this_property_assignments_ = false; | 1071 only_simple_this_property_assignments_ = false; |
| 1071 } | 1072 } |
| 1072 | 1073 |
| 1073 void EnsureAllocation() { | 1074 void EnsureAllocation() { |
| 1074 if (names_ == NULL) { | 1075 if (names_ == NULL) { |
| 1075 ASSERT(assigned_arguments_ == NULL); | 1076 ASSERT(assigned_arguments_ == NULL); |
| 1076 ASSERT(assigned_constants_ == NULL); | 1077 ASSERT(assigned_constants_ == NULL); |
| 1077 names_ = new ZoneStringList(4); | 1078 names_ = new ZoneStringList(4); |
| 1078 assigned_arguments_ = new ZoneList<int>(4); | 1079 assigned_arguments_ = new ZoneList<int>(4); |
| 1079 assigned_constants_ = new ZoneObjectList(4); | 1080 assigned_constants_ = new ZoneObjectList(4); |
| 1080 } | 1081 } |
| 1081 } | 1082 } |
| 1082 | 1083 |
| 1084 Isolate* isolate_; |
| 1083 bool only_simple_this_property_assignments_; | 1085 bool only_simple_this_property_assignments_; |
| 1084 ZoneStringList* names_; | 1086 ZoneStringList* names_; |
| 1085 ZoneList<int>* assigned_arguments_; | 1087 ZoneList<int>* assigned_arguments_; |
| 1086 ZoneObjectList* assigned_constants_; | 1088 ZoneObjectList* assigned_constants_; |
| 1087 }; | 1089 }; |
| 1088 | 1090 |
| 1089 | 1091 |
| 1090 void* Parser::ParseSourceElements(ZoneList<Statement*>* processor, | 1092 void* Parser::ParseSourceElements(ZoneList<Statement*>* processor, |
| 1091 int end_token, | 1093 int end_token, |
| 1092 bool* ok) { | 1094 bool* ok) { |
| 1093 // SourceElements :: | 1095 // SourceElements :: |
| 1094 // (Statement)* <end_token> | 1096 // (Statement)* <end_token> |
| 1095 | 1097 |
| 1096 // Allocate a target stack to use for this set of source | 1098 // Allocate a target stack to use for this set of source |
| 1097 // elements. This way, all scripts and functions get their own | 1099 // elements. This way, all scripts and functions get their own |
| 1098 // target stack thus avoiding illegal breaks and continues across | 1100 // target stack thus avoiding illegal breaks and continues across |
| 1099 // functions. | 1101 // functions. |
| 1100 TargetScope scope(&this->target_stack_); | 1102 TargetScope scope(&this->target_stack_); |
| 1101 | 1103 |
| 1102 ASSERT(processor != NULL); | 1104 ASSERT(processor != NULL); |
| 1103 InitializationBlockFinder block_finder; | 1105 InitializationBlockFinder block_finder; |
| 1104 ThisNamedPropertyAssigmentFinder this_property_assignment_finder; | 1106 ThisNamedPropertyAssigmentFinder this_property_assignment_finder(isolate()); |
| 1105 bool directive_prologue = true; // Parsing directive prologue. | 1107 bool directive_prologue = true; // Parsing directive prologue. |
| 1106 | 1108 |
| 1107 while (peek() != end_token) { | 1109 while (peek() != end_token) { |
| 1108 if (directive_prologue && peek() != Token::STRING) { | 1110 if (directive_prologue && peek() != Token::STRING) { |
| 1109 directive_prologue = false; | 1111 directive_prologue = false; |
| 1110 } | 1112 } |
| 1111 | 1113 |
| 1112 Scanner::Location token_loc = scanner().peek_location(); | 1114 Scanner::Location token_loc = scanner().peek_location(); |
| 1113 | 1115 |
| 1114 Statement* stat; | 1116 Statement* stat; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 Block* Parser::ParseVariableStatement(bool* ok) { | 1514 Block* Parser::ParseVariableStatement(bool* ok) { |
| 1513 // VariableStatement :: | 1515 // VariableStatement :: |
| 1514 // VariableDeclarations ';' | 1516 // VariableDeclarations ';' |
| 1515 | 1517 |
| 1516 Expression* dummy; // to satisfy the ParseVariableDeclarations() signature | 1518 Expression* dummy; // to satisfy the ParseVariableDeclarations() signature |
| 1517 Block* result = ParseVariableDeclarations(true, &dummy, CHECK_OK); | 1519 Block* result = ParseVariableDeclarations(true, &dummy, CHECK_OK); |
| 1518 ExpectSemicolon(CHECK_OK); | 1520 ExpectSemicolon(CHECK_OK); |
| 1519 return result; | 1521 return result; |
| 1520 } | 1522 } |
| 1521 | 1523 |
| 1522 static bool IsEvalOrArguments(Handle<String> string) { | 1524 |
| 1523 return string.is_identical_to(FACTORY->eval_symbol()) || | 1525 bool Parser::IsEvalOrArguments(Handle<String> string) { |
| 1524 string.is_identical_to(FACTORY->arguments_symbol()); | 1526 return string.is_identical_to(isolate()->factory()->eval_symbol()) || |
| 1527 string.is_identical_to(isolate()->factory()->arguments_symbol()); |
| 1525 } | 1528 } |
| 1526 | 1529 |
| 1530 |
| 1527 // If the variable declaration declares exactly one non-const | 1531 // If the variable declaration declares exactly one non-const |
| 1528 // variable, then *var is set to that variable. In all other cases, | 1532 // variable, then *var is set to that variable. In all other cases, |
| 1529 // *var is untouched; in particular, it is the caller's responsibility | 1533 // *var is untouched; in particular, it is the caller's responsibility |
| 1530 // to initialize it properly. This mechanism is used for the parsing | 1534 // to initialize it properly. This mechanism is used for the parsing |
| 1531 // of 'for-in' loops. | 1535 // of 'for-in' loops. |
| 1532 Block* Parser::ParseVariableDeclarations(bool accept_IN, | 1536 Block* Parser::ParseVariableDeclarations(bool accept_IN, |
| 1533 Expression** var, | 1537 Expression** var, |
| 1534 bool* ok) { | 1538 bool* ok) { |
| 1535 // VariableDeclarations :: | 1539 // VariableDeclarations :: |
| 1536 // ('var' | 'const') (Identifier ('=' AssignmentExpression)?)+[','] | 1540 // ('var' | 'const') (Identifier ('=' AssignmentExpression)?)+[','] |
| (...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3533 if (is_named && (type == EXPRESSION || type == NESTED)) { | 3537 if (is_named && (type == EXPRESSION || type == NESTED)) { |
| 3534 function_name = name; | 3538 function_name = name; |
| 3535 } | 3539 } |
| 3536 | 3540 |
| 3537 int num_parameters = 0; | 3541 int num_parameters = 0; |
| 3538 // Parse function body. | 3542 // Parse function body. |
| 3539 { Scope* scope = | 3543 { Scope* scope = |
| 3540 NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); | 3544 NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); |
| 3541 LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, | 3545 LexicalScope lexical_scope(&this->top_scope_, &this->with_nesting_level_, |
| 3542 scope); | 3546 scope); |
| 3543 TemporaryScope temp_scope(&this->temp_scope_); | 3547 TemporaryScope temp_scope(&this->temp_scope_, isolate()); |
| 3544 top_scope_->SetScopeName(name); | 3548 top_scope_->SetScopeName(name); |
| 3545 | 3549 |
| 3546 // FormalParameterList :: | 3550 // FormalParameterList :: |
| 3547 // '(' (Identifier)*[','] ')' | 3551 // '(' (Identifier)*[','] ')' |
| 3548 Expect(Token::LPAREN, CHECK_OK); | 3552 Expect(Token::LPAREN, CHECK_OK); |
| 3549 int start_pos = scanner().location().beg_pos; | 3553 int start_pos = scanner().location().beg_pos; |
| 3550 Scanner::Location name_loc = Scanner::NoLocation(); | 3554 Scanner::Location name_loc = Scanner::NoLocation(); |
| 3551 Scanner::Location dupe_loc = Scanner::NoLocation(); | 3555 Scanner::Location dupe_loc = Scanner::NoLocation(); |
| 3552 Scanner::Location reserved_loc = Scanner::NoLocation(); | 3556 Scanner::Location reserved_loc = Scanner::NoLocation(); |
| 3553 | 3557 |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5164 info->is_global(), | 5168 info->is_global(), |
| 5165 info->StrictMode()); | 5169 info->StrictMode()); |
| 5166 } | 5170 } |
| 5167 } | 5171 } |
| 5168 | 5172 |
| 5169 info->SetFunction(result); | 5173 info->SetFunction(result); |
| 5170 return (result != NULL); | 5174 return (result != NULL); |
| 5171 } | 5175 } |
| 5172 | 5176 |
| 5173 } } // namespace v8::internal | 5177 } } // namespace v8::internal |
| OLD | NEW |