OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 } | 1880 } |
1881 context()->Plug(x0); | 1881 context()->Plug(x0); |
1882 } | 1882 } |
1883 | 1883 |
1884 | 1884 |
1885 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 1885 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
1886 for (int i = 0; i < lit->properties()->length(); i++) { | 1886 for (int i = 0; i < lit->properties()->length(); i++) { |
1887 ClassLiteral::Property* property = lit->properties()->at(i); | 1887 ClassLiteral::Property* property = lit->properties()->at(i); |
1888 Expression* value = property->value(); | 1888 Expression* value = property->value(); |
1889 | 1889 |
| 1890 if (property->kind() == ClassLiteral::Property::FIELD && |
| 1891 !property->is_static()) { |
| 1892 // This just does the ToName call on the field name and stores it in a |
| 1893 // variable (a proxy for which is the value() of this property) |
| 1894 DCHECK(property->value()->IsVariableProxy()); |
| 1895 Variable* variable = property->value()->AsVariableProxy()->var(); |
| 1896 VisitForStackValue(property->key()); |
| 1897 EmitVariableAssignment(variable, Token::INIT, |
| 1898 FeedbackVectorSlot::Invalid()); |
| 1899 DropOperands(1); |
| 1900 continue; |
| 1901 } |
| 1902 |
1890 Register scratch = x1; | 1903 Register scratch = x1; |
1891 if (property->is_static()) { | 1904 if (property->is_static()) { |
1892 __ Peek(scratch, kPointerSize); // constructor | 1905 __ Peek(scratch, kPointerSize); // constructor |
1893 } else { | 1906 } else { |
1894 __ Peek(scratch, 0); // prototype | 1907 __ Peek(scratch, 0); // prototype |
1895 } | 1908 } |
1896 PushOperand(scratch); | 1909 PushOperand(scratch); |
1897 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 1910 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
1898 | 1911 |
1899 // The static prototype property is read only. We handle the non computed | 1912 // The static prototype property is read only. We handle the non computed |
(...skipping 21 matching lines...) Expand all Loading... |
1921 PushOperand(Smi::FromInt(DONT_ENUM)); | 1934 PushOperand(Smi::FromInt(DONT_ENUM)); |
1922 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); | 1935 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked); |
1923 break; | 1936 break; |
1924 | 1937 |
1925 case ClassLiteral::Property::SETTER: | 1938 case ClassLiteral::Property::SETTER: |
1926 PushOperand(Smi::FromInt(DONT_ENUM)); | 1939 PushOperand(Smi::FromInt(DONT_ENUM)); |
1927 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); | 1940 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked); |
1928 break; | 1941 break; |
1929 | 1942 |
1930 case ClassLiteral::Property::FIELD: | 1943 case ClassLiteral::Property::FIELD: |
1931 default: | 1944 DCHECK(property->is_static()); |
1932 UNREACHABLE(); | 1945 PushOperand(Smi::FromInt(DONT_ENUM)); |
| 1946 PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); |
| 1947 CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); |
| 1948 break; |
1933 } | 1949 } |
1934 } | 1950 } |
1935 } | 1951 } |
1936 | 1952 |
1937 | 1953 |
1938 void FullCodeGenerator::EmitAssignment(Expression* expr, | 1954 void FullCodeGenerator::EmitAssignment(Expression* expr, |
1939 FeedbackVectorSlot slot) { | 1955 FeedbackVectorSlot slot) { |
1940 DCHECK(expr->IsValidReferenceExpressionOrThis()); | 1956 DCHECK(expr->IsValidReferenceExpressionOrThis()); |
1941 | 1957 |
1942 Property* prop = expr->AsProperty(); | 1958 Property* prop = expr->AsProperty(); |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3808 } | 3824 } |
3809 | 3825 |
3810 return INTERRUPT; | 3826 return INTERRUPT; |
3811 } | 3827 } |
3812 | 3828 |
3813 | 3829 |
3814 } // namespace internal | 3830 } // namespace internal |
3815 } // namespace v8 | 3831 } // namespace v8 |
3816 | 3832 |
3817 #endif // V8_TARGET_ARCH_ARM64 | 3833 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |