OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 __ CallStub(&stub); | 1634 __ CallStub(&stub); |
1635 } | 1635 } |
1636 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); | 1636 PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG); |
1637 | 1637 |
1638 // If result_saved is true the result is on top of the stack. If | 1638 // If result_saved is true the result is on top of the stack. If |
1639 // result_saved is false the result is in r3. | 1639 // result_saved is false the result is in r3. |
1640 bool result_saved = false; | 1640 bool result_saved = false; |
1641 | 1641 |
1642 AccessorTable accessor_table(zone()); | 1642 AccessorTable accessor_table(zone()); |
1643 int property_index = 0; | 1643 int property_index = 0; |
1644 // store_slot_index points to the vector ic slot for the next store ic used. | 1644 // store_slot_index points to the vector IC slot for the next store IC used. |
1645 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots | 1645 // ObjectLiteral::ComputeFeedbackRequirements controls the allocation of slots |
1646 // and must be updated if the number of store ics emitted here changes. | 1646 // and must be updated if the number of store ICs emitted here changes. |
1647 int store_slot_index = 0; | 1647 int store_slot_index = 0; |
1648 for (; property_index < expr->properties()->length(); property_index++) { | 1648 for (; property_index < expr->properties()->length(); property_index++) { |
1649 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1649 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
1650 if (property->is_computed_name()) break; | 1650 if (property->is_computed_name()) break; |
1651 if (property->IsCompileTimeValue()) continue; | 1651 if (property->IsCompileTimeValue()) continue; |
1652 | 1652 |
1653 Literal* key = property->key()->AsLiteral(); | 1653 Literal* key = property->key()->AsLiteral(); |
1654 Expression* value = property->value(); | 1654 Expression* value = property->value(); |
1655 if (!result_saved) { | 1655 if (!result_saved) { |
1656 __ push(r3); // Save result on stack | 1656 __ push(r3); // Save result on stack |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2556 DCHECK(lit != NULL); | 2556 DCHECK(lit != NULL); |
2557 __ push(r3); | 2557 __ push(r3); |
2558 | 2558 |
2559 // No access check is needed here since the constructor is created by the | 2559 // No access check is needed here since the constructor is created by the |
2560 // class literal. | 2560 // class literal. |
2561 Register scratch = r4; | 2561 Register scratch = r4; |
2562 __ LoadP(scratch, | 2562 __ LoadP(scratch, |
2563 FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); | 2563 FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); |
2564 __ push(scratch); | 2564 __ push(scratch); |
2565 | 2565 |
| 2566 // store_slot_index points to the vector IC slot for the next store IC used. |
| 2567 // ClassLiteral::ComputeFeedbackRequirements controls the allocation of slots |
| 2568 // and must be updated if the number of store ICs emitted here changes. |
| 2569 int store_slot_index = 0; |
2566 for (int i = 0; i < lit->properties()->length(); i++) { | 2570 for (int i = 0; i < lit->properties()->length(); i++) { |
2567 ObjectLiteral::Property* property = lit->properties()->at(i); | 2571 ObjectLiteral::Property* property = lit->properties()->at(i); |
2568 Expression* value = property->value(); | 2572 Expression* value = property->value(); |
2569 | 2573 |
2570 if (property->is_static()) { | 2574 if (property->is_static()) { |
2571 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor | 2575 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // constructor |
2572 } else { | 2576 } else { |
2573 __ LoadP(scratch, MemOperand(sp, 0)); // prototype | 2577 __ LoadP(scratch, MemOperand(sp, 0)); // prototype |
2574 } | 2578 } |
2575 __ push(scratch); | 2579 __ push(scratch); |
2576 EmitPropertyKey(property, lit->GetIdForProperty(i)); | 2580 EmitPropertyKey(property, lit->GetIdForProperty(i)); |
2577 | 2581 |
2578 // The static prototype property is read only. We handle the non computed | 2582 // The static prototype property is read only. We handle the non computed |
2579 // property name case in the parser. Since this is the only case where we | 2583 // property name case in the parser. Since this is the only case where we |
2580 // need to check for an own read only property we special case this so we do | 2584 // need to check for an own read only property we special case this so we do |
2581 // not need to do this for every property. | 2585 // not need to do this for every property. |
2582 if (property->is_static() && property->is_computed_name()) { | 2586 if (property->is_static() && property->is_computed_name()) { |
2583 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | 2587 __ CallRuntime(Runtime::kThrowIfStaticPrototype, 1); |
2584 __ push(r3); | 2588 __ push(r3); |
2585 } | 2589 } |
2586 | 2590 |
2587 VisitForStackValue(value); | 2591 VisitForStackValue(value); |
2588 EmitSetHomeObjectIfNeeded(value, 2); | 2592 EmitSetHomeObjectIfNeeded(value, 2, |
| 2593 lit->SlotForHomeObject(value, &store_slot_index)); |
2589 | 2594 |
2590 switch (property->kind()) { | 2595 switch (property->kind()) { |
2591 case ObjectLiteral::Property::CONSTANT: | 2596 case ObjectLiteral::Property::CONSTANT: |
2592 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 2597 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
2593 case ObjectLiteral::Property::PROTOTYPE: | 2598 case ObjectLiteral::Property::PROTOTYPE: |
2594 UNREACHABLE(); | 2599 UNREACHABLE(); |
2595 case ObjectLiteral::Property::COMPUTED: | 2600 case ObjectLiteral::Property::COMPUTED: |
2596 __ CallRuntime(Runtime::kDefineClassMethod, 3); | 2601 __ CallRuntime(Runtime::kDefineClassMethod, 3); |
2597 break; | 2602 break; |
2598 | 2603 |
(...skipping 12 matching lines...) Expand all Loading... |
2611 default: | 2616 default: |
2612 UNREACHABLE(); | 2617 UNREACHABLE(); |
2613 } | 2618 } |
2614 } | 2619 } |
2615 | 2620 |
2616 // prototype | 2621 // prototype |
2617 __ CallRuntime(Runtime::kToFastProperties, 1); | 2622 __ CallRuntime(Runtime::kToFastProperties, 1); |
2618 | 2623 |
2619 // constructor | 2624 // constructor |
2620 __ CallRuntime(Runtime::kToFastProperties, 1); | 2625 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2626 |
| 2627 // Verify that compilation exactly consumed the number of store ic slots that |
| 2628 // the ClassLiteral node had to offer. |
| 2629 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
2621 } | 2630 } |
2622 | 2631 |
2623 | 2632 |
2624 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { | 2633 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
2625 __ pop(r4); | 2634 __ pop(r4); |
2626 Handle<Code> code = | 2635 Handle<Code> code = |
2627 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2636 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2628 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2637 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2629 CallIC(code, expr->BinaryOperationFeedbackId()); | 2638 CallIC(code, expr->BinaryOperationFeedbackId()); |
2630 patch_site.EmitPatchInfo(); | 2639 patch_site.EmitPatchInfo(); |
(...skipping 2915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5546 return ON_STACK_REPLACEMENT; | 5555 return ON_STACK_REPLACEMENT; |
5547 } | 5556 } |
5548 | 5557 |
5549 DCHECK(interrupt_address == | 5558 DCHECK(interrupt_address == |
5550 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5559 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5551 return OSR_AFTER_STACK_CHECK; | 5560 return OSR_AFTER_STACK_CHECK; |
5552 } | 5561 } |
5553 } // namespace internal | 5562 } // namespace internal |
5554 } // namespace v8 | 5563 } // namespace v8 |
5555 #endif // V8_TARGET_ARCH_PPC | 5564 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |