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

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: 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_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/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 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 UNREACHABLE(); 1976 UNREACHABLE();
1977 } 1977 }
1978 1978
1979 __ bind(&done); 1979 __ bind(&done);
1980 context()->Plug(r0); 1980 context()->Plug(r0);
1981 } 1981 }
1982 1982
1983 1983
1984 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { 1984 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
1985 for (int i = 0; i < lit->properties()->length(); i++) { 1985 for (int i = 0; i < lit->properties()->length(); i++) {
1986 ObjectLiteral::Property* property = lit->properties()->at(i); 1986 ClassLiteral::Property* property = lit->properties()->at(i);
1987 Expression* value = property->value(); 1987 Expression* value = property->value();
1988 1988
1989 Register scratch = r1; 1989 Register scratch = r1;
1990 if (property->is_static()) { 1990 if (property->is_static()) {
1991 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor 1991 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor
1992 } else { 1992 } else {
1993 __ ldr(scratch, MemOperand(sp, 0)); // prototype 1993 __ ldr(scratch, MemOperand(sp, 0)); // prototype
1994 } 1994 }
1995 PushOperand(scratch); 1995 PushOperand(scratch);
1996 EmitPropertyKey(property, lit->GetIdForProperty(i)); 1996 EmitPropertyKey(property, lit->GetIdForProperty(i));
1997 1997
1998 // The static prototype property is read only. We handle the non computed 1998 // The static prototype property is read only. We handle the non computed
1999 // property name case in the parser. Since this is the only case where we 1999 // property name case in the parser. Since this is the only case where we
2000 // need to check for an own read only property we special case this so we do 2000 // need to check for an own read only property we special case this so we do
2001 // not need to do this for every property. 2001 // not need to do this for every property.
2002 if (property->is_static() && property->is_computed_name()) { 2002 if (property->is_static() && property->is_computed_name()) {
2003 __ CallRuntime(Runtime::kThrowIfStaticPrototype); 2003 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2004 __ push(r0); 2004 __ push(r0);
2005 } 2005 }
2006 2006
2007 VisitForStackValue(value); 2007 VisitForStackValue(value);
2008 if (NeedsHomeObject(value)) { 2008 if (NeedsHomeObject(value)) {
2009 EmitSetHomeObject(value, 2, property->GetSlot()); 2009 EmitSetHomeObject(value, 2, property->GetSlot());
2010 } 2010 }
2011 2011
2012 switch (property->kind()) { 2012 switch (property->kind()) {
2013 case ObjectLiteral::Property::CONSTANT: 2013 case ClassLiteral::Property::METHOD:
2014 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2015 case ObjectLiteral::Property::PROTOTYPE:
2016 UNREACHABLE();
2017 case ObjectLiteral::Property::COMPUTED:
2018 PushOperand(Smi::FromInt(DONT_ENUM)); 2014 PushOperand(Smi::FromInt(DONT_ENUM));
2019 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); 2015 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2020 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); 2016 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2021 break; 2017 break;
2022 2018
2023 case ObjectLiteral::Property::GETTER: 2019 case ClassLiteral::Property::GETTER:
2024 PushOperand(Smi::FromInt(DONT_ENUM)); 2020 PushOperand(Smi::FromInt(DONT_ENUM));
2025 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 2021 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2026 break; 2022 break;
2027 2023
2028 case ObjectLiteral::Property::SETTER: 2024 case ClassLiteral::Property::SETTER:
2029 PushOperand(Smi::FromInt(DONT_ENUM)); 2025 PushOperand(Smi::FromInt(DONT_ENUM));
2030 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 2026 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2031 break; 2027 break;
2032 2028
2033 default: 2029 default:
2034 UNREACHABLE(); 2030 UNREACHABLE();
2035 } 2031 }
2036 } 2032 }
2037 } 2033 }
2038 2034
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
3801 DCHECK(interrupt_address == 3797 DCHECK(interrupt_address ==
3802 isolate->builtins()->OnStackReplacement()->entry()); 3798 isolate->builtins()->OnStackReplacement()->entry());
3803 return ON_STACK_REPLACEMENT; 3799 return ON_STACK_REPLACEMENT;
3804 } 3800 }
3805 3801
3806 3802
3807 } // namespace internal 3803 } // namespace internal
3808 } // namespace v8 3804 } // namespace v8
3809 3805
3810 #endif // V8_TARGET_ARCH_ARM 3806 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/compiler/ast-loop-assignment-analyzer.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698