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

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 break; 1997 break;
1998 default: 1998 default:
1999 UNREACHABLE(); 1999 UNREACHABLE();
2000 } 2000 }
2001 2001
2002 __ bind(&done); 2002 __ bind(&done);
2003 context()->Plug(v0); 2003 context()->Plug(v0);
2004 } 2004 }
2005 2005
2006 2006
2007 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) {
2008 for (int i = 0; i < lit->properties()->length(); i++) {
2009 ObjectLiteral::Property* property = lit->properties()->at(i);
2010 Expression* value = property->value();
2011
2012 Register scratch = a1;
2013 if (property->is_static()) {
2014 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor
2015 } else {
2016 __ lw(scratch, MemOperand(sp, 0)); // prototype
2017 }
2018 PushOperand(scratch);
2019 EmitPropertyKey(property, lit->GetIdForProperty(i));
2020
2021 // The static prototype property is read only. We handle the non computed
2022 // property name case in the parser. Since this is the only case where we
2023 // need to check for an own read only property we special case this so we do
2024 // not need to do this for every property.
2025 if (property->is_static() && property->is_computed_name()) {
2026 __ CallRuntime(Runtime::kThrowIfStaticPrototype);
2027 __ push(v0);
2028 }
2029
2030 VisitForStackValue(value);
2031 if (NeedsHomeObject(value)) {
2032 EmitSetHomeObject(value, 2, property->GetSlot());
2033 }
2034
2035 switch (property->kind()) {
2036 case ObjectLiteral::Property::CONSTANT:
2037 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
2038 case ObjectLiteral::Property::PROTOTYPE:
2039 UNREACHABLE();
2040 case ObjectLiteral::Property::COMPUTED:
2041 PushOperand(Smi::FromInt(DONT_ENUM));
2042 PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
2043 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
2044 break;
2045
2046 case ObjectLiteral::Property::GETTER:
2047 PushOperand(Smi::FromInt(DONT_ENUM));
2048 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
2049 break;
2050
2051 case ObjectLiteral::Property::SETTER:
2052 PushOperand(Smi::FromInt(DONT_ENUM));
2053 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
2054 break;
2055
2056 default:
2057 UNREACHABLE();
2058 }
2059 }
2060 }
2061
2062
2063 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { 2007 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) {
2064 __ mov(a0, result_register()); 2008 __ mov(a0, result_register());
2065 PopOperand(a1); 2009 PopOperand(a1);
2066 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); 2010 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code();
2067 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 2011 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
2068 CallIC(code, expr->BinaryOperationFeedbackId()); 2012 CallIC(code, expr->BinaryOperationFeedbackId());
2069 patch_site.EmitPatchInfo(); 2013 patch_site.EmitPatchInfo();
2070 context()->Plug(v0); 2014 context()->Plug(v0);
2071 } 2015 }
2072 2016
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 reinterpret_cast<uint32_t>( 3730 reinterpret_cast<uint32_t>(
3787 isolate->builtins()->OnStackReplacement()->entry())); 3731 isolate->builtins()->OnStackReplacement()->entry()));
3788 return ON_STACK_REPLACEMENT; 3732 return ON_STACK_REPLACEMENT;
3789 } 3733 }
3790 3734
3791 3735
3792 } // namespace internal 3736 } // namespace internal
3793 } // namespace v8 3737 } // namespace v8
3794 3738
3795 #endif // V8_TARGET_ARCH_MIPS 3739 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698