| 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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/ast-expression-visitor.h" | 9 #include "src/ast/ast-expression-visitor.h" |
| 10 #include "src/ast/ast-literal-reindexer.h" | 10 #include "src/ast/ast-literal-reindexer.h" |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 parsing_on_main_thread_(true) { | 919 parsing_on_main_thread_(true) { |
| 920 // Even though we were passed ParseInfo, we should not store it in | 920 // Even though we were passed ParseInfo, we should not store it in |
| 921 // Parser - this makes sure that Isolate is not accidentally accessed via | 921 // Parser - this makes sure that Isolate is not accidentally accessed via |
| 922 // ParseInfo during background parsing. | 922 // ParseInfo during background parsing. |
| 923 DCHECK(!info->script().is_null() || info->source_stream() != NULL); | 923 DCHECK(!info->script().is_null() || info->source_stream() != NULL); |
| 924 set_allow_lazy(info->allow_lazy_parsing()); | 924 set_allow_lazy(info->allow_lazy_parsing()); |
| 925 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); | 925 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); |
| 926 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 926 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
| 927 set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function); | 927 set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function); |
| 928 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); | 928 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); |
| 929 set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters); | |
| 930 set_allow_harmony_default_parameters(FLAG_harmony_default_parameters); | 929 set_allow_harmony_default_parameters(FLAG_harmony_default_parameters); |
| 931 set_allow_harmony_destructuring_bind(FLAG_harmony_destructuring_bind); | 930 set_allow_harmony_destructuring_bind(FLAG_harmony_destructuring_bind); |
| 932 set_allow_harmony_destructuring_assignment( | 931 set_allow_harmony_destructuring_assignment( |
| 933 FLAG_harmony_destructuring_assignment); | 932 FLAG_harmony_destructuring_assignment); |
| 934 set_allow_strong_mode(FLAG_strong_mode); | 933 set_allow_strong_mode(FLAG_strong_mode); |
| 935 set_allow_legacy_const(FLAG_legacy_const); | 934 set_allow_legacy_const(FLAG_legacy_const); |
| 936 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); | 935 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); |
| 937 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 936 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
| 938 ++feature) { | 937 ++feature) { |
| 939 use_counts_[feature] = 0; | 938 use_counts_[feature] = 0; |
| (...skipping 3958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4898 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 4897 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
| 4899 | 4898 |
| 4900 if (reusable_preparser_ == NULL) { | 4899 if (reusable_preparser_ == NULL) { |
| 4901 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), | 4900 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
| 4902 NULL, stack_limit_); | 4901 NULL, stack_limit_); |
| 4903 reusable_preparser_->set_allow_lazy(true); | 4902 reusable_preparser_->set_allow_lazy(true); |
| 4904 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); | 4903 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); |
| 4905 SET_ALLOW(natives); | 4904 SET_ALLOW(natives); |
| 4906 SET_ALLOW(harmony_sloppy); | 4905 SET_ALLOW(harmony_sloppy); |
| 4907 SET_ALLOW(harmony_sloppy_let); | 4906 SET_ALLOW(harmony_sloppy_let); |
| 4908 SET_ALLOW(harmony_rest_parameters); | |
| 4909 SET_ALLOW(harmony_default_parameters); | 4907 SET_ALLOW(harmony_default_parameters); |
| 4910 SET_ALLOW(harmony_destructuring_bind); | 4908 SET_ALLOW(harmony_destructuring_bind); |
| 4911 SET_ALLOW(strong_mode); | 4909 SET_ALLOW(strong_mode); |
| 4912 SET_ALLOW(harmony_do_expressions); | 4910 SET_ALLOW(harmony_do_expressions); |
| 4913 #undef SET_ALLOW | 4911 #undef SET_ALLOW |
| 4914 } | 4912 } |
| 4915 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( | 4913 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( |
| 4916 language_mode(), function_state_->kind(), scope_->has_simple_parameters(), | 4914 language_mode(), function_state_->kind(), scope_->has_simple_parameters(), |
| 4917 logger, bookmark); | 4915 logger, bookmark); |
| 4918 if (pre_parse_timer_ != NULL) { | 4916 if (pre_parse_timer_ != NULL) { |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6573 | 6571 |
| 6574 void ParserTraits::QueueDestructuringAssignmentForRewriting(Expression* expr) { | 6572 void ParserTraits::QueueDestructuringAssignmentForRewriting(Expression* expr) { |
| 6575 DCHECK(expr->IsRewritableAssignmentExpression()); | 6573 DCHECK(expr->IsRewritableAssignmentExpression()); |
| 6576 parser_->function_state_->AddDestructuringAssignment( | 6574 parser_->function_state_->AddDestructuringAssignment( |
| 6577 Parser::DestructuringAssignment(expr, parser_->scope_)); | 6575 Parser::DestructuringAssignment(expr, parser_->scope_)); |
| 6578 } | 6576 } |
| 6579 | 6577 |
| 6580 | 6578 |
| 6581 } // namespace internal | 6579 } // namespace internal |
| 6582 } // namespace v8 | 6580 } // namespace v8 |
| OLD | NEW |