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

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: Make the logger use 2 fields 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/preparse-data.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 4086 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.uses_super_property()) scope_->RecordSuperPropertyUsage();
4107 if (entry.calls_eval()) scope_->RecordEvalCall();
4107 return; 4108 return;
4108 } 4109 }
4109 cached_parse_data_->Reject(); 4110 cached_parse_data_->Reject();
4110 } 4111 }
4111 // With no cached data, we partially parse the function, without building an 4112 // With no cached data, we partially parse the function, without building an
4112 // AST. This gathers the data needed to build a lazy function. 4113 // AST. This gathers the data needed to build a lazy function.
4113 SingletonLogger logger; 4114 SingletonLogger logger;
4114 PreParser::PreParseResult result = 4115 PreParser::PreParseResult result =
4115 ParseLazyFunctionBodyWithPreParser(&logger, bookmark); 4116 ParseLazyFunctionBodyWithPreParser(&logger, bookmark);
4116 if (bookmark && bookmark->HasBeenReset()) { 4117 if (bookmark && bookmark->HasBeenReset()) {
(...skipping 14 matching lines...) Expand all
4131 } 4132 }
4132 scope_->set_end_position(logger.end()); 4133 scope_->set_end_position(logger.end());
4133 Expect(Token::RBRACE, ok); 4134 Expect(Token::RBRACE, ok);
4134 if (!*ok) { 4135 if (!*ok) {
4135 return; 4136 return;
4136 } 4137 }
4137 total_preparse_skipped_ += scope_->end_position() - function_block_pos; 4138 total_preparse_skipped_ += scope_->end_position() - function_block_pos;
4138 *materialized_literal_count = logger.literals(); 4139 *materialized_literal_count = logger.literals();
4139 *expected_property_count = logger.properties(); 4140 *expected_property_count = logger.properties();
4140 scope_->SetLanguageMode(logger.language_mode()); 4141 scope_->SetLanguageMode(logger.language_mode());
4141 if (logger.scope_uses_super_property()) { 4142 if (logger.uses_super_property()) {
4142 scope_->RecordSuperPropertyUsage(); 4143 scope_->RecordSuperPropertyUsage();
4143 } 4144 }
4145 if (logger.calls_eval()) {
4146 scope_->RecordEvalCall();
4147 }
4144 if (produce_cached_parse_data()) { 4148 if (produce_cached_parse_data()) {
4145 DCHECK(log_); 4149 DCHECK(log_);
4146 // Position right after terminal '}'. 4150 // Position right after terminal '}'.
4147 int body_end = scanner()->location().end_pos; 4151 int body_end = scanner()->location().end_pos;
4148 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, 4152 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count,
4149 *expected_property_count, scope_->language_mode(), 4153 *expected_property_count, scope_->language_mode(),
4150 scope_->uses_super_property()); 4154 scope_->uses_super_property(), scope_->calls_eval());
4151 } 4155 }
4152 } 4156 }
4153 4157
4154 4158
4155 void Parser::AddAssertIsConstruct(ZoneList<Statement*>* body, int pos) { 4159 void Parser::AddAssertIsConstruct(ZoneList<Statement*>* body, int pos) {
4156 ZoneList<Expression*>* arguments = 4160 ZoneList<Expression*>* arguments =
4157 new (zone()) ZoneList<Expression*>(0, zone()); 4161 new (zone()) ZoneList<Expression*>(0, zone());
4158 CallRuntime* construct_check = factory()->NewCallRuntime( 4162 CallRuntime* construct_check = factory()->NewCallRuntime(
4159 ast_value_factory()->is_construct_call_string(), 4163 ast_value_factory()->is_construct_call_string(),
4160 Runtime::FunctionForId(Runtime::kInlineIsConstructCall), arguments, pos); 4164 Runtime::FunctionForId(Runtime::kInlineIsConstructCall), arguments, pos);
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
5818 Expression* Parser::SpreadCallNew(Expression* function, 5822 Expression* Parser::SpreadCallNew(Expression* function,
5819 ZoneList<v8::internal::Expression*>* args, 5823 ZoneList<v8::internal::Expression*>* args,
5820 int pos) { 5824 int pos) {
5821 args->InsertAt(0, function, zone()); 5825 args->InsertAt(0, function, zone());
5822 5826
5823 return factory()->NewCallRuntime( 5827 return factory()->NewCallRuntime(
5824 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5828 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5825 } 5829 }
5826 } // namespace internal 5830 } // namespace internal
5827 } // namespace v8 5831 } // namespace v8
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparse-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698