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 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 __ CallStub(&stub); | 1645 __ CallStub(&stub); |
1646 } | 1646 } |
1647 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1647 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1648 | 1648 |
1649 // If result_saved is true the result is on top of the stack. If | 1649 // If result_saved is true the result is on top of the stack. If |
1650 // result_saved is false the result is in x0. | 1650 // result_saved is false the result is in x0. |
1651 bool result_saved = false; | 1651 bool result_saved = false; |
1652 | 1652 |
1653 AccessorTable accessor_table(zone()); | 1653 AccessorTable accessor_table(zone()); |
1654 int property_index = 0; | 1654 int property_index = 0; |
1655 // store_slot_index points to the vector ic slot for the next store ic used. | 1655 // store_slot_index points to the vector IC slot for the next store IC used. |
1656 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots | 1656 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots |
1657 // and must be updated if the number of store ics emitted here changes. | 1657 // and must be updated if the number of store ICs emitted here changes. |
1658 int store_slot_index = 0; | 1658 int store_slot_index = 0; |
1659 for (; property_index < expr->properties()->length(); property_index++) { | 1659 for (; property_index < expr->properties()->length(); property_index++) { |
1660 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1660 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
1661 if (property->is_computed_name()) break; | 1661 if (property->is_computed_name()) break; |
1662 if (property->IsCompileTimeValue()) continue; | 1662 if (property->IsCompileTimeValue()) continue; |
1663 | 1663 |
1664 Literal* key = property->key()->AsLiteral(); | 1664 Literal* key = property->key()->AsLiteral(); |
1665 Expression* value = property->value(); | 1665 Expression* value = property->value(); |
1666 if (!result_saved) { | 1666 if (!result_saved) { |
1667 __ Push(x0); // Save result on stack | 1667 __ Push(x0); // Save result on stack |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 DCHECK(lit != NULL); | 2248 DCHECK(lit != NULL); |
2249 __ push(x0); | 2249 __ push(x0); |
2250 | 2250 |
2251 // No access check is needed here since the constructor is created by the | 2251 // No access check is needed here since the constructor is created by the |
2252 // class literal. | 2252 // class literal. |
2253 Register scratch = x1; | 2253 Register scratch = x1; |
2254 __ Ldr(scratch, | 2254 __ Ldr(scratch, |
2255 FieldMemOperand(x0, JSFunction::kPrototypeOrInitialMapOffset)); | 2255 FieldMemOperand(x0, JSFunction::kPrototypeOrInitialMapOffset)); |
2256 __ Push(scratch); | 2256 __ Push(scratch); |
2257 | 2257 |
| 2258 // store_slot_index points to the vector IC slot for the next store IC used. |
| 2259 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots |
| 2260 // and must be updated if the number of store ICs emitted here changes. |
| 2261 int store_slot_index = 0; |
2258 for (int i = 0; i < lit->properties()->length(); i++) { | 2262 for (int i = 0; i < lit->properties()->length(); i++) { |
2259 ObjectLiteral::Property* property = lit->properties()->at(i); | 2263 ObjectLiteral::Property* property = lit->properties()->at(i); |
2260 Expression* value = property->value(); | 2264 Expression* value = property->value(); |
2261 | 2265 |
2262 if (property->is_static()) { | 2266 if (property->is_static()) { |
2263 __ Peek(scratch, kPointerSize); // constructor | 2267 __ Peek(scratch, kPointerSize); // constructor |
2264 } else { | 2268 } else { |
2265 __ Peek(scratch, 0); // prototype | 2269 __ Peek(scratch, 0); // prototype |
2266 } | 2270 } |
2267 __ Push(scratch); | 2271 __ Push(scratch); |
2268 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2272 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2269 | 2273 |
2270 // The static prototype property is read only. We handle the non computed | 2274 // 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 | 2275 // 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 | 2276 // 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. | 2277 // not need to do this for every property. |
2274 if (property->is_static() && property->is_computed_name()) { | 2278 if (property->is_static() && property->is_computed_name()) { |
2275 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2279 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2276 __ Push(x0); | 2280 __ Push(x0); |
2277 } | 2281 } |
2278 | 2282 |
2279 VisitForStackValue(value); | 2283 VisitForStackValue(value); |
2280 EmitSetHomeObjectIfNeeded(value, 2); | 2284 EmitSetHomeObjectIfNeeded(value, 2, |
| 2285 lit->SlotForHomeObject(value, &store_slot_index)); |
2281 | 2286 |
2282 switch (property->kind()) { | 2287 switch (property->kind()) { |
2283 case ObjectLiteral::Property::CONSTANT: | 2288 case ObjectLiteral::Property::CONSTANT: |
2284 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2289 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2285 case ObjectLiteral::Property::PROTOTYPE: | 2290 case ObjectLiteral::Property::PROTOTYPE: |
2286 UNREACHABLE(); | 2291 UNREACHABLE(); |
2287 case ObjectLiteral::Property::COMPUTED: | 2292 case ObjectLiteral::Property::COMPUTED: |
2288 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2293 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2289 break; | 2294 break; |
2290 | 2295 |
(...skipping 12 matching lines...) Expand all Loading... |
2303 default: | 2308 default: |
2304 UNREACHABLE(); | 2309 UNREACHABLE(); |
2305 } | 2310 } |
2306 } | 2311 } |
2307 | 2312 |
2308 // prototype | 2313 // prototype |
2309 __ CallRuntime(Runtime::kToFastProperties, 1); | 2314 __ CallRuntime(Runtime::kToFastProperties, 1); |
2310 | 2315 |
2311 // constructor | 2316 // constructor |
2312 __ CallRuntime(Runtime::kToFastProperties, 1); | 2317 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2318 |
| 2319 // Verify that compilation exactly consumed the number of store ic slots that |
| 2320 // the ClassLiteral node had to offer. |
| 2321 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
2313 } | 2322 } |
2314 | 2323 |
2315 | 2324 |
2316 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2325 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2317 FeedbackVectorICSlot slot) { | 2326 FeedbackVectorICSlot slot) { |
2318 DCHECK(expr->IsValidReferenceExpression()); | 2327 DCHECK(expr->IsValidReferenceExpression()); |
2319 | 2328 |
2320 Property* prop = expr->AsProperty(); | 2329 Property* prop = expr->AsProperty(); |
2321 LhsKind assign_type = Property::GetAssignType(prop); | 2330 LhsKind assign_type = Property::GetAssignType(prop); |
2322 | 2331 |
(...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5561 } | 5570 } |
5562 | 5571 |
5563 return INTERRUPT; | 5572 return INTERRUPT; |
5564 } | 5573 } |
5565 | 5574 |
5566 | 5575 |
5567 } // namespace internal | 5576 } // namespace internal |
5568 } // namespace v8 | 5577 } // namespace v8 |
5569 | 5578 |
5570 #endif // V8_TARGET_ARCH_ARM64 | 5579 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |