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

Side by Side Diff: src/parser.cc

Issue 924123002: ES6 Classes: Remove tracking of super construct calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/objects-inl.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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone()); 290 body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone());
291 AddAssertIsConstruct(body, pos); 291 AddAssertIsConstruct(body, pos);
292 if (call_super) { 292 if (call_super) {
293 ZoneList<Expression*>* args = 293 ZoneList<Expression*>* args =
294 new (zone()) ZoneList<Expression*>(0, zone()); 294 new (zone()) ZoneList<Expression*>(0, zone());
295 CallRuntime* call = factory()->NewCallRuntime( 295 CallRuntime* call = factory()->NewCallRuntime(
296 ast_value_factory()->empty_string(), 296 ast_value_factory()->empty_string(),
297 Runtime::FunctionForId(Runtime::kInlineDefaultConstructorCallSuper), 297 Runtime::FunctionForId(Runtime::kInlineDefaultConstructorCallSuper),
298 args, pos); 298 args, pos);
299 body->Add(factory()->NewReturnStatement(call, pos), zone()); 299 body->Add(factory()->NewReturnStatement(call, pos), zone());
300 function_scope->RecordSuperConstructorCallUsage();
301 } 300 }
302 301
303 materialized_literal_count = function_state.materialized_literal_count(); 302 materialized_literal_count = function_state.materialized_literal_count();
304 expected_property_count = function_state.expected_property_count(); 303 expected_property_count = function_state.expected_property_count();
305 handler_count = function_state.handler_count(); 304 handler_count = function_state.handler_count();
306 } 305 }
307 306
308 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 307 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
309 name, ast_value_factory(), function_scope, body, 308 name, ast_value_factory(), function_scope, body,
310 materialized_literal_count, expected_property_count, handler_count, 309 materialized_literal_count, expected_property_count, handler_count,
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1081
1083 if (shared_info->is_arrow()) { 1082 if (shared_info->is_arrow()) {
1084 // The first expression being parsed is the parameter list of the arrow 1083 // The first expression being parsed is the parameter list of the arrow
1085 // function. Setting this avoids prevents ExpressionFromIdentifier() 1084 // function. Setting this avoids prevents ExpressionFromIdentifier()
1086 // from creating unresolved variables in already-resolved scopes. 1085 // from creating unresolved variables in already-resolved scopes.
1087 parsing_lazy_arrow_parameters_ = true; 1086 parsing_lazy_arrow_parameters_ = true;
1088 Expression* expression = ParseExpression(false, &ok); 1087 Expression* expression = ParseExpression(false, &ok);
1089 DCHECK(expression->IsFunctionLiteral()); 1088 DCHECK(expression->IsFunctionLiteral());
1090 result = expression->AsFunctionLiteral(); 1089 result = expression->AsFunctionLiteral();
1091 } else if (shared_info->is_default_constructor()) { 1090 } else if (shared_info->is_default_constructor()) {
1092 result = DefaultConstructor(shared_info->uses_super_constructor_call(), 1091 result = DefaultConstructor(IsSubclassConstructor(shared_info->kind()),
1093 scope, shared_info->start_position(), 1092 scope, shared_info->start_position(),
1094 shared_info->end_position()); 1093 shared_info->end_position());
1095 } else { 1094 } else {
1096 result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(), 1095 result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(),
1097 false, // Strict mode name already checked. 1096 false, // Strict mode name already checked.
1098 shared_info->kind(), RelocInfo::kNoPosition, 1097 shared_info->kind(), RelocInfo::kNoPosition,
1099 function_type, 1098 function_type,
1100 FunctionLiteral::NORMAL_ARITY, &ok); 1099 FunctionLiteral::NORMAL_ARITY, &ok);
1101 } 1100 }
1102 // Make sure the results agree. 1101 // Make sure the results agree.
(...skipping 4360 matching lines...) Expand 10 before | Expand all | Expand 10 after
5463 } else { 5462 } else {
5464 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5463 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5465 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5464 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5466 raw_string->length()); 5465 raw_string->length());
5467 } 5466 }
5468 } 5467 }
5469 5468
5470 return running_hash; 5469 return running_hash;
5471 } 5470 }
5472 } } // namespace v8::internal 5471 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698