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

Side by Side Diff: src/parser.cc

Issue 1164073003: [es6] super.prop, eval and lazy functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Increment the preparse data version 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
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 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after
4096 4096
4097 scope_->set_end_position(entry.end_pos()); 4097 scope_->set_end_position(entry.end_pos());
4098 Expect(Token::RBRACE, ok); 4098 Expect(Token::RBRACE, ok);
4099 if (!*ok) { 4099 if (!*ok) {
4100 return; 4100 return;
4101 } 4101 }
4102 total_preparse_skipped_ += scope_->end_position() - function_block_pos; 4102 total_preparse_skipped_ += scope_->end_position() - function_block_pos;
4103 *materialized_literal_count = entry.literal_count(); 4103 *materialized_literal_count = entry.literal_count();
4104 *expected_property_count = entry.property_count(); 4104 *expected_property_count = entry.property_count();
4105 scope_->SetLanguageMode(entry.language_mode()); 4105 scope_->SetLanguageMode(entry.language_mode());
4106 if (entry.uses_super_property()) scope_->RecordSuperPropertyUsage(); 4106 if (entry.needs_home_object()) scope_->RecordSuperPropertyUsage();
adamk 2015/06/04 20:02:33 Maybe rename RecordSuperPropertyUsage() to somethi
arv (Not doing code reviews) 2015/06/04 20:15:57 Yeah. This could be improved. The Scope keeps tra
arv (Not doing code reviews) 2015/06/04 20:48:26 I changed it to use 2 fields in the logger instead
4107 return; 4107 return;
4108 } 4108 }
4109 cached_parse_data_->Reject(); 4109 cached_parse_data_->Reject();
4110 } 4110 }
4111 // With no cached data, we partially parse the function, without building an 4111 // With no cached data, we partially parse the function, without building an
4112 // AST. This gathers the data needed to build a lazy function. 4112 // AST. This gathers the data needed to build a lazy function.
4113 SingletonLogger logger; 4113 SingletonLogger logger;
4114 PreParser::PreParseResult result = 4114 PreParser::PreParseResult result =
4115 ParseLazyFunctionBodyWithPreParser(&logger, bookmark); 4115 ParseLazyFunctionBodyWithPreParser(&logger, bookmark);
4116 if (bookmark && bookmark->HasBeenReset()) { 4116 if (bookmark && bookmark->HasBeenReset()) {
(...skipping 14 matching lines...) Expand all
4131 } 4131 }
4132 scope_->set_end_position(logger.end()); 4132 scope_->set_end_position(logger.end());
4133 Expect(Token::RBRACE, ok); 4133 Expect(Token::RBRACE, ok);
4134 if (!*ok) { 4134 if (!*ok) {
4135 return; 4135 return;
4136 } 4136 }
4137 total_preparse_skipped_ += scope_->end_position() - function_block_pos; 4137 total_preparse_skipped_ += scope_->end_position() - function_block_pos;
4138 *materialized_literal_count = logger.literals(); 4138 *materialized_literal_count = logger.literals();
4139 *expected_property_count = logger.properties(); 4139 *expected_property_count = logger.properties();
4140 scope_->SetLanguageMode(logger.language_mode()); 4140 scope_->SetLanguageMode(logger.language_mode());
4141 if (logger.scope_uses_super_property()) { 4141 if (logger.needs_home_object()) {
4142 scope_->RecordSuperPropertyUsage(); 4142 scope_->RecordSuperPropertyUsage();
4143 } 4143 }
4144 if (produce_cached_parse_data()) { 4144 if (produce_cached_parse_data()) {
4145 DCHECK(log_); 4145 DCHECK(log_);
4146 // Position right after terminal '}'. 4146 // Position right after terminal '}'.
4147 int body_end = scanner()->location().end_pos; 4147 int body_end = scanner()->location().end_pos;
4148 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, 4148 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count,
4149 *expected_property_count, scope_->language_mode(), 4149 *expected_property_count, scope_->language_mode(),
4150 scope_->uses_super_property()); 4150 scope_->NeedsHomeObject());
4151 } 4151 }
4152 } 4152 }
4153 4153
4154 4154
4155 void Parser::AddAssertIsConstruct(ZoneList<Statement*>* body, int pos) { 4155 void Parser::AddAssertIsConstruct(ZoneList<Statement*>* body, int pos) {
4156 ZoneList<Expression*>* arguments = 4156 ZoneList<Expression*>* arguments =
4157 new (zone()) ZoneList<Expression*>(0, zone()); 4157 new (zone()) ZoneList<Expression*>(0, zone());
4158 CallRuntime* construct_check = factory()->NewCallRuntime( 4158 CallRuntime* construct_check = factory()->NewCallRuntime(
4159 ast_value_factory()->is_construct_call_string(), 4159 ast_value_factory()->is_construct_call_string(),
4160 Runtime::FunctionForId(Runtime::kInlineIsConstructCall), arguments, pos); 4160 Runtime::FunctionForId(Runtime::kInlineIsConstructCall), arguments, pos);
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
5818 Expression* Parser::SpreadCallNew(Expression* function, 5818 Expression* Parser::SpreadCallNew(Expression* function,
5819 ZoneList<v8::internal::Expression*>* args, 5819 ZoneList<v8::internal::Expression*>* args,
5820 int pos) { 5820 int pos) {
5821 args->InsertAt(0, function, zone()); 5821 args->InsertAt(0, function, zone());
5822 5822
5823 return factory()->NewCallRuntime( 5823 return factory()->NewCallRuntime(
5824 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5824 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5825 } 5825 }
5826 } // namespace internal 5826 } // namespace internal
5827 } // namespace v8 5827 } // namespace v8
OLDNEW
« src/ast.cc ('K') | « src/parser.h ('k') | src/preparse-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698