OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 parsing_lazy_arrow_parameters_(false), | 863 parsing_lazy_arrow_parameters_(false), |
864 total_preparse_skipped_(0), | 864 total_preparse_skipped_(0), |
865 pre_parse_timer_(NULL), | 865 pre_parse_timer_(NULL), |
866 parsing_on_main_thread_(true) { | 866 parsing_on_main_thread_(true) { |
867 // Even though we were passed ParseInfo, we should not store it in | 867 // Even though we were passed ParseInfo, we should not store it in |
868 // Parser - this makes sure that Isolate is not accidentally accessed via | 868 // Parser - this makes sure that Isolate is not accidentally accessed via |
869 // ParseInfo during background parsing. | 869 // ParseInfo during background parsing. |
870 DCHECK(!info->script().is_null() || info->source_stream() != NULL); | 870 DCHECK(!info->script().is_null() || info->source_stream() != NULL); |
871 set_allow_lazy(info->allow_lazy_parsing()); | 871 set_allow_lazy(info->allow_lazy_parsing()); |
872 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); | 872 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); |
873 set_allow_harmony_scoping(!info->is_native() && FLAG_harmony_scoping); | |
874 set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules); | 873 set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules); |
875 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); | 874 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); |
876 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); | 875 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); |
877 set_allow_harmony_classes(FLAG_harmony_classes); | 876 set_allow_harmony_classes(FLAG_harmony_classes); |
878 set_allow_harmony_object_literals(FLAG_harmony_object_literals); | 877 set_allow_harmony_object_literals(FLAG_harmony_object_literals); |
879 set_allow_harmony_templates(FLAG_harmony_templates); | 878 set_allow_harmony_templates(FLAG_harmony_templates); |
880 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 879 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
881 set_allow_harmony_unicode(FLAG_harmony_unicode); | 880 set_allow_harmony_unicode(FLAG_harmony_unicode); |
882 set_allow_harmony_computed_property_names( | 881 set_allow_harmony_computed_property_names( |
883 FLAG_harmony_computed_property_names); | 882 FLAG_harmony_computed_property_names); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 int beg_pos = scanner()->location().beg_pos; | 1018 int beg_pos = scanner()->location().beg_pos; |
1020 if (info->is_module()) { | 1019 if (info->is_module()) { |
1021 DCHECK(allow_harmony_modules()); | 1020 DCHECK(allow_harmony_modules()); |
1022 ParseModuleItemList(body, &ok); | 1021 ParseModuleItemList(body, &ok); |
1023 } else { | 1022 } else { |
1024 ParseStatementList(body, Token::EOS, info->is_eval(), eval_scope, &ok); | 1023 ParseStatementList(body, Token::EOS, info->is_eval(), eval_scope, &ok); |
1025 } | 1024 } |
1026 | 1025 |
1027 if (ok && is_strict(language_mode())) { | 1026 if (ok && is_strict(language_mode())) { |
1028 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); | 1027 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); |
1029 } | |
1030 | |
1031 if (ok && allow_harmony_scoping() && is_strict(language_mode())) { | |
1032 CheckConflictingVarDeclarations(scope_, &ok); | 1028 CheckConflictingVarDeclarations(scope_, &ok); |
1033 } | 1029 } |
1034 | 1030 |
1035 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { | 1031 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { |
1036 if (body->length() != 1 || | 1032 if (body->length() != 1 || |
1037 !body->at(0)->IsExpressionStatement() || | 1033 !body->at(0)->IsExpressionStatement() || |
1038 !body->at(0)->AsExpressionStatement()-> | 1034 !body->at(0)->AsExpressionStatement()-> |
1039 expression()->IsFunctionLiteral()) { | 1035 expression()->IsFunctionLiteral()) { |
1040 ReportMessage("single_function_literal"); | 1036 ReportMessage("single_function_literal"); |
1041 ok = false; | 1037 ok = false; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 | 1279 |
1284 switch (peek()) { | 1280 switch (peek()) { |
1285 case Token::FUNCTION: | 1281 case Token::FUNCTION: |
1286 return ParseFunctionDeclaration(NULL, ok); | 1282 return ParseFunctionDeclaration(NULL, ok); |
1287 case Token::CLASS: | 1283 case Token::CLASS: |
1288 return ParseClassDeclaration(NULL, ok); | 1284 return ParseClassDeclaration(NULL, ok); |
1289 case Token::CONST: | 1285 case Token::CONST: |
1290 case Token::VAR: | 1286 case Token::VAR: |
1291 return ParseVariableStatement(kStatementListItem, NULL, ok); | 1287 return ParseVariableStatement(kStatementListItem, NULL, ok); |
1292 case Token::LET: | 1288 case Token::LET: |
1293 DCHECK(allow_harmony_scoping()); | |
1294 if (is_strict(language_mode())) { | 1289 if (is_strict(language_mode())) { |
1295 return ParseVariableStatement(kStatementListItem, NULL, ok); | 1290 return ParseVariableStatement(kStatementListItem, NULL, ok); |
1296 } | 1291 } |
1297 // Fall through. | 1292 // Fall through. |
1298 default: | 1293 default: |
1299 return ParseStatement(NULL, ok); | 1294 return ParseStatement(NULL, ok); |
1300 } | 1295 } |
1301 } | 1296 } |
1302 | 1297 |
1303 | 1298 |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 // functions. The function CheckConflictingVarDeclarations checks for | 1899 // functions. The function CheckConflictingVarDeclarations checks for |
1905 // var and let bindings from different scopes whereas this is a check for | 1900 // var and let bindings from different scopes whereas this is a check for |
1906 // conflicting declarations within the same scope. This check also covers | 1901 // conflicting declarations within the same scope. This check also covers |
1907 // the special case | 1902 // the special case |
1908 // | 1903 // |
1909 // function () { let x; { var x; } } | 1904 // function () { let x; { var x; } } |
1910 // | 1905 // |
1911 // because the var declaration is hoisted to the function scope where 'x' | 1906 // because the var declaration is hoisted to the function scope where 'x' |
1912 // is already bound. | 1907 // is already bound. |
1913 DCHECK(IsDeclaredVariableMode(var->mode())); | 1908 DCHECK(IsDeclaredVariableMode(var->mode())); |
1914 if (allow_harmony_scoping() && is_strict(language_mode())) { | 1909 if (is_strict(language_mode())) { |
1915 // In harmony we treat re-declarations as early errors. See | 1910 // In harmony we treat re-declarations as early errors. See |
1916 // ES5 16 for a definition of early errors. | 1911 // ES5 16 for a definition of early errors. |
1917 ParserTraits::ReportMessage("var_redeclaration", name); | 1912 ParserTraits::ReportMessage("var_redeclaration", name); |
1918 *ok = false; | 1913 *ok = false; |
1919 return nullptr; | 1914 return nullptr; |
1920 } | 1915 } |
1921 Expression* expression = NewThrowTypeError( | 1916 Expression* expression = NewThrowTypeError( |
1922 "var_redeclaration", name, declaration->position()); | 1917 "var_redeclaration", name, declaration->position()); |
1923 declaration_scope->SetIllegalRedeclaration(expression); | 1918 declaration_scope->SetIllegalRedeclaration(expression); |
1924 } else if (mode == VAR) { | 1919 } else if (mode == VAR) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 is_generator ? FunctionKind::kGeneratorFunction | 2050 is_generator ? FunctionKind::kGeneratorFunction |
2056 : FunctionKind::kNormalFunction, | 2051 : FunctionKind::kNormalFunction, |
2057 pos, FunctionLiteral::DECLARATION, | 2052 pos, FunctionLiteral::DECLARATION, |
2058 FunctionLiteral::NORMAL_ARITY, CHECK_OK); | 2053 FunctionLiteral::NORMAL_ARITY, CHECK_OK); |
2059 // Even if we're not at the top-level of the global or a function | 2054 // Even if we're not at the top-level of the global or a function |
2060 // scope, we treat it as such and introduce the function with its | 2055 // scope, we treat it as such and introduce the function with its |
2061 // initial value upon entering the corresponding scope. | 2056 // initial value upon entering the corresponding scope. |
2062 // In ES6, a function behaves as a lexical binding, except in | 2057 // In ES6, a function behaves as a lexical binding, except in |
2063 // a script scope, or the initial scope of eval or another function. | 2058 // a script scope, or the initial scope of eval or another function. |
2064 VariableMode mode = | 2059 VariableMode mode = |
2065 is_strong(language_mode()) ? CONST : | 2060 is_strong(language_mode()) |
2066 allow_harmony_scoping() && is_strict(language_mode()) && | 2061 ? CONST |
2067 !(scope_->is_script_scope() || scope_->is_eval_scope() || | 2062 : is_strict(language_mode()) && |
2068 scope_->is_function_scope()) | 2063 !(scope_->is_script_scope() || scope_->is_eval_scope() || |
2069 ? LET | 2064 scope_->is_function_scope()) |
2070 : VAR; | 2065 ? LET |
| 2066 : VAR; |
2071 VariableProxy* proxy = NewUnresolved(name, mode); | 2067 VariableProxy* proxy = NewUnresolved(name, mode); |
2072 Declaration* declaration = | 2068 Declaration* declaration = |
2073 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); | 2069 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); |
2074 Declare(declaration, true, CHECK_OK); | 2070 Declare(declaration, true, CHECK_OK); |
2075 if (names) names->Add(name, zone()); | 2071 if (names) names->Add(name, zone()); |
2076 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); | 2072 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); |
2077 } | 2073 } |
2078 | 2074 |
2079 | 2075 |
2080 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 2076 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 is_strong(language_mode()) ? Token::INIT_CONST : Token::INIT_LET; | 2113 is_strong(language_mode()) ? Token::INIT_CONST : Token::INIT_LET; |
2118 Assignment* assignment = factory()->NewAssignment(init_op, proxy, value, pos); | 2114 Assignment* assignment = factory()->NewAssignment(init_op, proxy, value, pos); |
2119 Statement* assignment_statement = | 2115 Statement* assignment_statement = |
2120 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); | 2116 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); |
2121 if (names) names->Add(name, zone()); | 2117 if (names) names->Add(name, zone()); |
2122 return assignment_statement; | 2118 return assignment_statement; |
2123 } | 2119 } |
2124 | 2120 |
2125 | 2121 |
2126 Block* Parser::ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok) { | 2122 Block* Parser::ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok) { |
2127 if (allow_harmony_scoping() && is_strict(language_mode())) { | 2123 if (is_strict(language_mode())) { |
2128 return ParseScopedBlock(labels, ok); | 2124 return ParseScopedBlock(labels, ok); |
2129 } | 2125 } |
2130 | 2126 |
2131 // Block :: | 2127 // Block :: |
2132 // '{' Statement* '}' | 2128 // '{' Statement* '}' |
2133 | 2129 |
2134 // Note that a Block does not introduce a new execution scope! | 2130 // Note that a Block does not introduce a new execution scope! |
2135 // (ECMA-262, 3rd, 12.2) | 2131 // (ECMA-262, 3rd, 12.2) |
2136 // | 2132 // |
2137 // Construct block expecting 16 statements. | 2133 // Construct block expecting 16 statements. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 return NULL; | 2235 return NULL; |
2240 } | 2236 } |
2241 Consume(Token::VAR); | 2237 Consume(Token::VAR); |
2242 } else if (peek() == Token::CONST) { | 2238 } else if (peek() == Token::CONST) { |
2243 Consume(Token::CONST); | 2239 Consume(Token::CONST); |
2244 if (is_sloppy(language_mode())) { | 2240 if (is_sloppy(language_mode())) { |
2245 mode = CONST_LEGACY; | 2241 mode = CONST_LEGACY; |
2246 init_op = Token::INIT_CONST_LEGACY; | 2242 init_op = Token::INIT_CONST_LEGACY; |
2247 } else { | 2243 } else { |
2248 DCHECK(var_context != kStatement); | 2244 DCHECK(var_context != kStatement); |
2249 // In ES5 const is not allowed in strict mode. | |
2250 if (!allow_harmony_scoping()) { | |
2251 ReportMessage("strict_const"); | |
2252 *ok = false; | |
2253 return NULL; | |
2254 } | |
2255 mode = CONST; | 2245 mode = CONST; |
2256 init_op = Token::INIT_CONST; | 2246 init_op = Token::INIT_CONST; |
2257 } | 2247 } |
2258 is_const = true; | 2248 is_const = true; |
2259 needs_init = true; | 2249 needs_init = true; |
2260 } else if (peek() == Token::LET && is_strict(language_mode())) { | 2250 } else if (peek() == Token::LET && is_strict(language_mode())) { |
2261 DCHECK(allow_harmony_scoping()); | |
2262 Consume(Token::LET); | 2251 Consume(Token::LET); |
2263 DCHECK(var_context != kStatement); | 2252 DCHECK(var_context != kStatement); |
2264 mode = LET; | 2253 mode = LET; |
2265 needs_init = true; | 2254 needs_init = true; |
2266 init_op = Token::INIT_LET; | 2255 init_op = Token::INIT_LET; |
2267 } else { | 2256 } else { |
2268 UNREACHABLE(); // by current callers | 2257 UNREACHABLE(); // by current callers |
2269 } | 2258 } |
2270 | 2259 |
2271 Scope* declaration_scope = DeclarationScope(mode); | 2260 Scope* declaration_scope = DeclarationScope(mode); |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3726 // - (1) is the case iff the innermost scope of the deserialized scope chain | 3715 // - (1) is the case iff the innermost scope of the deserialized scope chain |
3727 // under which we compile is _not_ a declaration scope. This holds because | 3716 // under which we compile is _not_ a declaration scope. This holds because |
3728 // in all normal cases, function declarations are fully hoisted to a | 3717 // in all normal cases, function declarations are fully hoisted to a |
3729 // declaration scope and compiled relative to that. | 3718 // declaration scope and compiled relative to that. |
3730 // - (2) is the case iff the current declaration scope is still the original | 3719 // - (2) is the case iff the current declaration scope is still the original |
3731 // one relative to the deserialized scope chain. Otherwise we must be | 3720 // one relative to the deserialized scope chain. Otherwise we must be |
3732 // compiling a function in an inner declaration scope in the eval, e.g. a | 3721 // compiling a function in an inner declaration scope in the eval, e.g. a |
3733 // nested function, and hoisting works normally relative to that. | 3722 // nested function, and hoisting works normally relative to that. |
3734 Scope* declaration_scope = scope_->DeclarationScope(); | 3723 Scope* declaration_scope = scope_->DeclarationScope(); |
3735 Scope* original_declaration_scope = original_scope_->DeclarationScope(); | 3724 Scope* original_declaration_scope = original_scope_->DeclarationScope(); |
3736 Scope* scope = | 3725 Scope* scope = function_type == FunctionLiteral::DECLARATION && |
3737 function_type == FunctionLiteral::DECLARATION && | 3726 is_sloppy(language_mode()) && |
3738 (!allow_harmony_scoping() || is_sloppy(language_mode())) && | 3727 (original_scope_ == original_declaration_scope || |
3739 (original_scope_ == original_declaration_scope || | 3728 declaration_scope != original_declaration_scope) |
3740 declaration_scope != original_declaration_scope) | 3729 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) |
3741 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) | 3730 : NewScope(scope_, FUNCTION_SCOPE, kind); |
3742 : NewScope(scope_, FUNCTION_SCOPE, kind); | |
3743 ZoneList<Statement*>* body = NULL; | 3731 ZoneList<Statement*>* body = NULL; |
3744 int materialized_literal_count = -1; | 3732 int materialized_literal_count = -1; |
3745 int expected_property_count = -1; | 3733 int expected_property_count = -1; |
3746 int handler_count = 0; | 3734 int handler_count = 0; |
3747 FunctionLiteral::ParameterFlag duplicate_parameters = | 3735 FunctionLiteral::ParameterFlag duplicate_parameters = |
3748 FunctionLiteral::kNoDuplicateParameters; | 3736 FunctionLiteral::kNoDuplicateParameters; |
3749 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ | 3737 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ |
3750 ? FunctionLiteral::kIsParenthesized | 3738 ? FunctionLiteral::kIsParenthesized |
3751 : FunctionLiteral::kNotParenthesized; | 3739 : FunctionLiteral::kNotParenthesized; |
3752 // Parse function body. | 3740 // Parse function body. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3840 | 3828 |
3841 // If we have a named function expression, we add a local variable | 3829 // If we have a named function expression, we add a local variable |
3842 // declaration to the body of the function with the name of the | 3830 // declaration to the body of the function with the name of the |
3843 // function and let it refer to the function itself (closure). | 3831 // function and let it refer to the function itself (closure). |
3844 // NOTE: We create a proxy and resolve it here so that in the | 3832 // NOTE: We create a proxy and resolve it here so that in the |
3845 // future we can change the AST to only refer to VariableProxies | 3833 // future we can change the AST to only refer to VariableProxies |
3846 // instead of Variables and Proxis as is the case now. | 3834 // instead of Variables and Proxis as is the case now. |
3847 Variable* fvar = NULL; | 3835 Variable* fvar = NULL; |
3848 Token::Value fvar_init_op = Token::INIT_CONST_LEGACY; | 3836 Token::Value fvar_init_op = Token::INIT_CONST_LEGACY; |
3849 if (function_type == FunctionLiteral::NAMED_EXPRESSION) { | 3837 if (function_type == FunctionLiteral::NAMED_EXPRESSION) { |
3850 if (allow_harmony_scoping() && is_strict(language_mode())) { | 3838 if (is_strict(language_mode())) { |
3851 fvar_init_op = Token::INIT_CONST; | 3839 fvar_init_op = Token::INIT_CONST; |
3852 } | 3840 } |
3853 VariableMode fvar_mode = | 3841 VariableMode fvar_mode = |
3854 allow_harmony_scoping() && is_strict(language_mode()) ? CONST | 3842 is_strict(language_mode()) ? CONST : CONST_LEGACY; |
3855 : CONST_LEGACY; | |
3856 DCHECK(function_name != NULL); | 3843 DCHECK(function_name != NULL); |
3857 fvar = new (zone()) | 3844 fvar = new (zone()) |
3858 Variable(scope_, function_name, fvar_mode, true /* is valid LHS */, | 3845 Variable(scope_, function_name, fvar_mode, true /* is valid LHS */, |
3859 Variable::NORMAL, kCreatedInitialized, kNotAssigned); | 3846 Variable::NORMAL, kCreatedInitialized, kNotAssigned); |
3860 VariableProxy* proxy = factory()->NewVariableProxy(fvar); | 3847 VariableProxy* proxy = factory()->NewVariableProxy(fvar); |
3861 VariableDeclaration* fvar_declaration = factory()->NewVariableDeclaration( | 3848 VariableDeclaration* fvar_declaration = factory()->NewVariableDeclaration( |
3862 proxy, fvar_mode, scope_, RelocInfo::kNoPosition); | 3849 proxy, fvar_mode, scope_, RelocInfo::kNoPosition); |
3863 scope_->DeclareFunctionVar(fvar_declaration); | 3850 scope_->DeclareFunctionVar(fvar_declaration); |
3864 } | 3851 } |
3865 | 3852 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3919 CHECK_OK); | 3906 CHECK_OK); |
3920 const bool use_strict_params = is_rest || IsConciseMethod(kind); | 3907 const bool use_strict_params = is_rest || IsConciseMethod(kind); |
3921 CheckFunctionParameterNames(language_mode(), use_strict_params, | 3908 CheckFunctionParameterNames(language_mode(), use_strict_params, |
3922 eval_args_error_loc, dupe_error_loc, | 3909 eval_args_error_loc, dupe_error_loc, |
3923 reserved_error_loc, CHECK_OK); | 3910 reserved_error_loc, CHECK_OK); |
3924 | 3911 |
3925 if (is_strict(language_mode())) { | 3912 if (is_strict(language_mode())) { |
3926 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), | 3913 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), |
3927 CHECK_OK); | 3914 CHECK_OK); |
3928 } | 3915 } |
3929 if (allow_harmony_scoping() && is_strict(language_mode())) { | 3916 if (is_strict(language_mode())) { |
3930 CheckConflictingVarDeclarations(scope, CHECK_OK); | 3917 CheckConflictingVarDeclarations(scope, CHECK_OK); |
3931 } | 3918 } |
3932 } | 3919 } |
3933 | 3920 |
3934 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( | 3921 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( |
3935 function_name, ast_value_factory(), scope, body, | 3922 function_name, ast_value_factory(), scope, body, |
3936 materialized_literal_count, expected_property_count, handler_count, | 3923 materialized_literal_count, expected_property_count, handler_count, |
3937 num_parameters, duplicate_parameters, function_type, | 3924 num_parameters, duplicate_parameters, function_type, |
3938 FunctionLiteral::kIsFunction, parenthesized, kind, pos); | 3925 FunctionLiteral::kIsFunction, parenthesized, kind, pos); |
3939 function_literal->set_function_token_position(function_token_pos); | 3926 function_literal->set_function_token_position(function_token_pos); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4119 if (pre_parse_timer_ != NULL) { | 4106 if (pre_parse_timer_ != NULL) { |
4120 pre_parse_timer_->Start(); | 4107 pre_parse_timer_->Start(); |
4121 } | 4108 } |
4122 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 4109 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
4123 | 4110 |
4124 if (reusable_preparser_ == NULL) { | 4111 if (reusable_preparser_ == NULL) { |
4125 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), | 4112 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
4126 NULL, stack_limit_); | 4113 NULL, stack_limit_); |
4127 reusable_preparser_->set_allow_lazy(true); | 4114 reusable_preparser_->set_allow_lazy(true); |
4128 reusable_preparser_->set_allow_natives(allow_natives()); | 4115 reusable_preparser_->set_allow_natives(allow_natives()); |
4129 reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping()); | |
4130 reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules()); | 4116 reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules()); |
4131 reusable_preparser_->set_allow_harmony_arrow_functions( | 4117 reusable_preparser_->set_allow_harmony_arrow_functions( |
4132 allow_harmony_arrow_functions()); | 4118 allow_harmony_arrow_functions()); |
4133 reusable_preparser_->set_allow_harmony_numeric_literals( | 4119 reusable_preparser_->set_allow_harmony_numeric_literals( |
4134 allow_harmony_numeric_literals()); | 4120 allow_harmony_numeric_literals()); |
4135 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); | 4121 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); |
4136 reusable_preparser_->set_allow_harmony_object_literals( | 4122 reusable_preparser_->set_allow_harmony_object_literals( |
4137 allow_harmony_object_literals()); | 4123 allow_harmony_object_literals()); |
4138 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); | 4124 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); |
4139 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 4125 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5522 } else { | 5508 } else { |
5523 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5509 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5524 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5510 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5525 raw_string->length()); | 5511 raw_string->length()); |
5526 } | 5512 } |
5527 } | 5513 } |
5528 | 5514 |
5529 return running_hash; | 5515 return running_hash; |
5530 } | 5516 } |
5531 } } // namespace v8::internal | 5517 } } // namespace v8::internal |
OLD | NEW |