Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/parser.cc

Issue 1170263002: Revert of [es6] Parsing of new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 } 749 }
750 750
751 751
752 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, 752 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory,
753 int pos) { 753 int pos) {
754 return scope->NewUnresolved(factory, 754 return scope->NewUnresolved(factory,
755 parser_->ast_value_factory()->this_string(), 755 parser_->ast_value_factory()->this_string(),
756 Variable::THIS, pos, pos + 4); 756 Variable::THIS, pos, pos + 4);
757 } 757 }
758 758
759
760 Expression* ParserTraits::SuperPropertyReference(Scope* scope, 759 Expression* ParserTraits::SuperPropertyReference(Scope* scope,
761 AstNodeFactory* factory, 760 AstNodeFactory* factory,
762 int pos) { 761 int pos) {
763 // this_function[home_object_symbol] 762 // this_function[home_object_symbol]
764 VariableProxy* this_function_proxy = scope->NewUnresolved( 763 VariableProxy* this_function_proxy = scope->NewUnresolved(
765 factory, parser_->ast_value_factory()->this_function_string(), 764 factory, parser_->ast_value_factory()->this_function_string(),
766 Variable::NORMAL, pos); 765 Variable::NORMAL, pos);
767 Expression* home_object_symbol_literal = 766 Expression* home_object_symbol_literal =
768 factory->NewSymbolLiteral("home_object_symbol", RelocInfo::kNoPosition); 767 factory->NewSymbolLiteral("home_object_symbol", RelocInfo::kNoPosition);
769 Expression* home_object = factory->NewProperty( 768 Expression* home_object = factory->NewProperty(
(...skipping 10 matching lines...) Expand all
780 Variable::NORMAL, pos); 779 Variable::NORMAL, pos);
781 VariableProxy* this_function_proxy = scope->NewUnresolved( 780 VariableProxy* this_function_proxy = scope->NewUnresolved(
782 factory, parser_->ast_value_factory()->this_function_string(), 781 factory, parser_->ast_value_factory()->this_function_string(),
783 Variable::NORMAL, pos); 782 Variable::NORMAL, pos);
784 return factory->NewSuperCallReference( 783 return factory->NewSuperCallReference(
785 ThisExpression(scope, factory, pos)->AsVariableProxy(), new_target_proxy, 784 ThisExpression(scope, factory, pos)->AsVariableProxy(), new_target_proxy,
786 this_function_proxy, pos); 785 this_function_proxy, pos);
787 } 786 }
788 787
789 788
790 Expression* ParserTraits::NewTargetExpression(Scope* scope,
791 AstNodeFactory* factory,
792 int pos) {
793 static const int kNewTargetStringLength = 10;
794 return scope->NewUnresolved(
795 factory, parser_->ast_value_factory()->new_target_string(),
796 Variable::NORMAL, pos, pos + kNewTargetStringLength);
797 }
798
799
800 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, 789 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope,
801 int pos, int end_pos) { 790 int pos, int end_pos) {
802 return parser_->DefaultConstructor(call_super, scope, pos, end_pos); 791 return parser_->DefaultConstructor(call_super, scope, pos, end_pos);
803 } 792 }
804 793
805 794
806 Literal* ParserTraits::ExpressionFromLiteral(Token::Value token, int pos, 795 Literal* ParserTraits::ExpressionFromLiteral(Token::Value token, int pos,
807 Scanner* scanner, 796 Scanner* scanner,
808 AstNodeFactory* factory) { 797 AstNodeFactory* factory) {
809 switch (token) { 798 switch (token) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 set_allow_harmony_classes(FLAG_harmony_classes); 903 set_allow_harmony_classes(FLAG_harmony_classes);
915 set_allow_harmony_object_literals(FLAG_harmony_object_literals); 904 set_allow_harmony_object_literals(FLAG_harmony_object_literals);
916 set_allow_harmony_sloppy(FLAG_harmony_sloppy); 905 set_allow_harmony_sloppy(FLAG_harmony_sloppy);
917 set_allow_harmony_unicode(FLAG_harmony_unicode); 906 set_allow_harmony_unicode(FLAG_harmony_unicode);
918 set_allow_harmony_computed_property_names( 907 set_allow_harmony_computed_property_names(
919 FLAG_harmony_computed_property_names); 908 FLAG_harmony_computed_property_names);
920 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); 909 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters);
921 set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); 910 set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls);
922 set_allow_harmony_destructuring(FLAG_harmony_destructuring); 911 set_allow_harmony_destructuring(FLAG_harmony_destructuring);
923 set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); 912 set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays);
924 set_allow_harmony_new_target(FLAG_harmony_new_target);
925 set_allow_strong_mode(FLAG_strong_mode); 913 set_allow_strong_mode(FLAG_strong_mode);
926 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; 914 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
927 ++feature) { 915 ++feature) {
928 use_counts_[feature] = 0; 916 use_counts_[feature] = 0;
929 } 917 }
930 if (info->ast_value_factory() == NULL) { 918 if (info->ast_value_factory() == NULL) {
931 // info takes ownership of AstValueFactory. 919 // info takes ownership of AstValueFactory.
932 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed())); 920 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed()));
933 info->set_ast_value_factory_owned(); 921 info->set_ast_value_factory_owned();
934 ast_value_factory_ = info->ast_value_factory(); 922 ast_value_factory_ = info->ast_value_factory();
(...skipping 3356 matching lines...) Expand 10 before | Expand all | Expand 10 after
4291 // main thread preparse times. 4279 // main thread preparse times.
4292 if (pre_parse_timer_ != NULL) { 4280 if (pre_parse_timer_ != NULL) {
4293 pre_parse_timer_->Start(); 4281 pre_parse_timer_->Start();
4294 } 4282 }
4295 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); 4283 DCHECK_EQ(Token::LBRACE, scanner()->current_token());
4296 4284
4297 if (reusable_preparser_ == NULL) { 4285 if (reusable_preparser_ == NULL) {
4298 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), 4286 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(),
4299 NULL, stack_limit_); 4287 NULL, stack_limit_);
4300 reusable_preparser_->set_allow_lazy(true); 4288 reusable_preparser_->set_allow_lazy(true);
4301 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); 4289 reusable_preparser_->set_allow_natives(allow_natives());
4302 SET_ALLOW(natives); 4290 reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules());
4303 SET_ALLOW(harmony_modules); 4291 reusable_preparser_->set_allow_harmony_arrow_functions(
4304 SET_ALLOW(harmony_arrow_functions); 4292 allow_harmony_arrow_functions());
4305 SET_ALLOW(harmony_classes); 4293 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes());
4306 SET_ALLOW(harmony_object_literals); 4294 reusable_preparser_->set_allow_harmony_object_literals(
4307 SET_ALLOW(harmony_sloppy); 4295 allow_harmony_object_literals());
4308 SET_ALLOW(harmony_unicode); 4296 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy());
4309 SET_ALLOW(harmony_computed_property_names); 4297 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode());
4310 SET_ALLOW(harmony_rest_params); 4298 reusable_preparser_->set_allow_harmony_computed_property_names(
4311 SET_ALLOW(harmony_spreadcalls); 4299 allow_harmony_computed_property_names());
4312 SET_ALLOW(harmony_destructuring); 4300 reusable_preparser_->set_allow_harmony_rest_params(
4313 SET_ALLOW(harmony_spread_arrays); 4301 allow_harmony_rest_params());
4314 SET_ALLOW(harmony_new_target); 4302 reusable_preparser_->set_allow_harmony_spreadcalls(
4315 SET_ALLOW(strong_mode); 4303 allow_harmony_spreadcalls());
4316 #undef SET_ALLOW 4304 reusable_preparser_->set_allow_harmony_destructuring(
4305 allow_harmony_destructuring());
4306 reusable_preparser_->set_allow_harmony_spread_arrays(
4307 allow_harmony_spread_arrays());
4308 reusable_preparser_->set_allow_strong_mode(allow_strong_mode());
4317 } 4309 }
4318 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( 4310 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction(
4319 language_mode(), function_state_->kind(), logger, bookmark); 4311 language_mode(), function_state_->kind(), logger, bookmark);
4320 if (pre_parse_timer_ != NULL) { 4312 if (pre_parse_timer_ != NULL) {
4321 pre_parse_timer_->Stop(); 4313 pre_parse_timer_->Stop();
4322 } 4314 }
4323 return result; 4315 return result;
4324 } 4316 }
4325 4317
4326 4318
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
5830 Expression* Parser::SpreadCallNew(Expression* function, 5822 Expression* Parser::SpreadCallNew(Expression* function,
5831 ZoneList<v8::internal::Expression*>* args, 5823 ZoneList<v8::internal::Expression*>* args,
5832 int pos) { 5824 int pos) {
5833 args->InsertAt(0, function, zone()); 5825 args->InsertAt(0, function, zone());
5834 5826
5835 return factory()->NewCallRuntime( 5827 return factory()->NewCallRuntime(
5836 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5828 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5837 } 5829 }
5838 } // namespace internal 5830 } // namespace internal
5839 } // namespace v8 5831 } // namespace v8
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698