| 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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2586 | 2586 |
| 2587 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2587 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
| 2588 FeedbackVectorSlot slot) { | 2588 FeedbackVectorSlot slot) { |
| 2589 if (var->IsUnallocated()) { | 2589 if (var->IsUnallocated()) { |
| 2590 // Global var, const, or let. | 2590 // Global var, const, or let. |
| 2591 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2591 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
| 2592 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2592 __ LoadP(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 2593 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2593 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
| 2594 CallStoreIC(); | 2594 CallStoreIC(); |
| 2595 | 2595 |
| 2596 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2596 } else if (var->mode() == LET && op != Token::INIT) { |
| 2597 // Non-initializing assignment to let variable needs a write barrier. | 2597 // Non-initializing assignment to let variable needs a write barrier. |
| 2598 DCHECK(!var->IsLookupSlot()); | 2598 DCHECK(!var->IsLookupSlot()); |
| 2599 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2599 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2600 Label assign; | 2600 Label assign; |
| 2601 MemOperand location = VarOperand(var, r4); | 2601 MemOperand location = VarOperand(var, r4); |
| 2602 __ LoadP(r6, location); | 2602 __ LoadP(r6, location); |
| 2603 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2603 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
| 2604 __ bne(&assign); | 2604 __ bne(&assign); |
| 2605 __ mov(r6, Operand(var->name())); | 2605 __ mov(r6, Operand(var->name())); |
| 2606 __ push(r6); | 2606 __ push(r6); |
| 2607 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2607 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2608 // Perform the assignment. | 2608 // Perform the assignment. |
| 2609 __ bind(&assign); | 2609 __ bind(&assign); |
| 2610 EmitStoreToStackLocalOrContextSlot(var, location); | 2610 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2611 | 2611 |
| 2612 } else if (var->mode() == CONST && op != Token::INIT_CONST) { | 2612 } else if (var->mode() == CONST && op != Token::INIT) { |
| 2613 // Assignment to const variable needs a write barrier. | 2613 // Assignment to const variable needs a write barrier. |
| 2614 DCHECK(!var->IsLookupSlot()); | 2614 DCHECK(!var->IsLookupSlot()); |
| 2615 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2615 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2616 Label const_error; | 2616 Label const_error; |
| 2617 MemOperand location = VarOperand(var, r4); | 2617 MemOperand location = VarOperand(var, r4); |
| 2618 __ LoadP(r6, location); | 2618 __ LoadP(r6, location); |
| 2619 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2619 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
| 2620 __ bne(&const_error); | 2620 __ bne(&const_error); |
| 2621 __ mov(r6, Operand(var->name())); | 2621 __ mov(r6, Operand(var->name())); |
| 2622 __ push(r6); | 2622 __ push(r6); |
| 2623 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2623 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2624 __ bind(&const_error); | 2624 __ bind(&const_error); |
| 2625 __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 2625 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 2626 | 2626 |
| 2627 } else if (var->is_this() && op == Token::INIT_CONST) { | 2627 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { |
| 2628 // Initializing assignment to const {this} needs a write barrier. | 2628 // Initializing assignment to const {this} needs a write barrier. |
| 2629 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2629 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2630 Label uninitialized_this; | 2630 Label uninitialized_this; |
| 2631 MemOperand location = VarOperand(var, r4); | 2631 MemOperand location = VarOperand(var, r4); |
| 2632 __ LoadP(r6, location); | 2632 __ LoadP(r6, location); |
| 2633 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); | 2633 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); |
| 2634 __ beq(&uninitialized_this); | 2634 __ beq(&uninitialized_this); |
| 2635 __ mov(r4, Operand(var->name())); | 2635 __ mov(r4, Operand(var->name())); |
| 2636 __ push(r4); | 2636 __ push(r4); |
| 2637 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2637 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2638 __ bind(&uninitialized_this); | 2638 __ bind(&uninitialized_this); |
| 2639 EmitStoreToStackLocalOrContextSlot(var, location); | 2639 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2640 | 2640 |
| 2641 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { | 2641 } else if (!var->is_const_mode() || |
| 2642 (var->mode() == CONST && op == Token::INIT)) { |
| 2642 if (var->IsLookupSlot()) { | 2643 if (var->IsLookupSlot()) { |
| 2643 // Assignment to var. | 2644 // Assignment to var. |
| 2644 __ push(r3); // Value. | 2645 __ push(r3); // Value. |
| 2645 __ mov(r4, Operand(var->name())); | 2646 __ mov(r4, Operand(var->name())); |
| 2646 __ mov(r3, Operand(Smi::FromInt(language_mode()))); | 2647 __ mov(r3, Operand(Smi::FromInt(language_mode()))); |
| 2647 __ Push(cp, r4, r3); // Context, name, language mode. | 2648 __ Push(cp, r4, r3); // Context, name, language mode. |
| 2648 __ CallRuntime(Runtime::kStoreLookupSlot, 4); | 2649 __ CallRuntime(Runtime::kStoreLookupSlot, 4); |
| 2649 } else { | 2650 } else { |
| 2650 // Assignment to var or initializing assignment to let/const in harmony | 2651 // Assignment to var or initializing assignment to let/const in harmony |
| 2651 // mode. | 2652 // mode. |
| 2652 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); | 2653 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); |
| 2653 MemOperand location = VarOperand(var, r4); | 2654 MemOperand location = VarOperand(var, r4); |
| 2654 if (generate_debug_code_ && op == Token::INIT_LET) { | 2655 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { |
| 2655 // Check for an uninitialized let binding. | 2656 // Check for an uninitialized let binding. |
| 2656 __ LoadP(r5, location); | 2657 __ LoadP(r5, location); |
| 2657 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); | 2658 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); |
| 2658 __ Check(eq, kLetBindingReInitialization); | 2659 __ Check(eq, kLetBindingReInitialization); |
| 2659 } | 2660 } |
| 2660 EmitStoreToStackLocalOrContextSlot(var, location); | 2661 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2661 } | 2662 } |
| 2662 } else if (op == Token::INIT_CONST_LEGACY) { | 2663 } else if (var->mode() == CONST_LEGACY && op == Token::INIT) { |
| 2663 // Const initializers need a write barrier. | 2664 // Const initializers need a write barrier. |
| 2664 DCHECK(var->mode() == CONST_LEGACY); | |
| 2665 DCHECK(!var->IsParameter()); // No const parameters. | 2665 DCHECK(!var->IsParameter()); // No const parameters. |
| 2666 if (var->IsLookupSlot()) { | 2666 if (var->IsLookupSlot()) { |
| 2667 __ push(r3); | 2667 __ push(r3); |
| 2668 __ mov(r3, Operand(var->name())); | 2668 __ mov(r3, Operand(var->name())); |
| 2669 __ Push(cp, r3); // Context and name. | 2669 __ Push(cp, r3); // Context and name. |
| 2670 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); | 2670 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); |
| 2671 } else { | 2671 } else { |
| 2672 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2672 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2673 Label skip; | 2673 Label skip; |
| 2674 MemOperand location = VarOperand(var, r4); | 2674 MemOperand location = VarOperand(var, r4); |
| 2675 __ LoadP(r5, location); | 2675 __ LoadP(r5, location); |
| 2676 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); | 2676 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); |
| 2677 __ bne(&skip); | 2677 __ bne(&skip); |
| 2678 EmitStoreToStackLocalOrContextSlot(var, location); | 2678 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2679 __ bind(&skip); | 2679 __ bind(&skip); |
| 2680 } | 2680 } |
| 2681 | 2681 |
| 2682 } else { | 2682 } else { |
| 2683 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT_CONST_LEGACY); | 2683 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT); |
| 2684 if (is_strict(language_mode())) { | 2684 if (is_strict(language_mode())) { |
| 2685 __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 2685 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 2686 } | 2686 } |
| 2687 // Silently ignore store in sloppy mode. | 2687 // Silently ignore store in sloppy mode. |
| 2688 } | 2688 } |
| 2689 } | 2689 } |
| 2690 | 2690 |
| 2691 | 2691 |
| 2692 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2692 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2693 // Assignment to a property, using a named store IC. | 2693 // Assignment to a property, using a named store IC. |
| (...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5042 return ON_STACK_REPLACEMENT; | 5042 return ON_STACK_REPLACEMENT; |
| 5043 } | 5043 } |
| 5044 | 5044 |
| 5045 DCHECK(interrupt_address == | 5045 DCHECK(interrupt_address == |
| 5046 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5046 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5047 return OSR_AFTER_STACK_CHECK; | 5047 return OSR_AFTER_STACK_CHECK; |
| 5048 } | 5048 } |
| 5049 } // namespace internal | 5049 } // namespace internal |
| 5050 } // namespace v8 | 5050 } // namespace v8 |
| 5051 #endif // V8_TARGET_ARCH_PPC | 5051 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |