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

Unified Diff: src/parser.cc

Issue 1321343004: Desugar %DefaultConstructorCallSuper partially in parser. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 07f842a119b06e9c83fb3ad647e990a1d1cedb0c..a5273441892272108dcd1f06297f2cc03d8775a7 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -359,7 +359,7 @@ FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope,
body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone());
AddAssertIsConstruct(body, pos);
if (call_super) {
- // %_DefaultConstructorCallSuper(new.target, .this_function)
+ // %_DefaultConstructorCallSuper(new.target, %GetPrototype(<this-fun>))
ZoneList<Expression*>* args =
new (zone()) ZoneList<Expression*>(2, zone());
VariableProxy* new_target_proxy = scope_->NewUnresolved(
@@ -369,7 +369,12 @@ FunctionLiteral* Parser::DefaultConstructor(bool call_super, Scope* scope,
VariableProxy* this_function_proxy = scope_->NewUnresolved(
factory(), ast_value_factory()->this_function_string(),
Variable::NORMAL, pos);
- args->Add(this_function_proxy, zone());
+ ZoneList<Expression*>* tmp =
+ new (zone()) ZoneList<Expression*>(1, zone());
+ tmp->Add(this_function_proxy, zone());
+ Expression* get_prototype =
+ factory()->NewCallRuntime(Runtime::kGetPrototype, tmp, pos);
+ args->Add(get_prototype, zone());
CallRuntime* call = factory()->NewCallRuntime(
Runtime::kInlineDefaultConstructorCallSuper, args, pos);
body->Add(factory()->NewReturnStatement(call, pos), zone());
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698