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

Side by Side Diff: src/full-codegen/ppc/full-codegen-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/full-codegen/full-codegen.h" 7 #include "src/full-codegen/full-codegen.h"
8 #include "src/ast/compile-time-value.h" 8 #include "src/ast/compile-time-value.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 __ bind(&done); 1984 __ bind(&done);
1985 context()->Plug(r3); 1985 context()->Plug(r3);
1986 } 1986 }
1987 1987
1988 1988
1989 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1989 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1990 for (int i = 0; i < lit->properties()->length(); i++) { 1990 for (int i = 0; i < lit->properties()->length(); i++) {
1991 ClassLiteral::Property* property = lit->properties()->at(i); 1991 ClassLiteral::Property* property = lit->properties()->at(i);
1992 Expression* value = property->value(); 1992 Expression* value = property->value();
1993 1993
1994 if (property->kind() == ClassLiteral::Property::FIELD &&
1995 !property->is_static()) {
1996 // Non-static properties produced by the parser have as their 'key' an
1997 // expression producing their name and as their 'value' a variable which
1998 // is refered to by the synthetic initializer function in order to
1999 // determine the name during class instantiation. This is necessary
2000 // because computed names must only be evaluated once, at class definition
2001 // time.
2002 // That is, code which looks like `class C { [f()] = 1; }` is desugared
2003 // into something like
2004 // class C { constructor(){ this.[.class-field-0-name] = 1; } };
2005 // let .class-field-0-name = f();
2006 // except that the assignment to .class-field-name-0 occurs interleaved
2007 // with the rest of the class body; it is performed by the block in which
2008 // this comment appears.
2009 DCHECK(property->value()->IsVariableProxy());
2010 Variable* variable = property->value()->AsVariableProxy()->var();
2011 VisitForStackValue(property->key());
2012 EmitVariableAssignment(variable, Token::INIT,
2013 FeedbackVectorSlot::Invalid());
2014 DropOperands(1);
2015 continue;
2016 }
2017
1994 Register scratch = r4; 2018 Register scratch = r4;
1995 if (property->is_static()) { 2019 if (property->is_static()) {
1996 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor 2020 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor
1997 } else { 2021 } else {
1998 __ LoadP(scratch, MemOperand(sp, 0)); // prototype 2022 __ LoadP(scratch, MemOperand(sp, 0)); // prototype
1999 } 2023 }
2000 PushOperand(scratch); 2024 PushOperand(scratch);
2001 EmitPropertyKey(property, lit->GetIdForProperty(i)); 2025 EmitPropertyKey(property, lit->GetIdForProperty(i));
2002 2026
2003 // The static prototype property is read only. We handle the non computed 2027 // The static prototype property is read only. We handle the non computed
(...skipping 21 matching lines...) Expand all
2025 PushOperand(Smi::FromInt(DONT_ENUM)); 2049 PushOperand(Smi::FromInt(DONT_ENUM));
2026 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 2050 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2027 break; 2051 break;
2028 2052
2029 case ClassLiteral::Property::SETTER: 2053 case ClassLiteral::Property::SETTER:
2030 PushOperand(Smi::FromInt(DONT_ENUM)); 2054 PushOperand(Smi::FromInt(DONT_ENUM));
2031 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 2055 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2032 break; 2056 break;
2033 2057
2034 case ClassLiteral::Property::FIELD: 2058 case ClassLiteral::Property::FIELD:
2035 default: 2059 DCHECK(property->is_static());
2036 UNREACHABLE(); 2060 PushOperand(Smi::FromInt(DONT_ENUM));
2061 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2062 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2063 break;
2037 } 2064 }
2038 } 2065 }
2039 } 2066 }
2040 2067
2041 2068
2042 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2069 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2043 PopOperand(r4); 2070 PopOperand(r4);
2044 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2071 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2045 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2072 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2046 CallIC(code, expr->BinaryOperationFeedbackId()); 2073 CallIC(code, expr->BinaryOperationFeedbackId());
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 3747
3721 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); 3748 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address)));
3722 3749
3723 DCHECK(interrupt_address == 3750 DCHECK(interrupt_address ==
3724 isolate->builtins()->OnStackReplacement()->entry()); 3751 isolate->builtins()->OnStackReplacement()->entry());
3725 return ON_STACK_REPLACEMENT; 3752 return ON_STACK_REPLACEMENT;
3726 } 3753 }
3727 } // namespace internal 3754 } // namespace internal
3728 } // namespace v8 3755 } // namespace v8
3729 #endif // V8_TARGET_ARCH_PPC 3756 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/full-codegen/s390/full-codegen-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698