| OLD | NEW |
| 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 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 __ bind(&done); | 1982 __ bind(&done); |
| 1983 context()->Plug(v0); | 1983 context()->Plug(v0); |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 | 1986 |
| 1987 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 1987 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
| 1988 for (int i = 0; i < lit->properties()->length(); i++) { | 1988 for (int i = 0; i < lit->properties()->length(); i++) { |
| 1989 ClassLiteral::Property* property = lit->properties()->at(i); | 1989 ClassLiteral::Property* property = lit->properties()->at(i); |
| 1990 Expression* value = property->value(); | 1990 Expression* value = property->value(); |
| 1991 | 1991 |
| 1992 if (property->kind() == ClassLiteral::Property::FIELD && |
| 1993 !property->is_static()) { |
| 1994 // Non-static properties produced by the parser have as their 'key' an |
| 1995 // expression producing their name and as their 'value' a variable which |
| 1996 // is refered to by the synthetic initializer function in order to |
| 1997 // determine the name during class instantiation. This is necessary |
| 1998 // because computed names must only be evaluated once, at class definition |
| 1999 // time. |
| 2000 // That is, code which looks like `class C { [f()] = 1; }` is desugared |
| 2001 // into something like |
| 2002 // class C { constructor(){ this.[.class-field-0-name] = 1; } }; |
| 2003 // let .class-field-0-name = f(); |
| 2004 // except that the assignment to .class-field-name-0 occurs interleaved |
| 2005 // with the rest of the class body; it is performed by the block in which |
| 2006 // this comment appears. |
| 2007 DCHECK(property->value()->IsVariableProxy()); |
| 2008 Variable* variable = property->value()->AsVariableProxy()->var(); |
| 2009 VisitForStackValue(property->key()); |
| 2010 EmitVariableAssignment(variable, Token::INIT, |
| 2011 FeedbackVectorSlot::Invalid()); |
| 2012 DropOperands(1); |
| 2013 continue; |
| 2014 } |
| 2015 |
| 1992 Register scratch = a1; | 2016 Register scratch = a1; |
| 1993 if (property->is_static()) { | 2017 if (property->is_static()) { |
| 1994 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor | 2018 __ lw(scratch, MemOperand(sp, kPointerSize)); // constructor |
| 1995 } else { | 2019 } else { |
| 1996 __ lw(scratch, MemOperand(sp, 0)); // prototype | 2020 __ lw(scratch, MemOperand(sp, 0)); // prototype |
| 1997 } | 2021 } |
| 1998 PushOperand(scratch); | 2022 PushOperand(scratch); |
| 1999 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2023 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
| 2000 | 2024 |
| 2001 // The static prototype property is read only. We handle the non computed | 2025 // The static prototype property is read only. We handle the non computed |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2023 PushOperand(Smi::FromInt(DONT_ENUM)); | 2047 PushOperand(Smi::FromInt(DONT_ENUM)); |
| 2024 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | 2048 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); |
| 2025 break; | 2049 break; |
| 2026 | 2050 |
| 2027 case ClassLiteral::Property::SETTER: | 2051 case ClassLiteral::Property::SETTER: |
| 2028 PushOperand(Smi::FromInt(DONT_ENUM)); | 2052 PushOperand(Smi::FromInt(DONT_ENUM)); |
| 2029 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | 2053 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); |
| 2030 break; | 2054 break; |
| 2031 | 2055 |
| 2032 case ClassLiteral::Property::FIELD: | 2056 case ClassLiteral::Property::FIELD: |
| 2033 default: | 2057 DCHECK(property->is_static()); |
| 2034 UNREACHABLE(); | 2058 PushOperand(Smi::FromInt(DONT_ENUM)); |
| 2059 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); |
| 2060 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); |
| 2061 break; |
| 2035 } | 2062 } |
| 2036 } | 2063 } |
| 2037 } | 2064 } |
| 2038 | 2065 |
| 2039 | 2066 |
| 2040 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2067 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2041 __ mov(a0, result_register()); | 2068 __ mov(a0, result_register()); |
| 2042 PopOperand(a1); | 2069 PopOperand(a1); |
| 2043 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 2070 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
| 2044 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2071 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3739 reinterpret_cast<uint32_t>( | 3766 reinterpret_cast<uint32_t>( |
| 3740 isolate->builtins()->OnStackReplacement()->entry())); | 3767 isolate->builtins()->OnStackReplacement()->entry())); |
| 3741 return ON_STACK_REPLACEMENT; | 3768 return ON_STACK_REPLACEMENT; |
| 3742 } | 3769 } |
| 3743 | 3770 |
| 3744 | 3771 |
| 3745 } // namespace internal | 3772 } // namespace internal |
| 3746 } // namespace v8 | 3773 } // namespace v8 |
| 3747 | 3774 |
| 3748 #endif // V8_TARGET_ARCH_MIPS | 3775 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |