| 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/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 cached_parse_data_(NULL), | 903 cached_parse_data_(NULL), |
| 904 total_preparse_skipped_(0), | 904 total_preparse_skipped_(0), |
| 905 pre_parse_timer_(NULL), | 905 pre_parse_timer_(NULL), |
| 906 parsing_on_main_thread_(true) { | 906 parsing_on_main_thread_(true) { |
| 907 // Even though we were passed ParseInfo, we should not store it in | 907 // Even though we were passed ParseInfo, we should not store it in |
| 908 // Parser - this makes sure that Isolate is not accidentally accessed via | 908 // Parser - this makes sure that Isolate is not accidentally accessed via |
| 909 // ParseInfo during background parsing. | 909 // ParseInfo during background parsing. |
| 910 DCHECK(!info->script().is_null() || info->source_stream() != NULL); | 910 DCHECK(!info->script().is_null() || info->source_stream() != NULL); |
| 911 set_allow_lazy(info->allow_lazy_parsing()); | 911 set_allow_lazy(info->allow_lazy_parsing()); |
| 912 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); | 912 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); |
| 913 set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules); | |
| 914 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); | 913 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); |
| 915 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 914 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
| 916 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); | 915 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); |
| 917 set_allow_harmony_unicode(FLAG_harmony_unicode); | 916 set_allow_harmony_unicode(FLAG_harmony_unicode); |
| 918 set_allow_harmony_computed_property_names( | 917 set_allow_harmony_computed_property_names( |
| 919 FLAG_harmony_computed_property_names); | 918 FLAG_harmony_computed_property_names); |
| 920 set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters); | 919 set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters); |
| 921 set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); | 920 set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); |
| 922 set_allow_harmony_destructuring(FLAG_harmony_destructuring); | 921 set_allow_harmony_destructuring(FLAG_harmony_destructuring); |
| 923 set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); | 922 set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 ParsingModeScope parsing_mode_scope(this, parsing_mode); | 1046 ParsingModeScope parsing_mode_scope(this, parsing_mode); |
| 1048 AstNodeFactory function_factory(ast_value_factory()); | 1047 AstNodeFactory function_factory(ast_value_factory()); |
| 1049 FunctionState function_state(&function_state_, &scope_, scope, | 1048 FunctionState function_state(&function_state_, &scope_, scope, |
| 1050 kNormalFunction, &function_factory); | 1049 kNormalFunction, &function_factory); |
| 1051 | 1050 |
| 1052 scope_->SetLanguageMode(info->language_mode()); | 1051 scope_->SetLanguageMode(info->language_mode()); |
| 1053 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); | 1052 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); |
| 1054 bool ok = true; | 1053 bool ok = true; |
| 1055 int beg_pos = scanner()->location().beg_pos; | 1054 int beg_pos = scanner()->location().beg_pos; |
| 1056 if (info->is_module()) { | 1055 if (info->is_module()) { |
| 1057 DCHECK(allow_harmony_modules()); | |
| 1058 ParseModuleItemList(body, &ok); | 1056 ParseModuleItemList(body, &ok); |
| 1059 } else { | 1057 } else { |
| 1060 ParseStatementList(body, Token::EOS, &ok); | 1058 ParseStatementList(body, Token::EOS, &ok); |
| 1061 } | 1059 } |
| 1062 | 1060 |
| 1063 // The parser will peek but not consume EOS. Our scope logically goes all | 1061 // The parser will peek but not consume EOS. Our scope logically goes all |
| 1064 // the way to the EOS, though. | 1062 // the way to the EOS, though. |
| 1065 scope->set_end_position(scanner()->peek_location().beg_pos); | 1063 scope->set_end_position(scanner()->peek_location().beg_pos); |
| 1066 | 1064 |
| 1067 if (ok && is_strict(language_mode())) { | 1065 if (ok && is_strict(language_mode())) { |
| (...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 pre_parse_timer_->Start(); | 4466 pre_parse_timer_->Start(); |
| 4469 } | 4467 } |
| 4470 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 4468 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
| 4471 | 4469 |
| 4472 if (reusable_preparser_ == NULL) { | 4470 if (reusable_preparser_ == NULL) { |
| 4473 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), | 4471 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
| 4474 NULL, stack_limit_); | 4472 NULL, stack_limit_); |
| 4475 reusable_preparser_->set_allow_lazy(true); | 4473 reusable_preparser_->set_allow_lazy(true); |
| 4476 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); | 4474 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); |
| 4477 SET_ALLOW(natives); | 4475 SET_ALLOW(natives); |
| 4478 SET_ALLOW(harmony_modules); | |
| 4479 SET_ALLOW(harmony_arrow_functions); | 4476 SET_ALLOW(harmony_arrow_functions); |
| 4480 SET_ALLOW(harmony_sloppy); | 4477 SET_ALLOW(harmony_sloppy); |
| 4481 SET_ALLOW(harmony_sloppy_let); | 4478 SET_ALLOW(harmony_sloppy_let); |
| 4482 SET_ALLOW(harmony_unicode); | 4479 SET_ALLOW(harmony_unicode); |
| 4483 SET_ALLOW(harmony_computed_property_names); | 4480 SET_ALLOW(harmony_computed_property_names); |
| 4484 SET_ALLOW(harmony_rest_parameters); | 4481 SET_ALLOW(harmony_rest_parameters); |
| 4485 SET_ALLOW(harmony_spreadcalls); | 4482 SET_ALLOW(harmony_spreadcalls); |
| 4486 SET_ALLOW(harmony_destructuring); | 4483 SET_ALLOW(harmony_destructuring); |
| 4487 SET_ALLOW(harmony_spread_arrays); | 4484 SET_ALLOW(harmony_spread_arrays); |
| 4488 SET_ALLOW(harmony_new_target); | 4485 SET_ALLOW(harmony_new_target); |
| (...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6000 Expression* Parser::SpreadCallNew(Expression* function, | 5997 Expression* Parser::SpreadCallNew(Expression* function, |
| 6001 ZoneList<v8::internal::Expression*>* args, | 5998 ZoneList<v8::internal::Expression*>* args, |
| 6002 int pos) { | 5999 int pos) { |
| 6003 args->InsertAt(0, function, zone()); | 6000 args->InsertAt(0, function, zone()); |
| 6004 | 6001 |
| 6005 return factory()->NewCallRuntime( | 6002 return factory()->NewCallRuntime( |
| 6006 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 6003 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 6007 } | 6004 } |
| 6008 } // namespace internal | 6005 } // namespace internal |
| 6009 } // namespace v8 | 6006 } // namespace v8 |
| OLD | NEW |