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

Side by Side Diff: src/parser.cc

Issue 1132933003: [es6] support spread-calling Super-accessing properties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | test/mjsunit/harmony/spread-call-super-property.js » ('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 5690 matching lines...) Expand 10 before | Expand all | Expand 10 after
5701 Expression* result = factory()->NewCallRuntime( 5701 Expression* result = factory()->NewCallRuntime(
5702 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5702 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5703 args = new (zone()) ZoneList<Expression*>(0, zone()); 5703 args = new (zone()) ZoneList<Expression*>(0, zone());
5704 args->Add(result, zone()); 5704 args->Add(result, zone());
5705 return factory()->NewCallRuntime( 5705 return factory()->NewCallRuntime(
5706 ast_value_factory()->empty_string(), 5706 ast_value_factory()->empty_string(),
5707 Runtime::FunctionForId(Runtime::kInlineCallSuperWithSpread), args, pos); 5707 Runtime::FunctionForId(Runtime::kInlineCallSuperWithSpread), args, pos);
5708 } else { 5708 } else {
5709 if (function->IsProperty()) { 5709 if (function->IsProperty()) {
5710 // Method calls 5710 // Method calls
5711 Variable* temp = 5711 if (function->AsProperty()->IsSuperAccess()) {
5712 scope_->NewTemporary(ast_value_factory()->empty_string()); 5712 VariableProxy* original_home =
5713 VariableProxy* obj = factory()->NewVariableProxy(temp); 5713 function->AsProperty()->obj()->AsSuperReference()->this_var();
5714 Assignment* assign_obj = factory()->NewAssignment( 5714 VariableProxy* home = factory()->NewVariableProxy(original_home->var());
arv (Not doing code reviews) 2015/05/14 21:54:56 It is not clear why you need a new VariableProxy h
5715 Token::ASSIGN, obj, function->AsProperty()->obj(), 5715 args->InsertAt(0, function, zone());
5716 RelocInfo::kNoPosition); 5716 args->InsertAt(1, home, zone());
5717 function = factory()->NewProperty( 5717 } else {
5718 assign_obj, function->AsProperty()->key(), RelocInfo::kNoPosition); 5718 Variable* temp =
5719 args->InsertAt(0, function, zone()); 5719 scope_->NewTemporary(ast_value_factory()->empty_string());
5720 obj = factory()->NewVariableProxy(temp); 5720 VariableProxy* obj = factory()->NewVariableProxy(temp);
5721 args->InsertAt(1, obj, zone()); 5721 Assignment* assign_obj = factory()->NewAssignment(
5722 Token::ASSIGN, obj, function->AsProperty()->obj(),
5723 RelocInfo::kNoPosition);
5724 function = factory()->NewProperty(
5725 assign_obj, function->AsProperty()->key(), RelocInfo::kNoPosition);
5726 args->InsertAt(0, function, zone());
5727 obj = factory()->NewVariableProxy(temp);
5728 args->InsertAt(1, obj, zone());
5729 }
5722 } else { 5730 } else {
5723 // Non-method calls 5731 // Non-method calls
5724 args->InsertAt(0, function, zone()); 5732 args->InsertAt(0, function, zone());
5725 args->InsertAt(1, factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), 5733 args->InsertAt(1, factory()->NewUndefinedLiteral(RelocInfo::kNoPosition),
5726 zone()); 5734 zone());
5727 } 5735 }
5728 return factory()->NewCallRuntime( 5736 return factory()->NewCallRuntime(
5729 ast_value_factory()->reflect_apply_string(), NULL, args, pos); 5737 ast_value_factory()->reflect_apply_string(), NULL, args, pos);
5730 } 5738 }
5731 } 5739 }
5732 5740
5733 5741
5734 Expression* Parser::SpreadCallNew(Expression* function, 5742 Expression* Parser::SpreadCallNew(Expression* function,
5735 ZoneList<v8::internal::Expression*>* args, 5743 ZoneList<v8::internal::Expression*>* args,
5736 int pos) { 5744 int pos) {
5737 args->InsertAt(0, function, zone()); 5745 args->InsertAt(0, function, zone());
5738 5746
5739 return factory()->NewCallRuntime( 5747 return factory()->NewCallRuntime(
5740 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5748 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5741 } 5749 }
5742 } } // namespace v8::internal 5750 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/spread-call-super-property.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698