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

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

Issue 2330473002: Class fields, part 3 (backends)
Patch Set: clean up test properly 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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ClassLiteral::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 if (property->kind() == ClassLiteral::Property::FIELD &&
1990 !property->is_static()) {
1991 // This just does the ToName call on the field name and stores it in a
1992 // variable (a proxy for which is the value() of this property)
1993 DCHECK(property->value()->IsVariableProxy());
1994 Variable* variable = property->value()->AsVariableProxy()->var();
1995 VisitForStackValue(property->key());
1996 EmitVariableAssignment(variable, Token::INIT,
1997 FeedbackVectorSlot::Invalid());
1998 DropOperands(1);
1999 continue;
2000 }
2001
1989 Register scratch = r1; 2002 Register scratch = r1;
1990 if (property->is_static()) { 2003 if (property->is_static()) {
1991 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor 2004 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor
1992 } else { 2005 } else {
1993 __ ldr(scratch, MemOperand(sp, 0)); // prototype 2006 __ ldr(scratch, MemOperand(sp, 0)); // prototype
1994 } 2007 }
1995 PushOperand(scratch); 2008 PushOperand(scratch);
1996 EmitPropertyKey(property, lit->GetIdForProperty(i)); 2009 EmitPropertyKey(property, lit->GetIdForProperty(i));
1997 2010
1998 // The static prototype property is read only. We handle the non computed 2011 // The static prototype property is read only. We handle the non computed
(...skipping 21 matching lines...) Expand all
2020 PushOperand(Smi::FromInt(DONT_ENUM)); 2033 PushOperand(Smi::FromInt(DONT_ENUM));
2021 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); 2034 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2022 break; 2035 break;
2023 2036
2024 case ClassLiteral::Property::SETTER: 2037 case ClassLiteral::Property::SETTER:
2025 PushOperand(Smi::FromInt(DONT_ENUM)); 2038 PushOperand(Smi::FromInt(DONT_ENUM));
2026 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); 2039 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2027 break; 2040 break;
2028 2041
2029 case ClassLiteral::Property::FIELD: 2042 case ClassLiteral::Property::FIELD:
2030 default: 2043 DCHECK(property->is_static());
2031 UNREACHABLE(); 2044 PushOperand(Smi::FromInt(DONT_ENUM));
2045 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2046 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2047 break;
2032 } 2048 }
2033 } 2049 }
2034 } 2050 }
2035 2051
2036 2052
2037 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2053 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2038 PopOperand(r1); 2054 PopOperand(r1);
2039 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2055 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2040 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2056 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2041 CallIC(code, expr->BinaryOperationFeedbackId()); 2057 CallIC(code, expr->BinaryOperationFeedbackId());
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 DCHECK(interrupt_address == 3814 DCHECK(interrupt_address ==
3799 isolate->builtins()->OnStackReplacement()->entry()); 3815 isolate->builtins()->OnStackReplacement()->entry());
3800 return ON_STACK_REPLACEMENT; 3816 return ON_STACK_REPLACEMENT;
3801 } 3817 }
3802 3818
3803 3819
3804 } // namespace internal 3820 } // namespace internal
3805 } // namespace v8 3821 } // namespace v8
3806 3822
3807 #endif // V8_TARGET_ARCH_ARM 3823 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698