Chromium Code Reviews| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } | 1028 } |
| 1030 | 1029 |
| 1031 if (ok && allow_harmony_scoping() && is_strict(language_mode())) { | 1030 if (ok && is_strict(language_mode())) { |
| 1032 CheckConflictingVarDeclarations(scope_, &ok); | 1031 CheckConflictingVarDeclarations(scope_, &ok); |
| 1033 } | 1032 } |
| 1034 | 1033 |
| 1035 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { | 1034 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { |
| 1036 if (body->length() != 1 || | 1035 if (body->length() != 1 || |
| 1037 !body->at(0)->IsExpressionStatement() || | 1036 !body->at(0)->IsExpressionStatement() || |
| 1038 !body->at(0)->AsExpressionStatement()-> | 1037 !body->at(0)->AsExpressionStatement()-> |
| 1039 expression()->IsFunctionLiteral()) { | 1038 expression()->IsFunctionLiteral()) { |
| 1040 ReportMessage("single_function_literal"); | 1039 ReportMessage("single_function_literal"); |
| 1041 ok = false; | 1040 ok = false; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1283 | 1282 |
| 1284 switch (peek()) { | 1283 switch (peek()) { |
| 1285 case Token::FUNCTION: | 1284 case Token::FUNCTION: |
| 1286 return ParseFunctionDeclaration(NULL, ok); | 1285 return ParseFunctionDeclaration(NULL, ok); |
| 1287 case Token::CLASS: | 1286 case Token::CLASS: |
| 1288 return ParseClassDeclaration(NULL, ok); | 1287 return ParseClassDeclaration(NULL, ok); |
| 1289 case Token::CONST: | 1288 case Token::CONST: |
| 1290 case Token::VAR: | 1289 case Token::VAR: |
| 1291 return ParseVariableStatement(kStatementListItem, NULL, ok); | 1290 return ParseVariableStatement(kStatementListItem, NULL, ok); |
| 1292 case Token::LET: | 1291 case Token::LET: |
| 1293 DCHECK(allow_harmony_scoping()); | |
| 1294 if (is_strict(language_mode())) { | 1292 if (is_strict(language_mode())) { |
| 1295 return ParseVariableStatement(kStatementListItem, NULL, ok); | 1293 return ParseVariableStatement(kStatementListItem, NULL, ok); |
| 1296 } | 1294 } |
| 1297 // Fall through. | 1295 // Fall through. |
| 1298 default: | 1296 default: |
| 1299 return ParseStatement(NULL, ok); | 1297 return ParseStatement(NULL, ok); |
| 1300 } | 1298 } |
| 1301 } | 1299 } |
| 1302 | 1300 |
| 1303 | 1301 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1904 // functions. The function CheckConflictingVarDeclarations checks for | 1902 // functions. The function CheckConflictingVarDeclarations checks for |
| 1905 // var and let bindings from different scopes whereas this is a check for | 1903 // var and let bindings from different scopes whereas this is a check for |
| 1906 // conflicting declarations within the same scope. This check also covers | 1904 // conflicting declarations within the same scope. This check also covers |
| 1907 // the special case | 1905 // the special case |
| 1908 // | 1906 // |
| 1909 // function () { let x; { var x; } } | 1907 // function () { let x; { var x; } } |
| 1910 // | 1908 // |
| 1911 // because the var declaration is hoisted to the function scope where 'x' | 1909 // because the var declaration is hoisted to the function scope where 'x' |
| 1912 // is already bound. | 1910 // is already bound. |
| 1913 DCHECK(IsDeclaredVariableMode(var->mode())); | 1911 DCHECK(IsDeclaredVariableMode(var->mode())); |
| 1914 if (allow_harmony_scoping() && is_strict(language_mode())) { | 1912 if (is_strict(language_mode())) { |
| 1915 // In harmony we treat re-declarations as early errors. See | 1913 // In harmony we treat re-declarations as early errors. See |
| 1916 // ES5 16 for a definition of early errors. | 1914 // ES5 16 for a definition of early errors. |
| 1917 ParserTraits::ReportMessage("var_redeclaration", name); | 1915 ParserTraits::ReportMessage("var_redeclaration", name); |
| 1918 *ok = false; | 1916 *ok = false; |
| 1919 return nullptr; | 1917 return nullptr; |
| 1920 } | 1918 } |
| 1921 Expression* expression = NewThrowTypeError( | 1919 Expression* expression = NewThrowTypeError( |
| 1922 "var_redeclaration", name, declaration->position()); | 1920 "var_redeclaration", name, declaration->position()); |
| 1923 declaration_scope->SetIllegalRedeclaration(expression); | 1921 declaration_scope->SetIllegalRedeclaration(expression); |
| 1924 } else if (mode == VAR) { | 1922 } else if (mode == VAR) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2055 is_generator ? FunctionKind::kGeneratorFunction | 2053 is_generator ? FunctionKind::kGeneratorFunction |
| 2056 : FunctionKind::kNormalFunction, | 2054 : FunctionKind::kNormalFunction, |
| 2057 pos, FunctionLiteral::DECLARATION, | 2055 pos, FunctionLiteral::DECLARATION, |
| 2058 FunctionLiteral::NORMAL_ARITY, CHECK_OK); | 2056 FunctionLiteral::NORMAL_ARITY, CHECK_OK); |
| 2059 // Even if we're not at the top-level of the global or a function | 2057 // 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 | 2058 // scope, we treat it as such and introduce the function with its |
| 2061 // initial value upon entering the corresponding scope. | 2059 // initial value upon entering the corresponding scope. |
| 2062 // In ES6, a function behaves as a lexical binding, except in | 2060 // In ES6, a function behaves as a lexical binding, except in |
| 2063 // a script scope, or the initial scope of eval or another function. | 2061 // a script scope, or the initial scope of eval or another function. |
| 2064 VariableMode mode = | 2062 VariableMode mode = |
| 2065 is_strong(language_mode()) ? CONST : | 2063 is_strong(language_mode()) |
| 2066 allow_harmony_scoping() && is_strict(language_mode()) && | 2064 ? CONST |
| 2067 !(scope_->is_script_scope() || scope_->is_eval_scope() || | 2065 : is_strict(language_mode()) && |
| 2068 scope_->is_function_scope()) | 2066 !(scope_->is_script_scope() || scope_->is_eval_scope() || |
| 2069 ? LET | 2067 scope_->is_function_scope()) |
| 2070 : VAR; | 2068 ? LET |
| 2069 : VAR; | |
| 2071 VariableProxy* proxy = NewUnresolved(name, mode); | 2070 VariableProxy* proxy = NewUnresolved(name, mode); |
| 2072 Declaration* declaration = | 2071 Declaration* declaration = |
| 2073 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); | 2072 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); |
| 2074 Declare(declaration, true, CHECK_OK); | 2073 Declare(declaration, true, CHECK_OK); |
| 2075 if (names) names->Add(name, zone()); | 2074 if (names) names->Add(name, zone()); |
| 2076 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); | 2075 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); |
| 2077 } | 2076 } |
| 2078 | 2077 |
| 2079 | 2078 |
| 2080 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 2079 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; | 2116 is_strong(language_mode()) ? Token::INIT_CONST : Token::INIT_LET; |
| 2118 Assignment* assignment = factory()->NewAssignment(init_op, proxy, value, pos); | 2117 Assignment* assignment = factory()->NewAssignment(init_op, proxy, value, pos); |
| 2119 Statement* assignment_statement = | 2118 Statement* assignment_statement = |
| 2120 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); | 2119 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); |
| 2121 if (names) names->Add(name, zone()); | 2120 if (names) names->Add(name, zone()); |
| 2122 return assignment_statement; | 2121 return assignment_statement; |
| 2123 } | 2122 } |
| 2124 | 2123 |
| 2125 | 2124 |
| 2126 Block* Parser::ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok) { | 2125 Block* Parser::ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok) { |
| 2127 if (allow_harmony_scoping() && is_strict(language_mode())) { | 2126 if (is_strict(language_mode())) { |
| 2128 return ParseScopedBlock(labels, ok); | 2127 return ParseScopedBlock(labels, ok); |
| 2129 } | 2128 } |
| 2130 | 2129 |
| 2131 // Block :: | 2130 // Block :: |
| 2132 // '{' Statement* '}' | 2131 // '{' Statement* '}' |
| 2133 | 2132 |
| 2134 // Note that a Block does not introduce a new execution scope! | 2133 // Note that a Block does not introduce a new execution scope! |
| 2135 // (ECMA-262, 3rd, 12.2) | 2134 // (ECMA-262, 3rd, 12.2) |
| 2136 // | 2135 // |
| 2137 // Construct block expecting 16 statements. | 2136 // Construct block expecting 16 statements. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2239 return NULL; | 2238 return NULL; |
| 2240 } | 2239 } |
| 2241 Consume(Token::VAR); | 2240 Consume(Token::VAR); |
| 2242 } else if (peek() == Token::CONST) { | 2241 } else if (peek() == Token::CONST) { |
| 2243 Consume(Token::CONST); | 2242 Consume(Token::CONST); |
| 2244 if (is_sloppy(language_mode())) { | 2243 if (is_sloppy(language_mode())) { |
| 2245 mode = CONST_LEGACY; | 2244 mode = CONST_LEGACY; |
| 2246 init_op = Token::INIT_CONST_LEGACY; | 2245 init_op = Token::INIT_CONST_LEGACY; |
| 2247 } else { | 2246 } else { |
| 2248 DCHECK(var_context != kStatement); | 2247 DCHECK(var_context != kStatement); |
| 2249 // In ES5 const is not allowed in strict mode. | |
| 2250 if (!allow_harmony_scoping()) { | |
| 2251 ReportMessage("strict_const"); | |
|
arv (Not doing code reviews)
2015/03/13 14:19:42
Can strict_const be removed now? Fine to do in a f
rossberg
2015/03/13 14:24:33
Remove from message.js as well
Dmitry Lomov (no reviews)
2015/03/13 14:51:30
Done.
| |
| 2252 *ok = false; | |
| 2253 return NULL; | |
| 2254 } | |
| 2255 mode = CONST; | 2248 mode = CONST; |
| 2256 init_op = Token::INIT_CONST; | 2249 init_op = Token::INIT_CONST; |
| 2257 } | 2250 } |
| 2258 is_const = true; | 2251 is_const = true; |
| 2259 needs_init = true; | 2252 needs_init = true; |
| 2260 } else if (peek() == Token::LET && is_strict(language_mode())) { | 2253 } else if (peek() == Token::LET && is_strict(language_mode())) { |
| 2261 DCHECK(allow_harmony_scoping()); | |
| 2262 Consume(Token::LET); | 2254 Consume(Token::LET); |
| 2263 DCHECK(var_context != kStatement); | 2255 DCHECK(var_context != kStatement); |
| 2264 mode = LET; | 2256 mode = LET; |
| 2265 needs_init = true; | 2257 needs_init = true; |
| 2266 init_op = Token::INIT_LET; | 2258 init_op = Token::INIT_LET; |
| 2267 } else { | 2259 } else { |
| 2268 UNREACHABLE(); // by current callers | 2260 UNREACHABLE(); // by current callers |
| 2269 } | 2261 } |
| 2270 | 2262 |
| 2271 Scope* declaration_scope = DeclarationScope(mode); | 2263 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 | 3718 // - (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 | 3719 // under which we compile is _not_ a declaration scope. This holds because |
| 3728 // in all normal cases, function declarations are fully hoisted to a | 3720 // in all normal cases, function declarations are fully hoisted to a |
| 3729 // declaration scope and compiled relative to that. | 3721 // declaration scope and compiled relative to that. |
| 3730 // - (2) is the case iff the current declaration scope is still the original | 3722 // - (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 | 3723 // 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 | 3724 // compiling a function in an inner declaration scope in the eval, e.g. a |
| 3733 // nested function, and hoisting works normally relative to that. | 3725 // nested function, and hoisting works normally relative to that. |
| 3734 Scope* declaration_scope = scope_->DeclarationScope(); | 3726 Scope* declaration_scope = scope_->DeclarationScope(); |
| 3735 Scope* original_declaration_scope = original_scope_->DeclarationScope(); | 3727 Scope* original_declaration_scope = original_scope_->DeclarationScope(); |
| 3736 Scope* scope = | 3728 Scope* scope = function_type == FunctionLiteral::DECLARATION && |
| 3737 function_type == FunctionLiteral::DECLARATION && | 3729 is_sloppy(language_mode()) && |
| 3738 (!allow_harmony_scoping() || is_sloppy(language_mode())) && | 3730 (original_scope_ == original_declaration_scope || |
| 3739 (original_scope_ == original_declaration_scope || | 3731 declaration_scope != original_declaration_scope) |
| 3740 declaration_scope != original_declaration_scope) | 3732 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) |
| 3741 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) | 3733 : NewScope(scope_, FUNCTION_SCOPE, kind); |
| 3742 : NewScope(scope_, FUNCTION_SCOPE, kind); | |
| 3743 ZoneList<Statement*>* body = NULL; | 3734 ZoneList<Statement*>* body = NULL; |
| 3744 int materialized_literal_count = -1; | 3735 int materialized_literal_count = -1; |
| 3745 int expected_property_count = -1; | 3736 int expected_property_count = -1; |
| 3746 int handler_count = 0; | 3737 int handler_count = 0; |
| 3747 FunctionLiteral::ParameterFlag duplicate_parameters = | 3738 FunctionLiteral::ParameterFlag duplicate_parameters = |
| 3748 FunctionLiteral::kNoDuplicateParameters; | 3739 FunctionLiteral::kNoDuplicateParameters; |
| 3749 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ | 3740 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ |
| 3750 ? FunctionLiteral::kIsParenthesized | 3741 ? FunctionLiteral::kIsParenthesized |
| 3751 : FunctionLiteral::kNotParenthesized; | 3742 : FunctionLiteral::kNotParenthesized; |
| 3752 // Parse function body. | 3743 // Parse function body. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3840 | 3831 |
| 3841 // If we have a named function expression, we add a local variable | 3832 // 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 | 3833 // declaration to the body of the function with the name of the |
| 3843 // function and let it refer to the function itself (closure). | 3834 // function and let it refer to the function itself (closure). |
| 3844 // NOTE: We create a proxy and resolve it here so that in the | 3835 // 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 | 3836 // future we can change the AST to only refer to VariableProxies |
| 3846 // instead of Variables and Proxis as is the case now. | 3837 // instead of Variables and Proxis as is the case now. |
| 3847 Variable* fvar = NULL; | 3838 Variable* fvar = NULL; |
| 3848 Token::Value fvar_init_op = Token::INIT_CONST_LEGACY; | 3839 Token::Value fvar_init_op = Token::INIT_CONST_LEGACY; |
| 3849 if (function_type == FunctionLiteral::NAMED_EXPRESSION) { | 3840 if (function_type == FunctionLiteral::NAMED_EXPRESSION) { |
| 3850 if (allow_harmony_scoping() && is_strict(language_mode())) { | 3841 if (is_strict(language_mode())) { |
| 3851 fvar_init_op = Token::INIT_CONST; | 3842 fvar_init_op = Token::INIT_CONST; |
| 3852 } | 3843 } |
| 3853 VariableMode fvar_mode = | 3844 VariableMode fvar_mode = |
| 3854 allow_harmony_scoping() && is_strict(language_mode()) ? CONST | 3845 is_strict(language_mode()) ? CONST : CONST_LEGACY; |
| 3855 : CONST_LEGACY; | |
| 3856 DCHECK(function_name != NULL); | 3846 DCHECK(function_name != NULL); |
| 3857 fvar = new (zone()) | 3847 fvar = new (zone()) |
| 3858 Variable(scope_, function_name, fvar_mode, true /* is valid LHS */, | 3848 Variable(scope_, function_name, fvar_mode, true /* is valid LHS */, |
| 3859 Variable::NORMAL, kCreatedInitialized, kNotAssigned); | 3849 Variable::NORMAL, kCreatedInitialized, kNotAssigned); |
| 3860 VariableProxy* proxy = factory()->NewVariableProxy(fvar); | 3850 VariableProxy* proxy = factory()->NewVariableProxy(fvar); |
| 3861 VariableDeclaration* fvar_declaration = factory()->NewVariableDeclaration( | 3851 VariableDeclaration* fvar_declaration = factory()->NewVariableDeclaration( |
| 3862 proxy, fvar_mode, scope_, RelocInfo::kNoPosition); | 3852 proxy, fvar_mode, scope_, RelocInfo::kNoPosition); |
| 3863 scope_->DeclareFunctionVar(fvar_declaration); | 3853 scope_->DeclareFunctionVar(fvar_declaration); |
| 3864 } | 3854 } |
| 3865 | 3855 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3919 CHECK_OK); | 3909 CHECK_OK); |
| 3920 const bool use_strict_params = is_rest || IsConciseMethod(kind); | 3910 const bool use_strict_params = is_rest || IsConciseMethod(kind); |
| 3921 CheckFunctionParameterNames(language_mode(), use_strict_params, | 3911 CheckFunctionParameterNames(language_mode(), use_strict_params, |
| 3922 eval_args_error_loc, dupe_error_loc, | 3912 eval_args_error_loc, dupe_error_loc, |
| 3923 reserved_error_loc, CHECK_OK); | 3913 reserved_error_loc, CHECK_OK); |
| 3924 | 3914 |
| 3925 if (is_strict(language_mode())) { | 3915 if (is_strict(language_mode())) { |
| 3926 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), | 3916 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), |
| 3927 CHECK_OK); | 3917 CHECK_OK); |
| 3928 } | 3918 } |
| 3929 if (allow_harmony_scoping() && is_strict(language_mode())) { | 3919 if (is_strict(language_mode())) { |
| 3930 CheckConflictingVarDeclarations(scope, CHECK_OK); | 3920 CheckConflictingVarDeclarations(scope, CHECK_OK); |
| 3931 } | 3921 } |
| 3932 } | 3922 } |
| 3933 | 3923 |
| 3934 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( | 3924 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( |
| 3935 function_name, ast_value_factory(), scope, body, | 3925 function_name, ast_value_factory(), scope, body, |
| 3936 materialized_literal_count, expected_property_count, handler_count, | 3926 materialized_literal_count, expected_property_count, handler_count, |
| 3937 num_parameters, duplicate_parameters, function_type, | 3927 num_parameters, duplicate_parameters, function_type, |
| 3938 FunctionLiteral::kIsFunction, parenthesized, kind, pos); | 3928 FunctionLiteral::kIsFunction, parenthesized, kind, pos); |
| 3939 function_literal->set_function_token_position(function_token_pos); | 3929 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) { | 4109 if (pre_parse_timer_ != NULL) { |
| 4120 pre_parse_timer_->Start(); | 4110 pre_parse_timer_->Start(); |
| 4121 } | 4111 } |
| 4122 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 4112 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
| 4123 | 4113 |
| 4124 if (reusable_preparser_ == NULL) { | 4114 if (reusable_preparser_ == NULL) { |
| 4125 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), | 4115 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
| 4126 NULL, stack_limit_); | 4116 NULL, stack_limit_); |
| 4127 reusable_preparser_->set_allow_lazy(true); | 4117 reusable_preparser_->set_allow_lazy(true); |
| 4128 reusable_preparser_->set_allow_natives(allow_natives()); | 4118 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()); | 4119 reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules()); |
| 4131 reusable_preparser_->set_allow_harmony_arrow_functions( | 4120 reusable_preparser_->set_allow_harmony_arrow_functions( |
| 4132 allow_harmony_arrow_functions()); | 4121 allow_harmony_arrow_functions()); |
| 4133 reusable_preparser_->set_allow_harmony_numeric_literals( | 4122 reusable_preparser_->set_allow_harmony_numeric_literals( |
| 4134 allow_harmony_numeric_literals()); | 4123 allow_harmony_numeric_literals()); |
| 4135 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); | 4124 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); |
| 4136 reusable_preparser_->set_allow_harmony_object_literals( | 4125 reusable_preparser_->set_allow_harmony_object_literals( |
| 4137 allow_harmony_object_literals()); | 4126 allow_harmony_object_literals()); |
| 4138 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); | 4127 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); |
| 4139 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 4128 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5522 } else { | 5511 } else { |
| 5523 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5512 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
| 5524 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5513 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
| 5525 raw_string->length()); | 5514 raw_string->length()); |
| 5526 } | 5515 } |
| 5527 } | 5516 } |
| 5528 | 5517 |
| 5529 return running_hash; | 5518 return running_hash; |
| 5530 } | 5519 } |
| 5531 } } // namespace v8::internal | 5520 } } // namespace v8::internal |
| OLD | NEW |