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

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: minor 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 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 break; 1996 break;
1997 default: 1997 default:
1998 UNREACHABLE(); 1998 UNREACHABLE();
1999 } 1999 }
2000 2000
2001 __ bind(&done); 2001 __ bind(&done);
2002 context()->Plug(r0); 2002 context()->Plug(r0);
2003 } 2003 }
2004 2004
2005 2005
2006 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2007 for (int i = 0; i < lit->properties()->length(); i++) {
2008 ObjectLiteral::Property* property = lit->properties()->at(i);
2009 Expression* value = property->value();
2010
2011 Register scratch = r1;
2012 if (property->is_static()) {
2013 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor
2014 } else {
2015 __ ldr(scratch, MemOperand(sp, 0)); // prototype
2016 }
2017 PushOperand(scratch);
2018 EmitPropertyKey(property, lit->GetIdForProperty(i));
2019
2020 // The static prototype property is read only. We handle the non computed
2021 // property name case in the parser. Since this is the only case where we
2022 // need to check for an own read only property we special case this so we do
2023 // not need to do this for every property.
2024 if (property->is_static() && property->is_computed_name()) {
2025 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2026 __ push(r0);
2027 }
2028
2029 VisitForStackValue(value);
2030 if (NeedsHomeObject(value)) {
2031 EmitSetHomeObject(value, 2, property->GetSlot());
2032 }
2033
2034 switch (property->kind()) {
2035 case ObjectLiteral::Property::CONSTANT:
2036 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2037 case ObjectLiteral::Property::PROTOTYPE:
2038 UNREACHABLE();
2039 case ObjectLiteral::Property::COMPUTED:
2040 PushOperand(Smi::FromInt(DONT_ENUM));
2041 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2042 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2043 break;
2044
2045 case ObjectLiteral::Property::GETTER:
2046 PushOperand(Smi::FromInt(DONT_ENUM));
2047 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2048 break;
2049
2050 case ObjectLiteral::Property::SETTER:
2051 PushOperand(Smi::FromInt(DONT_ENUM));
2052 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2053 break;
2054
2055 default:
2056 UNREACHABLE();
2057 }
2058 }
2059 }
2060
2061
2062 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2006 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2063 PopOperand(r1); 2007 PopOperand(r1);
2064 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2008 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2065 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2009 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2066 CallIC(code, expr->BinaryOperationFeedbackId()); 2010 CallIC(code, expr->BinaryOperationFeedbackId());
2067 patch_site.EmitPatchInfo(); 2011 patch_site.EmitPatchInfo();
2068 context()->Plug(r0); 2012 context()->Plug(r0);
2069 } 2013 }
2070 2014
2071 2015
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3845 DCHECK(interrupt_address == 3789 DCHECK(interrupt_address ==
3846 isolate->builtins()->OnStackReplacement()->entry()); 3790 isolate->builtins()->OnStackReplacement()->entry());
3847 return ON_STACK_REPLACEMENT; 3791 return ON_STACK_REPLACEMENT;
3848 } 3792 }
3849 3793
3850 3794
3851 } // namespace internal 3795 } // namespace internal
3852 } // namespace v8 3796 } // namespace v8
3853 3797
3854 #endif // V8_TARGET_ARCH_ARM 3798 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698