OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 | 1942 |
1943 __ bind(&done); | 1943 __ bind(&done); |
1944 context()->Plug(r2); | 1944 context()->Plug(r2); |
1945 } | 1945 } |
1946 | 1946 |
1947 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 1947 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
1948 for (int i = 0; i < lit->properties()->length(); i++) { | 1948 for (int i = 0; i < lit->properties()->length(); i++) { |
1949 ClassLiteral::Property* property = lit->properties()->at(i); | 1949 ClassLiteral::Property* property = lit->properties()->at(i); |
1950 Expression* value = property->value(); | 1950 Expression* value = property->value(); |
1951 | 1951 |
| 1952 if (property->kind() == ClassLiteral::Property::FIELD && |
| 1953 !property->is_static()) { |
| 1954 // Non-static properties produced by the parser have as their 'key' an |
| 1955 // expression producing their name and as their 'value' a variable which |
| 1956 // is refered to by the synthetic initializer function in order to |
| 1957 // determine the name during class instantiation. This is necessary |
| 1958 // because computed names must only be evaluated once, at class definition |
| 1959 // time. |
| 1960 // That is, code which looks like `class C { [f()] = 1; }` is desugared |
| 1961 // into something like |
| 1962 // class C { constructor(){ this.[.class-field-0-name] = 1; } }; |
| 1963 // let .class-field-0-name = f(); |
| 1964 // except that the assignment to .class-field-name-0 occurs interleaved |
| 1965 // with the rest of the class body; it is performed by the block in which |
| 1966 // this comment appears. |
| 1967 DCHECK(property->value()->IsVariableProxy()); |
| 1968 Variable* variable = property->value()->AsVariableProxy()->var(); |
| 1969 VisitForStackValue(property->key()); |
| 1970 EmitVariableAssignment(variable, Token::INIT, |
| 1971 FeedbackVectorSlot::Invalid()); |
| 1972 DropOperands(1); |
| 1973 continue; |
| 1974 } |
| 1975 |
1952 Register scratch = r3; | 1976 Register scratch = r3; |
1953 if (property->is_static()) { | 1977 if (property->is_static()) { |
1954 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor | 1978 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor |
1955 } else { | 1979 } else { |
1956 __ LoadP(scratch, MemOperand(sp, 0)); // prototype | 1980 __ LoadP(scratch, MemOperand(sp, 0)); // prototype |
1957 } | 1981 } |
1958 PushOperand(scratch); | 1982 PushOperand(scratch); |
1959 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 1983 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
1960 | 1984 |
1961 // The static prototype property is read only. We handle the non computed | 1985 // The static prototype property is read only. We handle the non computed |
(...skipping 21 matching lines...) Expand all Loading... |
1983 PushOperand(Smi::FromInt(DONT_ENUM)); | 2007 PushOperand(Smi::FromInt(DONT_ENUM)); |
1984 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | 2008 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); |
1985 break; | 2009 break; |
1986 | 2010 |
1987 case ClassLiteral::Property::SETTER: | 2011 case ClassLiteral::Property::SETTER: |
1988 PushOperand(Smi::FromInt(DONT_ENUM)); | 2012 PushOperand(Smi::FromInt(DONT_ENUM)); |
1989 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | 2013 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); |
1990 break; | 2014 break; |
1991 | 2015 |
1992 case ClassLiteral::Property::FIELD: | 2016 case ClassLiteral::Property::FIELD: |
1993 default: | 2017 DCHECK(property->is_static()); |
1994 UNREACHABLE(); | 2018 PushOperand(Smi::FromInt(DONT_ENUM)); |
| 2019 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); |
| 2020 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); |
| 2021 break; |
1995 } | 2022 } |
1996 } | 2023 } |
1997 } | 2024 } |
1998 | 2025 |
1999 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2026 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2000 PopOperand(r3); | 2027 PopOperand(r3); |
2001 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); | 2028 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
2002 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2029 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2003 CallIC(code, expr->BinaryOperationFeedbackId()); | 2030 CallIC(code, expr->BinaryOperationFeedbackId()); |
2004 patch_site.EmitPatchInfo(); | 2031 patch_site.EmitPatchInfo(); |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3632 DCHECK(kOSRBranchInstruction == br_instr); | 3659 DCHECK(kOSRBranchInstruction == br_instr); |
3633 | 3660 |
3634 DCHECK(interrupt_address == | 3661 DCHECK(interrupt_address == |
3635 isolate->builtins()->OnStackReplacement()->entry()); | 3662 isolate->builtins()->OnStackReplacement()->entry()); |
3636 return ON_STACK_REPLACEMENT; | 3663 return ON_STACK_REPLACEMENT; |
3637 } | 3664 } |
3638 | 3665 |
3639 } // namespace internal | 3666 } // namespace internal |
3640 } // namespace v8 | 3667 } // namespace v8 |
3641 #endif // V8_TARGET_ARCH_S390 | 3668 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |