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

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

Issue 2302643002: Split the AST representation of class properties from object properties (Closed)
Patch Set: remove spurious classliteralproperty typedef 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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/full-codegen/full-codegen.h" 7 #include "src/full-codegen/full-codegen.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 UNREACHABLE(); 1978 UNREACHABLE();
1979 } 1979 }
1980 1980
1981 __ bind(&done); 1981 __ bind(&done);
1982 context()->Plug(r0); 1982 context()->Plug(r0);
1983 } 1983 }
1984 1984
1985 1985
1986 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1986 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1987 for (int i = 0; i < lit->properties()->length(); i++) { 1987 for (int i = 0; i < lit->properties()->length(); i++) {
1988 ObjectLiteral::Property* property = lit->properties()->at(i); 1988 ClassLiteral::Property* property = lit->properties()->at(i);
1989 Expression* value = property->value(); 1989 Expression* value = property->value();
1990 1990
1991 Register scratch = r1; 1991 Register scratch = r1;
1992 if (property->is_static()) { 1992 if (property->is_static()) {
1993 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor 1993 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor
1994 } else { 1994 } else {
1995 __ ldr(scratch, MemOperand(sp, 0)); // prototype 1995 __ ldr(scratch, MemOperand(sp, 0)); // prototype
1996 } 1996 }
1997 PushOperand(scratch); 1997 PushOperand(scratch);
1998 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1998 EmitPropertyKey(property, lit->GetIdForProperty(i));
1999 1999
2000 // The static prototype property is read only. We handle the non computed 2000 // The static prototype property is read only. We handle the non computed
2001 // property name case in the parser. Since this is the only case where we 2001 // property name case in the parser. Since this is the only case where we
2002 // need to check for an own read only property we special case this so we do 2002 // need to check for an own read only property we special case this so we do
2003 // not need to do this for every property. 2003 // not need to do this for every property.
2004 if (property->is_static() && property->is_computed_name()) { 2004 if (property->is_static() && property->is_computed_name()) {
2005 __ CallRuntime(Runtime::kThrowIfStaticPrototype); 2005 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2006 __ push(r0); 2006 __ push(r0);
2007 } 2007 }
2008 2008
2009 VisitForStackValue(value); 2009 VisitForStackValue(value);
2010 if (NeedsHomeObject(value)) { 2010 if (NeedsHomeObject(value)) {
2011 EmitSetHomeObject(value, 2, property->GetSlot()); 2011 EmitSetHomeObject(value, 2, property->GetSlot());
2012 } 2012 }
2013 2013
2014 switch (property->kind()) { 2014 switch (property->kind()) {
2015 case ObjectLiteral::Property::CONSTANT: 2015 case ClassLiteral::Property::METHOD:
2016 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2017 case ObjectLiteral::Property::PROTOTYPE:
2018 UNREACHABLE();
2019 case ObjectLiteral::Property::COMPUTED:
2020 PushOperand(Smi::FromInt(DONT_ENUM)); 2016 PushOperand(Smi::FromInt(DONT_ENUM));
2021 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); 2017 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2022 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); 2018 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2023 break; 2019 break;
2024 2020
2025 case ObjectLiteral::Property::GETTER: 2021 case ClassLiteral::Property::GETTER:
2026 PushOperand(Smi::FromInt(DONT_ENUM)); 2022 PushOperand(Smi::FromInt(DONT_ENUM));
2027 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 2023 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2028 break; 2024 break;
2029 2025
2030 case ObjectLiteral::Property::SETTER: 2026 case ClassLiteral::Property::SETTER:
2031 PushOperand(Smi::FromInt(DONT_ENUM)); 2027 PushOperand(Smi::FromInt(DONT_ENUM));
2032 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 2028 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2033 break; 2029 break;
2034 2030
2035 default: 2031 default:
2036 UNREACHABLE(); 2032 UNREACHABLE();
2037 } 2033 }
2038 } 2034 }
2039 } 2035 }
2040 2036
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 DCHECK(interrupt_address == 3805 DCHECK(interrupt_address ==
3810 isolate->builtins()->OnStackReplacement()->entry()); 3806 isolate->builtins()->OnStackReplacement()->entry());
3811 return ON_STACK_REPLACEMENT; 3807 return ON_STACK_REPLACEMENT;
3812 } 3808 }
3813 3809
3814 3810
3815 } // namespace internal 3811 } // namespace internal
3816 } // namespace v8 3812 } // namespace v8
3817 3813
3818 #endif // V8_TARGET_ARCH_ARM 3814 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698