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

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

Issue 2142333002: Refactor class declaration logic to the parser and runtime Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup per Adam Created 4 years, 5 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/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 break; 1991 break;
1992 default: 1992 default:
1993 UNREACHABLE(); 1993 UNREACHABLE();
1994 } 1994 }
1995 1995
1996 __ bind(&done); 1996 __ bind(&done);
1997 context()->Plug(r0); 1997 context()->Plug(r0);
1998 } 1998 }
1999 1999
2000 2000
2001 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2002 for (int i = 0; i < lit->properties()->length(); i++) {
2003 ObjectLiteral::Property* property = lit->properties()->at(i);
2004 Expression* value = property->value();
2005
2006 Register scratch = r1;
2007 if (property->is_static()) {
2008 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor
2009 } else {
2010 __ ldr(scratch, MemOperand(sp, 0)); // prototype
2011 }
2012 PushOperand(scratch);
2013 EmitPropertyKey(property, lit->GetIdForProperty(i));
2014
2015 // The static prototype property is read only. We handle the non computed
2016 // property name case in the parser. Since this is the only case where we
2017 // need to check for an own read only property we special case this so we do
2018 // not need to do this for every property.
2019 if (property->is_static() && property->is_computed_name()) {
2020 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2021 __ push(r0);
2022 }
2023
2024 VisitForStackValue(value);
2025 if (NeedsHomeObject(value)) {
2026 EmitSetHomeObject(value, 2, property->GetSlot());
2027 }
2028
2029 switch (property->kind()) {
2030 case ObjectLiteral::Property::CONSTANT:
2031 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2032 case ObjectLiteral::Property::PROTOTYPE:
2033 UNREACHABLE();
2034 case ObjectLiteral::Property::COMPUTED:
2035 PushOperand(Smi::FromInt(DONT_ENUM));
2036 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2037 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2038 break;
2039
2040 case ObjectLiteral::Property::GETTER:
2041 PushOperand(Smi::FromInt(DONT_ENUM));
2042 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2043 break;
2044
2045 case ObjectLiteral::Property::SETTER:
2046 PushOperand(Smi::FromInt(DONT_ENUM));
2047 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2048 break;
2049
2050 default:
2051 UNREACHABLE();
2052 }
2053 }
2054 }
2055
2056
2057 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2001 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2058 PopOperand(r1); 2002 PopOperand(r1);
2059 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2003 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2060 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2004 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2061 CallIC(code, expr->BinaryOperationFeedbackId()); 2005 CallIC(code, expr->BinaryOperationFeedbackId());
2062 patch_site.EmitPatchInfo(); 2006 patch_site.EmitPatchInfo();
2063 context()->Plug(r0); 2007 context()->Plug(r0);
2064 } 2008 }
2065 2009
2066 2010
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3840 DCHECK(interrupt_address == 3784 DCHECK(interrupt_address ==
3841 isolate->builtins()->OnStackReplacement()->entry()); 3785 isolate->builtins()->OnStackReplacement()->entry());
3842 return ON_STACK_REPLACEMENT; 3786 return ON_STACK_REPLACEMENT;
3843 } 3787 }
3844 3788
3845 3789
3846 } // namespace internal 3790 } // namespace internal
3847 } // namespace v8 3791 } // namespace v8
3848 3792
3849 #endif // V8_TARGET_ARCH_ARM 3793 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698