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

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.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
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 __ bind(&done); 1982 __ bind(&done);
1983 context()->Plug(v0); 1983 context()->Plug(v0);
1984 } 1984 }
1985 1985
1986 1986
1987 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1987 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1988 for (int i = 0; i < lit->properties()->length(); i++) { 1988 for (int i = 0; i < lit->properties()->length(); i++) {
1989 ClassLiteral::Property* property = lit->properties()->at(i); 1989 ClassLiteral::Property* property = lit->properties()->at(i);
1990 Expression* value = property->value(); 1990 Expression* value = property->value();
1991 1991
1992 if (property->kind() == ClassLiteral::Property::FIELD &&
1993 !property->is_static()) {
1994 // Non-static properties produced by the parser have as their 'key' an
1995 // expression producing their name and as their 'value' a variable which
1996 // is refered to by the synthetic initializer function in order to
1997 // determine the name during class instantiation. This is necessary
1998 // because computed names must only be evaluated once, at class definition
1999 // time.
2000 // That is, code which looks like `class C { [f()] = 1; }` is desugared
2001 // into something like
2002 // class C { constructor(){ this.[.class-field-0-name] = 1; } };
2003 // let .class-field-0-name = f();
2004 // except that the assignment to .class-field-name-0 occurs interleaved
2005 // with the rest of the class body; it is performed by the block in which
2006 // this comment appears.
2007 DCHECK(property->value()->IsVariableProxy());
2008 Variable* variable = property->value()->AsVariableProxy()->var();
2009 VisitForStackValue(property->key());
2010 EmitVariableAssignment(variable, Token::INIT,
2011 FeedbackVectorSlot::Invalid());
2012 DropOperands(1);
2013 continue;
2014 }
2015
1992 Register scratch = a1; 2016 Register scratch = a1;
1993 if (property->is_static()) { 2017 if (property->is_static()) {
1994 __ ld(scratch, MemOperand(sp, kPointerSize)); // constructor 2018 __ ld(scratch, MemOperand(sp, kPointerSize)); // constructor
1995 } else { 2019 } else {
1996 __ ld(scratch, MemOperand(sp, 0)); // prototype 2020 __ ld(scratch, MemOperand(sp, 0)); // prototype
1997 } 2021 }
1998 PushOperand(scratch); 2022 PushOperand(scratch);
1999 EmitPropertyKey(property, lit->GetIdForProperty(i)); 2023 EmitPropertyKey(property, lit->GetIdForProperty(i));
2000 2024
2001 // The static prototype property is read only. We handle the non computed 2025 // The static prototype property is read only. We handle the non computed
(...skipping 21 matching lines...) Expand all
2023 PushOperand(Smi::FromInt(DONT_ENUM)); 2047 PushOperand(Smi::FromInt(DONT_ENUM));
2024 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 2048 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2025 break; 2049 break;
2026 2050
2027 case ClassLiteral::Property::SETTER: 2051 case ClassLiteral::Property::SETTER:
2028 PushOperand(Smi::FromInt(DONT_ENUM)); 2052 PushOperand(Smi::FromInt(DONT_ENUM));
2029 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 2053 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2030 break; 2054 break;
2031 2055
2032 case ClassLiteral::Property::FIELD: 2056 case ClassLiteral::Property::FIELD:
2033 default: 2057 DCHECK(property->is_static());
2034 UNREACHABLE(); 2058 PushOperand(Smi::FromInt(DONT_ENUM));
2059 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2060 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2061 break;
2035 } 2062 }
2036 } 2063 }
2037 } 2064 }
2038 2065
2039 2066
2040 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2067 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2041 __ mov(a0, result_register()); 2068 __ mov(a0, result_register());
2042 PopOperand(a1); 2069 PopOperand(a1);
2043 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2070 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2044 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2071 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 reinterpret_cast<uint64_t>( 3773 reinterpret_cast<uint64_t>(
3747 isolate->builtins()->OnStackReplacement()->entry())); 3774 isolate->builtins()->OnStackReplacement()->entry()));
3748 return ON_STACK_REPLACEMENT; 3775 return ON_STACK_REPLACEMENT;
3749 } 3776 }
3750 3777
3751 3778
3752 } // namespace internal 3779 } // namespace internal
3753 } // namespace v8 3780 } // namespace v8
3754 3781
3755 #endif // V8_TARGET_ARCH_MIPS64 3782 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698