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

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

Issue 2302643002: Split the AST representation of class properties from object properties (Closed)
Patch Set: rebase 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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 UNREACHABLE(); 1979 UNREACHABLE();
1980 } 1980 }
1981 1981
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 ObjectLiteral::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 Register scratch = a1; 1992 Register scratch = a1;
1993 if (property->is_static()) { 1993 if (property->is_static()) {
1994 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor 1994 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor
1995 } else { 1995 } else {
1996 __ lw(scratch, MemOperand(sp, 0)); // prototype 1996 __ lw(scratch, MemOperand(sp, 0)); // prototype
1997 } 1997 }
1998 PushOperand(scratch); 1998 PushOperand(scratch);
1999 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1999 EmitPropertyKey(property, lit->GetIdForProperty(i));
2000 2000
2001 // The static prototype property is read only. We handle the non computed 2001 // The static prototype property is read only. We handle the non computed
2002 // property name case in the parser. Since this is the only case where we 2002 // property name case in the parser. Since this is the only case where we
2003 // need to check for an own read only property we special case this so we do 2003 // need to check for an own read only property we special case this so we do
2004 // not need to do this for every property. 2004 // not need to do this for every property.
2005 if (property->is_static() && property->is_computed_name()) { 2005 if (property->is_static() && property->is_computed_name()) {
2006 __ CallRuntime(Runtime::kThrowIfStaticPrototype); 2006 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2007 __ push(v0); 2007 __ push(v0);
2008 } 2008 }
2009 2009
2010 VisitForStackValue(value); 2010 VisitForStackValue(value);
2011 if (NeedsHomeObject(value)) { 2011 if (NeedsHomeObject(value)) {
2012 EmitSetHomeObject(value, 2, property->GetSlot()); 2012 EmitSetHomeObject(value, 2, property->GetSlot());
2013 } 2013 }
2014 2014
2015 switch (property->kind()) { 2015 switch (property->kind()) {
2016 case ObjectLiteral::Property::CONSTANT: 2016 case ClassLiteral::Property::METHOD:
2017 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2018 case ObjectLiteral::Property::PROTOTYPE:
2019 UNREACHABLE();
2020 case ObjectLiteral::Property::COMPUTED:
2021 PushOperand(Smi::FromInt(DONT_ENUM)); 2017 PushOperand(Smi::FromInt(DONT_ENUM));
2022 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); 2018 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2023 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); 2019 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2024 break; 2020 break;
2025 2021
2026 case ObjectLiteral::Property::GETTER: 2022 case ClassLiteral::Property::GETTER:
2027 PushOperand(Smi::FromInt(DONT_ENUM)); 2023 PushOperand(Smi::FromInt(DONT_ENUM));
2028 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 2024 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2029 break; 2025 break;
2030 2026
2031 case ObjectLiteral::Property::SETTER: 2027 case ClassLiteral::Property::SETTER:
2032 PushOperand(Smi::FromInt(DONT_ENUM)); 2028 PushOperand(Smi::FromInt(DONT_ENUM));
2033 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 2029 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2034 break; 2030 break;
2035 2031
2036 default: 2032 default:
2037 UNREACHABLE(); 2033 UNREACHABLE();
2038 } 2034 }
2039 } 2035 }
2040 } 2036 }
2041 2037
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
3742 reinterpret_cast<uint32_t>( 3738 reinterpret_cast<uint32_t>(
3743 isolate->builtins()->OnStackReplacement()->entry())); 3739 isolate->builtins()->OnStackReplacement()->entry()));
3744 return ON_STACK_REPLACEMENT; 3740 return ON_STACK_REPLACEMENT;
3745 } 3741 }
3746 3742
3747 3743
3748 } // namespace internal 3744 } // namespace internal
3749 } // namespace v8 3745 } // namespace v8
3750 3746
3751 #endif // V8_TARGET_ARCH_MIPS 3747 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698