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 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3846 | 3846 |
3847 scope_->set_end_position(entry.end_pos()); | 3847 scope_->set_end_position(entry.end_pos()); |
3848 Expect(Token::RBRACE, ok); | 3848 Expect(Token::RBRACE, ok); |
3849 if (!*ok) { | 3849 if (!*ok) { |
3850 return; | 3850 return; |
3851 } | 3851 } |
3852 total_preparse_skipped_ += scope_->end_position() - function_block_pos; | 3852 total_preparse_skipped_ += scope_->end_position() - function_block_pos; |
3853 *materialized_literal_count = entry.literal_count(); | 3853 *materialized_literal_count = entry.literal_count(); |
3854 *expected_property_count = entry.property_count(); | 3854 *expected_property_count = entry.property_count(); |
3855 scope_->SetLanguageMode(entry.language_mode()); | 3855 scope_->SetLanguageMode(entry.language_mode()); |
| 3856 if (entry.uses_super_property()) scope_->RecordSuperPropertyUsage(); |
3856 return; | 3857 return; |
3857 } | 3858 } |
3858 cached_parse_data_->Reject(); | 3859 cached_parse_data_->Reject(); |
3859 } | 3860 } |
3860 // With no cached data, we partially parse the function, without building an | 3861 // With no cached data, we partially parse the function, without building an |
3861 // AST. This gathers the data needed to build a lazy function. | 3862 // AST. This gathers the data needed to build a lazy function. |
3862 SingletonLogger logger; | 3863 SingletonLogger logger; |
3863 PreParser::PreParseResult result = | 3864 PreParser::PreParseResult result = |
3864 ParseLazyFunctionBodyWithPreParser(&logger); | 3865 ParseLazyFunctionBodyWithPreParser(&logger); |
3865 if (result == PreParser::kPreParseStackOverflow) { | 3866 if (result == PreParser::kPreParseStackOverflow) { |
(...skipping 11 matching lines...) Expand all Loading... |
3877 } | 3878 } |
3878 scope_->set_end_position(logger.end()); | 3879 scope_->set_end_position(logger.end()); |
3879 Expect(Token::RBRACE, ok); | 3880 Expect(Token::RBRACE, ok); |
3880 if (!*ok) { | 3881 if (!*ok) { |
3881 return; | 3882 return; |
3882 } | 3883 } |
3883 total_preparse_skipped_ += scope_->end_position() - function_block_pos; | 3884 total_preparse_skipped_ += scope_->end_position() - function_block_pos; |
3884 *materialized_literal_count = logger.literals(); | 3885 *materialized_literal_count = logger.literals(); |
3885 *expected_property_count = logger.properties(); | 3886 *expected_property_count = logger.properties(); |
3886 scope_->SetLanguageMode(logger.language_mode()); | 3887 scope_->SetLanguageMode(logger.language_mode()); |
| 3888 if (logger.scope_uses_super_property()) { |
| 3889 scope_->RecordSuperPropertyUsage(); |
| 3890 } |
3887 if (produce_cached_parse_data()) { | 3891 if (produce_cached_parse_data()) { |
3888 DCHECK(log_); | 3892 DCHECK(log_); |
3889 // Position right after terminal '}'. | 3893 // Position right after terminal '}'. |
3890 int body_end = scanner()->location().end_pos; | 3894 int body_end = scanner()->location().end_pos; |
3891 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, | 3895 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, |
3892 *expected_property_count, scope_->language_mode()); | 3896 *expected_property_count, scope_->language_mode(), |
| 3897 scope_->uses_super_property()); |
3893 } | 3898 } |
3894 } | 3899 } |
3895 | 3900 |
3896 | 3901 |
3897 ZoneList<Statement*>* Parser::ParseEagerFunctionBody( | 3902 ZoneList<Statement*>* Parser::ParseEagerFunctionBody( |
3898 const AstRawString* function_name, int pos, Variable* fvar, | 3903 const AstRawString* function_name, int pos, Variable* fvar, |
3899 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { | 3904 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { |
3900 // Everything inside an eagerly parsed function will be parsed eagerly | 3905 // Everything inside an eagerly parsed function will be parsed eagerly |
3901 // (see comment above). | 3906 // (see comment above). |
3902 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); | 3907 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5419 } else { | 5424 } else { |
5420 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5425 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5421 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5426 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5422 raw_string->length()); | 5427 raw_string->length()); |
5423 } | 5428 } |
5424 } | 5429 } |
5425 | 5430 |
5426 return running_hash; | 5431 return running_hash; |
5427 } | 5432 } |
5428 } } // namespace v8::internal | 5433 } } // namespace v8::internal |
OLD | NEW |