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

Side by Side Diff: src/full-codegen/ppc/full-codegen-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 break; 1999 break;
2000 default: 2000 default:
2001 UNREACHABLE(); 2001 UNREACHABLE();
2002 } 2002 }
2003 2003
2004 __ bind(&done); 2004 __ bind(&done);
2005 context()->Plug(r3); 2005 context()->Plug(r3);
2006 } 2006 }
2007 2007
2008 2008
2009 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2010 for (int i = 0; i < lit->properties()->length(); i++) {
2011 ObjectLiteral::Property* property = lit->properties()->at(i);
2012 Expression* value = property->value();
2013
2014 Register scratch = r4;
2015 if (property->is_static()) {
2016 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor
2017 } else {
2018 __ LoadP(scratch, MemOperand(sp, 0)); // prototype
2019 }
2020 PushOperand(scratch);
2021 EmitPropertyKey(property, lit->GetIdForProperty(i));
2022
2023 // The static prototype property is read only. We handle the non computed
2024 // property name case in the parser. Since this is the only case where we
2025 // need to check for an own read only property we special case this so we do
2026 // not need to do this for every property.
2027 if (property->is_static() && property->is_computed_name()) {
2028 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2029 __ push(r3);
2030 }
2031
2032 VisitForStackValue(value);
2033 if (NeedsHomeObject(value)) {
2034 EmitSetHomeObject(value, 2, property->GetSlot());
2035 }
2036
2037 switch (property->kind()) {
2038 case ObjectLiteral::Property::CONSTANT:
2039 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2040 case ObjectLiteral::Property::PROTOTYPE:
2041 UNREACHABLE();
2042 case ObjectLiteral::Property::COMPUTED:
2043 PushOperand(Smi::FromInt(DONT_ENUM));
2044 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2045 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2046 break;
2047
2048 case ObjectLiteral::Property::GETTER:
2049 PushOperand(Smi::FromInt(DONT_ENUM));
2050 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2051 break;
2052
2053 case ObjectLiteral::Property::SETTER:
2054 PushOperand(Smi::FromInt(DONT_ENUM));
2055 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2056 break;
2057
2058 default:
2059 UNREACHABLE();
2060 }
2061 }
2062 }
2063
2064
2065 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2009 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2066 PopOperand(r4); 2010 PopOperand(r4);
2067 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2011 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2068 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2012 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2069 CallIC(code, expr->BinaryOperationFeedbackId()); 2013 CallIC(code, expr->BinaryOperationFeedbackId());
2070 patch_site.EmitPatchInfo(); 2014 patch_site.EmitPatchInfo();
2071 context()->Plug(r3); 2015 context()->Plug(r3);
2072 } 2016 }
2073 2017
2074 2018
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 3710
3767 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); 3711 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address)));
3768 3712
3769 DCHECK(interrupt_address == 3713 DCHECK(interrupt_address ==
3770 isolate->builtins()->OnStackReplacement()->entry()); 3714 isolate->builtins()->OnStackReplacement()->entry());
3771 return ON_STACK_REPLACEMENT; 3715 return ON_STACK_REPLACEMENT;
3772 } 3716 }
3773 } // namespace internal 3717 } // namespace internal
3774 } // namespace v8 3718 } // namespace v8
3775 #endif // V8_TARGET_ARCH_PPC 3719 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698