OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 __ CallStub(&stub); | 1673 __ CallStub(&stub); |
1674 } | 1674 } |
1675 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1675 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1676 | 1676 |
1677 // If result_saved is true the result is on top of the stack. If | 1677 // If result_saved is true the result is on top of the stack. If |
1678 // result_saved is false the result is in r0. | 1678 // result_saved is false the result is in r0. |
1679 bool result_saved = false; | 1679 bool result_saved = false; |
1680 | 1680 |
1681 AccessorTable accessor_table(zone()); | 1681 AccessorTable accessor_table(zone()); |
1682 int property_index = 0; | 1682 int property_index = 0; |
1683 // store_slot_index points to the vector ic slot for the next store ic used. | 1683 // store_slot_index points to the vector IC slot for the next store IC used. |
1684 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots | 1684 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots |
1685 // and must be updated if the number of store ics emitted here changes. | 1685 // and must be updated if the number of store ICs emitted here changes. |
1686 int store_slot_index = 0; | 1686 int store_slot_index = 0; |
1687 for (; property_index < expr->properties()->length(); property_index++) { | 1687 for (; property_index < expr->properties()->length(); property_index++) { |
1688 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1688 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
1689 if (property->is_computed_name()) break; | 1689 if (property->is_computed_name()) break; |
1690 if (property->IsCompileTimeValue()) continue; | 1690 if (property->IsCompileTimeValue()) continue; |
1691 | 1691 |
1692 Literal* key = property->key()->AsLiteral(); | 1692 Literal* key = property->key()->AsLiteral(); |
1693 Expression* value = property->value(); | 1693 Expression* value = property->value(); |
1694 if (!result_saved) { | 1694 if (!result_saved) { |
1695 __ push(r0); // Save result on stack | 1695 __ push(r0); // Save result on stack |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 DCHECK(lit != NULL); | 2558 DCHECK(lit != NULL); |
2559 __ push(r0); | 2559 __ push(r0); |
2560 | 2560 |
2561 // No access check is needed here since the constructor is created by the | 2561 // No access check is needed here since the constructor is created by the |
2562 // class literal. | 2562 // class literal. |
2563 Register scratch = r1; | 2563 Register scratch = r1; |
2564 __ ldr(scratch, | 2564 __ ldr(scratch, |
2565 FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); | 2565 FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); |
2566 __ push(scratch); | 2566 __ push(scratch); |
2567 | 2567 |
| 2568 // store_slot_index points to the vector IC slot for the next store IC used. |
| 2569 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots |
| 2570 // and must be updated if the number of store ICs emitted here changes. |
| 2571 int store_slot_index = 0; |
2568 for (int i = 0; i < lit->properties()->length(); i++) { | 2572 for (int i = 0; i < lit->properties()->length(); i++) { |
2569 ObjectLiteral::Property* property = lit->properties()->at(i); | 2573 ObjectLiteral::Property* property = lit->properties()->at(i); |
2570 Expression* value = property->value(); | 2574 Expression* value = property->value(); |
2571 | 2575 |
2572 if (property->is_static()) { | 2576 if (property->is_static()) { |
2573 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor | 2577 __ ldr(scratch, MemOperand(sp, kPointerSize)); // constructor |
2574 } else { | 2578 } else { |
2575 __ ldr(scratch, MemOperand(sp, 0)); // prototype | 2579 __ ldr(scratch, MemOperand(sp, 0)); // prototype |
2576 } | 2580 } |
2577 __ push(scratch); | 2581 __ push(scratch); |
2578 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2582 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2579 | 2583 |
2580 // The static prototype property is read only. We handle the non computed | 2584 // The static prototype property is read only. We handle the non computed |
2581 // property name case in the parser. Since this is the only case where we | 2585 // property name case in the parser. Since this is the only case where we |
2582 // need to check for an own read only property we special case this so we do | 2586 // need to check for an own read only property we special case this so we do |
2583 // not need to do this for every property. | 2587 // not need to do this for every property. |
2584 if (property->is_static() && property->is_computed_name()) { | 2588 if (property->is_static() && property->is_computed_name()) { |
2585 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2589 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2586 __ push(r0); | 2590 __ push(r0); |
2587 } | 2591 } |
2588 | 2592 |
2589 VisitForStackValue(value); | 2593 VisitForStackValue(value); |
2590 EmitSetHomeObjectIfNeeded(value, 2); | 2594 EmitSetHomeObjectIfNeeded(value, 2, |
| 2595 lit->SlotForHomeObject(value, &store_slot_index)); |
2591 | 2596 |
2592 switch (property->kind()) { | 2597 switch (property->kind()) { |
2593 case ObjectLiteral::Property::CONSTANT: | 2598 case ObjectLiteral::Property::CONSTANT: |
2594 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2599 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2595 case ObjectLiteral::Property::PROTOTYPE: | 2600 case ObjectLiteral::Property::PROTOTYPE: |
2596 UNREACHABLE(); | 2601 UNREACHABLE(); |
2597 case ObjectLiteral::Property::COMPUTED: | 2602 case ObjectLiteral::Property::COMPUTED: |
2598 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2603 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2599 break; | 2604 break; |
2600 | 2605 |
(...skipping 12 matching lines...) Expand all Loading... |
2613 default: | 2618 default: |
2614 UNREACHABLE(); | 2619 UNREACHABLE(); |
2615 } | 2620 } |
2616 } | 2621 } |
2617 | 2622 |
2618 // prototype | 2623 // prototype |
2619 __ CallRuntime(Runtime::kToFastProperties, 1); | 2624 __ CallRuntime(Runtime::kToFastProperties, 1); |
2620 | 2625 |
2621 // constructor | 2626 // constructor |
2622 __ CallRuntime(Runtime::kToFastProperties, 1); | 2627 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2628 |
| 2629 // Verify that compilation exactly consumed the number of store ic slots that |
| 2630 // the ClassLiteral node had to offer. |
| 2631 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
2623 } | 2632 } |
2624 | 2633 |
2625 | 2634 |
2626 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2635 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2627 __ pop(r1); | 2636 __ pop(r1); |
2628 Handle<Code> code = CodeFactory::BinaryOpIC( | 2637 Handle<Code> code = CodeFactory::BinaryOpIC( |
2629 isolate(), op, language_mode()).code(); | 2638 isolate(), op, language_mode()).code(); |
2630 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2639 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2631 CallIC(code, expr->BinaryOperationFeedbackId()); | 2640 CallIC(code, expr->BinaryOperationFeedbackId()); |
2632 patch_site.EmitPatchInfo(); | 2641 patch_site.EmitPatchInfo(); |
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5596 DCHECK(interrupt_address == | 5605 DCHECK(interrupt_address == |
5597 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5606 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5598 return OSR_AFTER_STACK_CHECK; | 5607 return OSR_AFTER_STACK_CHECK; |
5599 } | 5608 } |
5600 | 5609 |
5601 | 5610 |
5602 } // namespace internal | 5611 } // namespace internal |
5603 } // namespace v8 | 5612 } // namespace v8 |
5604 | 5613 |
5605 #endif // V8_TARGET_ARCH_ARM | 5614 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |