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/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 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 { | 2044 { |
2045 Assembler::BlockPoolsScope scope(masm_); | 2045 Assembler::BlockPoolsScope scope(masm_); |
2046 CallIC(code, expr->BinaryOperationFeedbackId()); | 2046 CallIC(code, expr->BinaryOperationFeedbackId()); |
2047 patch_site.EmitPatchInfo(); | 2047 patch_site.EmitPatchInfo(); |
2048 } | 2048 } |
2049 context()->Plug(x0); | 2049 context()->Plug(x0); |
2050 } | 2050 } |
2051 | 2051 |
2052 | 2052 |
2053 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2053 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { |
2054 // Constructor is in x0. | |
2055 DCHECK(lit != NULL); | |
2056 __ push(x0); | |
2057 | |
2058 // No access check is needed here since the constructor is created by the | |
2059 // class literal. | |
2060 Register scratch = x1; | |
2061 __ Ldr(scratch, | |
2062 FieldMemOperand(x0, JSFunction::kPrototypeOrInitialMapOffset)); | |
2063 __ Push(scratch); | |
2064 | |
2065 for (int i = 0; i < lit->properties()->length(); i++) { | 2054 for (int i = 0; i < lit->properties()->length(); i++) { |
2066 ObjectLiteral::Property* property = lit->properties()->at(i); | 2055 ObjectLiteral::Property* property = lit->properties()->at(i); |
2067 Expression* value = property->value(); | 2056 Expression* value = property->value(); |
2068 | 2057 |
| 2058 Register scratch = x1; |
2069 if (property->is_static()) { | 2059 if (property->is_static()) { |
2070 __ Peek(scratch, kPointerSize); // constructor | 2060 __ Peek(scratch, kPointerSize); // constructor |
2071 } else { | 2061 } else { |
2072 __ Peek(scratch, 0); // prototype | 2062 __ Peek(scratch, 0); // prototype |
2073 } | 2063 } |
2074 __ Push(scratch); | 2064 __ Push(scratch); |
2075 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2065 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2076 | 2066 |
2077 // The static prototype property is read only. We handle the non computed | 2067 // The static prototype property is read only. We handle the non computed |
2078 // property name case in the parser. Since this is the only case where we | 2068 // property name case in the parser. Since this is the only case where we |
(...skipping 27 matching lines...) Expand all Loading... |
2106 | 2096 |
2107 case ObjectLiteral::Property::SETTER: | 2097 case ObjectLiteral::Property::SETTER: |
2108 __ Push(Smi::FromInt(DONT_ENUM)); | 2098 __ Push(Smi::FromInt(DONT_ENUM)); |
2109 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); | 2099 __ CallRuntime(Runtime::kDefineSetterPropertyUnchecked); |
2110 break; | 2100 break; |
2111 | 2101 |
2112 default: | 2102 default: |
2113 UNREACHABLE(); | 2103 UNREACHABLE(); |
2114 } | 2104 } |
2115 } | 2105 } |
2116 | |
2117 // Set both the prototype and constructor to have fast properties, and also | |
2118 // freeze them in strong mode. | |
2119 __ CallRuntime(Runtime::kFinalizeClassDefinition); | |
2120 } | 2106 } |
2121 | 2107 |
2122 | 2108 |
2123 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2109 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2124 FeedbackVectorSlot slot) { | 2110 FeedbackVectorSlot slot) { |
2125 DCHECK(expr->IsValidReferenceExpressionOrThis()); | 2111 DCHECK(expr->IsValidReferenceExpressionOrThis()); |
2126 | 2112 |
2127 Property* prop = expr->AsProperty(); | 2113 Property* prop = expr->AsProperty(); |
2128 LhsKind assign_type = Property::GetAssignType(prop); | 2114 LhsKind assign_type = Property::GetAssignType(prop); |
2129 | 2115 |
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4730 } | 4716 } |
4731 | 4717 |
4732 return INTERRUPT; | 4718 return INTERRUPT; |
4733 } | 4719 } |
4734 | 4720 |
4735 | 4721 |
4736 } // namespace internal | 4722 } // namespace internal |
4737 } // namespace v8 | 4723 } // namespace v8 |
4738 | 4724 |
4739 #endif // V8_TARGET_ARCH_ARM64 | 4725 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |