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

Side by Side Diff: src/full-codegen/full-codegen.cc

Issue 2330473002: Class fields, part 3 (backends)
Patch Set: bytecode test Created 4 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 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/full-codegen/full-codegen.h" 5 #include "src/full-codegen/full-codegen.h"
6 6
7 #include "src/ast/ast-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 1521
1522 VisitForStackValue(lit->constructor()); 1522 VisitForStackValue(lit->constructor());
1523 1523
1524 PushOperand(Smi::FromInt(lit->start_position())); 1524 PushOperand(Smi::FromInt(lit->start_position()));
1525 PushOperand(Smi::FromInt(lit->end_position())); 1525 PushOperand(Smi::FromInt(lit->end_position()));
1526 1526
1527 CallRuntimeWithOperands(Runtime::kDefineClass); 1527 CallRuntimeWithOperands(Runtime::kDefineClass);
1528 PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER); 1528 PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER);
1529 PushOperand(result_register()); 1529 PushOperand(result_register());
1530 1530
1531 // The below proxy exists to allow static field initializers to have the
1532 // correct home object and receiver. It's only necessary if the initializers
1533 // are called as a part of class definition instead of immediately after it,
1534 // in which case they could simply refer to the class just constructed. The
1535 // latter is actually what's currently specified, and this will need to be
1536 // changed if that behavior is settled upon. See also
1537 // https://github.com/tc39/proposal-class-public-fields/issues/50
1538 VariableProxy* static_initializer_proxy = lit->static_initializer_proxy();
1539 if (static_initializer_proxy != nullptr) {
1540 Variable* variable = static_initializer_proxy->var();
1541 EmitVariableAssignment(variable, Token::INIT,
1542 FeedbackVectorSlot::Invalid());
1543 }
1544
1531 // Load the "prototype" from the constructor. 1545 // Load the "prototype" from the constructor.
1532 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); 1546 __ Move(LoadDescriptor::ReceiverRegister(), result_register());
1533 __ LoadRoot(LoadDescriptor::NameRegister(), Heap::kprototype_stringRootIndex); 1547 __ LoadRoot(LoadDescriptor::NameRegister(), Heap::kprototype_stringRootIndex);
1534 __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot())); 1548 __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot()));
1535 CallLoadIC(); 1549 CallLoadIC();
1536 PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER); 1550 PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER);
1537 PushOperand(result_register()); 1551 PushOperand(result_register());
1538 1552
1539 EmitClassDefineProperties(lit); 1553 EmitClassDefineProperties(lit);
1540 DropOperands(1); 1554 DropOperands(1);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 return info_->has_simple_parameters(); 2027 return info_->has_simple_parameters();
2014 } 2028 }
2015 2029
2016 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } 2030 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); }
2017 2031
2018 #undef __ 2032 #undef __
2019 2033
2020 2034
2021 } // namespace internal 2035 } // namespace internal
2022 } // namespace v8 2036 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698