| 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) { | 669 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) { |
| 670 return parser_->scanner()->NextSymbol(parser_->ast_value_factory()); | 670 return parser_->scanner()->NextSymbol(parser_->ast_value_factory()); |
| 671 } | 671 } |
| 672 | 672 |
| 673 | 673 |
| 674 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, | 674 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, |
| 675 int pos) { | 675 int pos) { |
| 676 return factory->NewVariableProxy(scope->receiver(), pos); | 676 return factory->NewVariableProxy(scope->receiver(), pos); |
| 677 } | 677 } |
| 678 | 678 |
| 679 |
| 680 Expression* ParserTraits::NewTargetExpression(Scope* scope, |
| 681 AstNodeFactory* factory, |
| 682 int pos) { |
| 683 return factory->NewVariableProxy(scope->new_target_var(), pos); |
| 684 } |
| 685 |
| 686 |
| 679 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, | 687 Expression* ParserTraits::SuperReference(Scope* scope, AstNodeFactory* factory, |
| 680 int pos) { | 688 int pos) { |
| 681 return factory->NewSuperReference( | 689 return factory->NewSuperReference( |
| 682 ThisExpression(scope, factory, pos)->AsVariableProxy(), | 690 ThisExpression(scope, factory, pos)->AsVariableProxy(), |
| 683 pos); | 691 pos); |
| 684 } | 692 } |
| 685 | 693 |
| 686 | 694 |
| 687 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, | 695 Expression* ParserTraits::DefaultConstructor(bool call_super, Scope* scope, |
| 688 int pos, int end_pos) { | 696 int pos, int end_pos) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); | 816 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); |
| 809 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); | 817 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); |
| 810 set_allow_harmony_classes(FLAG_harmony_classes); | 818 set_allow_harmony_classes(FLAG_harmony_classes); |
| 811 set_allow_harmony_object_literals(FLAG_harmony_object_literals); | 819 set_allow_harmony_object_literals(FLAG_harmony_object_literals); |
| 812 set_allow_harmony_templates(FLAG_harmony_templates); | 820 set_allow_harmony_templates(FLAG_harmony_templates); |
| 813 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 821 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
| 814 set_allow_harmony_unicode(FLAG_harmony_unicode); | 822 set_allow_harmony_unicode(FLAG_harmony_unicode); |
| 815 set_allow_harmony_computed_property_names( | 823 set_allow_harmony_computed_property_names( |
| 816 FLAG_harmony_computed_property_names); | 824 FLAG_harmony_computed_property_names); |
| 817 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); | 825 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); |
| 826 set_allow_harmony_new_target(FLAG_harmony_new_target); |
| 818 set_allow_strong_mode(FLAG_strong_mode); | 827 set_allow_strong_mode(FLAG_strong_mode); |
| 819 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 828 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
| 820 ++feature) { | 829 ++feature) { |
| 821 use_counts_[feature] = 0; | 830 use_counts_[feature] = 0; |
| 822 } | 831 } |
| 823 if (info->ast_value_factory() == NULL) { | 832 if (info->ast_value_factory() == NULL) { |
| 824 // info takes ownership of AstValueFactory. | 833 // info takes ownership of AstValueFactory. |
| 825 info->SetAstValueFactory(new AstValueFactory(zone(), hash_seed)); | 834 info->SetAstValueFactory(new AstValueFactory(zone(), hash_seed)); |
| 826 ast_value_factory_ = info->ast_value_factory(); | 835 ast_value_factory_ = info->ast_value_factory(); |
| 827 } | 836 } |
| (...skipping 3098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3926 scope_->SetLanguageMode(logger.language_mode()); | 3935 scope_->SetLanguageMode(logger.language_mode()); |
| 3927 if (logger.scope_uses_super_property()) { | 3936 if (logger.scope_uses_super_property()) { |
| 3928 scope_->RecordSuperPropertyUsage(); | 3937 scope_->RecordSuperPropertyUsage(); |
| 3929 } | 3938 } |
| 3930 if (produce_cached_parse_data()) { | 3939 if (produce_cached_parse_data()) { |
| 3931 DCHECK(log_); | 3940 DCHECK(log_); |
| 3932 // Position right after terminal '}'. | 3941 // Position right after terminal '}'. |
| 3933 int body_end = scanner()->location().end_pos; | 3942 int body_end = scanner()->location().end_pos; |
| 3934 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, | 3943 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, |
| 3935 *expected_property_count, scope_->language_mode(), | 3944 *expected_property_count, scope_->language_mode(), |
| 3936 scope_->uses_super_property()); | 3945 scope_->uses_super_property(), scope_->uses_new_target()); |
| 3937 } | 3946 } |
| 3938 } | 3947 } |
| 3939 | 3948 |
| 3940 | 3949 |
| 3941 void Parser::AddAssertIsConstruct(ZoneList<Statement*>* body, int pos) { | 3950 void Parser::AddAssertIsConstruct(ZoneList<Statement*>* body, int pos) { |
| 3942 ZoneList<Expression*>* arguments = | 3951 ZoneList<Expression*>* arguments = |
| 3943 new (zone()) ZoneList<Expression*>(0, zone()); | 3952 new (zone()) ZoneList<Expression*>(0, zone()); |
| 3944 CallRuntime* construct_check = factory()->NewCallRuntime( | 3953 CallRuntime* construct_check = factory()->NewCallRuntime( |
| 3945 ast_value_factory()->is_construct_call_string(), | 3954 ast_value_factory()->is_construct_call_string(), |
| 3946 Runtime::FunctionForId(Runtime::kInlineIsConstructCall), arguments, pos); | 3955 Runtime::FunctionForId(Runtime::kInlineIsConstructCall), arguments, pos); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4052 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); | 4061 reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); |
| 4053 reusable_preparser_->set_allow_harmony_object_literals( | 4062 reusable_preparser_->set_allow_harmony_object_literals( |
| 4054 allow_harmony_object_literals()); | 4063 allow_harmony_object_literals()); |
| 4055 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); | 4064 reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates()); |
| 4056 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 4065 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); |
| 4057 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); | 4066 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); |
| 4058 reusable_preparser_->set_allow_harmony_computed_property_names( | 4067 reusable_preparser_->set_allow_harmony_computed_property_names( |
| 4059 allow_harmony_computed_property_names()); | 4068 allow_harmony_computed_property_names()); |
| 4060 reusable_preparser_->set_allow_harmony_rest_params( | 4069 reusable_preparser_->set_allow_harmony_rest_params( |
| 4061 allow_harmony_rest_params()); | 4070 allow_harmony_rest_params()); |
| 4071 reusable_preparser_->set_allow_harmony_new_target( |
| 4072 allow_harmony_new_target()); |
| 4062 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); | 4073 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); |
| 4063 } | 4074 } |
| 4064 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( | 4075 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( |
| 4065 language_mode(), function_state_->kind(), logger); | 4076 language_mode(), function_state_->kind(), logger); |
| 4066 if (pre_parse_timer_ != NULL) { | 4077 if (pre_parse_timer_ != NULL) { |
| 4067 pre_parse_timer_->Stop(); | 4078 pre_parse_timer_->Stop(); |
| 4068 } | 4079 } |
| 4069 return result; | 4080 return result; |
| 4070 } | 4081 } |
| 4071 | 4082 |
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5485 } else { | 5496 } else { |
| 5486 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5497 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
| 5487 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5498 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
| 5488 raw_string->length()); | 5499 raw_string->length()); |
| 5489 } | 5500 } |
| 5490 } | 5501 } |
| 5491 | 5502 |
| 5492 return running_hash; | 5503 return running_hash; |
| 5493 } | 5504 } |
| 5494 } } // namespace v8::internal | 5505 } } // namespace v8::internal |
| OLD | NEW |