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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. | 2232 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. |
2233 { | 2233 { |
2234 Assembler::BlockPoolsScope scope(masm_); | 2234 Assembler::BlockPoolsScope scope(masm_); |
2235 CallIC(code, expr->BinaryOperationFeedbackId()); | 2235 CallIC(code, expr->BinaryOperationFeedbackId()); |
2236 patch_site.EmitPatchInfo(); | 2236 patch_site.EmitPatchInfo(); |
2237 } | 2237 } |
2238 context()->Plug(x0); | 2238 context()->Plug(x0); |
2239 } | 2239 } |
2240 | 2240 |
2241 | 2241 |
2242 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { | 2242 void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit, |
| 2243 int* used_store_slots) { |
2243 // Constructor is in x0. | 2244 // Constructor is in x0. |
2244 DCHECK(lit != NULL); | 2245 DCHECK(lit != NULL); |
2245 __ push(x0); | 2246 __ push(x0); |
2246 | 2247 |
2247 // No access check is needed here since the constructor is created by the | 2248 // No access check is needed here since the constructor is created by the |
2248 // class literal. | 2249 // class literal. |
2249 Register scratch = x1; | 2250 Register scratch = x1; |
2250 __ Ldr(scratch, | 2251 __ Ldr(scratch, |
2251 FieldMemOperand(x0, JSFunction::kPrototypeOrInitialMapOffset)); | 2252 FieldMemOperand(x0, JSFunction::kPrototypeOrInitialMapOffset)); |
2252 __ Push(scratch); | 2253 __ Push(scratch); |
2253 | 2254 |
2254 // store_slot_index points to the vector IC slot for the next store IC used. | |
2255 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots | |
2256 // and must be updated if the number of store ICs emitted here changes. | |
2257 int store_slot_index = 0; | |
2258 for (int i = 0; i < lit->properties()->length(); i++) { | 2255 for (int i = 0; i < lit->properties()->length(); i++) { |
2259 ObjectLiteral::Property* property = lit->properties()->at(i); | 2256 ObjectLiteral::Property* property = lit->properties()->at(i); |
2260 Expression* value = property->value(); | 2257 Expression* value = property->value(); |
2261 | 2258 |
2262 if (property->is_static()) { | 2259 if (property->is_static()) { |
2263 __ Peek(scratch, kPointerSize); // constructor | 2260 __ Peek(scratch, kPointerSize); // constructor |
2264 } else { | 2261 } else { |
2265 __ Peek(scratch, 0); // prototype | 2262 __ Peek(scratch, 0); // prototype |
2266 } | 2263 } |
2267 __ Push(scratch); | 2264 __ Push(scratch); |
2268 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2265 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2269 | 2266 |
2270 // The static prototype property is read only. We handle the non computed | 2267 // The static prototype property is read only. We handle the non computed |
2271 // property name case in the parser. Since this is the only case where we | 2268 // property name case in the parser. Since this is the only case where we |
2272 // need to check for an own read only property we special case this so we do | 2269 // need to check for an own read only property we special case this so we do |
2273 // not need to do this for every property. | 2270 // not need to do this for every property. |
2274 if (property->is_static() && property->is_computed_name()) { | 2271 if (property->is_static() && property->is_computed_name()) { |
2275 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2272 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2276 __ Push(x0); | 2273 __ Push(x0); |
2277 } | 2274 } |
2278 | 2275 |
2279 VisitForStackValue(value); | 2276 VisitForStackValue(value); |
2280 EmitSetHomeObjectIfNeeded(value, 2, | 2277 EmitSetHomeObjectIfNeeded(value, 2, |
2281 lit->SlotForHomeObject(value, &store_slot_index)); | 2278 lit->SlotForHomeObject(value, used_store_slots)); |
2282 | 2279 |
2283 switch (property->kind()) { | 2280 switch (property->kind()) { |
2284 case ObjectLiteral::Property::CONSTANT: | 2281 case ObjectLiteral::Property::CONSTANT: |
2285 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2282 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2286 case ObjectLiteral::Property::PROTOTYPE: | 2283 case ObjectLiteral::Property::PROTOTYPE: |
2287 UNREACHABLE(); | 2284 UNREACHABLE(); |
2288 case ObjectLiteral::Property::COMPUTED: | 2285 case ObjectLiteral::Property::COMPUTED: |
2289 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2286 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2290 break; | 2287 break; |
2291 | 2288 |
(...skipping 12 matching lines...) Expand all Loading... |
2304 default: | 2301 default: |
2305 UNREACHABLE(); | 2302 UNREACHABLE(); |
2306 } | 2303 } |
2307 } | 2304 } |
2308 | 2305 |
2309 // prototype | 2306 // prototype |
2310 __ CallRuntime(Runtime::kToFastProperties, 1); | 2307 __ CallRuntime(Runtime::kToFastProperties, 1); |
2311 | 2308 |
2312 // constructor | 2309 // constructor |
2313 __ CallRuntime(Runtime::kToFastProperties, 1); | 2310 __ CallRuntime(Runtime::kToFastProperties, 1); |
2314 | |
2315 // Verify that compilation exactly consumed the number of store ic slots that | |
2316 // the ClassLiteral node had to offer. | |
2317 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); | |
2318 } | 2311 } |
2319 | 2312 |
2320 | 2313 |
2321 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2314 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2322 FeedbackVectorICSlot slot) { | 2315 FeedbackVectorICSlot slot) { |
2323 DCHECK(expr->IsValidReferenceExpression()); | 2316 DCHECK(expr->IsValidReferenceExpression()); |
2324 | 2317 |
2325 Property* prop = expr->AsProperty(); | 2318 Property* prop = expr->AsProperty(); |
2326 LhsKind assign_type = Property::GetAssignType(prop); | 2319 LhsKind assign_type = Property::GetAssignType(prop); |
2327 | 2320 |
(...skipping 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5585 } | 5578 } |
5586 | 5579 |
5587 return INTERRUPT; | 5580 return INTERRUPT; |
5588 } | 5581 } |
5589 | 5582 |
5590 | 5583 |
5591 } // namespace internal | 5584 } // namespace internal |
5592 } // namespace v8 | 5585 } // namespace v8 |
5593 | 5586 |
5594 #endif // V8_TARGET_ARCH_ARM64 | 5587 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |