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 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 } | 2719 } |
2720 | 2720 |
2721 | 2721 |
2722 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { | 2722 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { |
2723 if (var->IsUnallocated()) { | 2723 if (var->IsUnallocated()) { |
2724 // Global var, const, or let. | 2724 // Global var, const, or let. |
2725 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); | 2725 __ mov(StoreDescriptor::NameRegister(), Operand(var->name())); |
2726 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2726 __ ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2727 CallStoreIC(); | 2727 CallStoreIC(); |
2728 | 2728 |
2729 } else if (op == Token::INIT_CONST_LEGACY) { | |
2730 // Const initializers need a write barrier. | |
2731 DCHECK(!var->IsParameter()); // No const parameters. | |
2732 if (var->IsLookupSlot()) { | |
2733 __ push(r0); | |
2734 __ mov(r0, Operand(var->name())); | |
2735 __ Push(cp, r0); // Context and name. | |
2736 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); | |
2737 } else { | |
2738 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | |
2739 Label skip; | |
2740 MemOperand location = VarOperand(var, r1); | |
2741 __ ldr(r2, location); | |
2742 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); | |
2743 __ b(ne, &skip); | |
2744 EmitStoreToStackLocalOrContextSlot(var, location); | |
2745 __ bind(&skip); | |
2746 } | |
2747 | |
2748 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2729 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2749 // Non-initializing assignment to let variable needs a write barrier. | 2730 // Non-initializing assignment to let variable needs a write barrier. |
2750 DCHECK(!var->IsLookupSlot()); | 2731 DCHECK(!var->IsLookupSlot()); |
2751 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2732 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2752 Label assign; | 2733 Label assign; |
2753 MemOperand location = VarOperand(var, r1); | 2734 MemOperand location = VarOperand(var, r1); |
2754 __ ldr(r3, location); | 2735 __ ldr(r3, location); |
2755 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); | 2736 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
2756 __ b(ne, &assign); | 2737 __ b(ne, &assign); |
2757 __ mov(r3, Operand(var->name())); | 2738 __ mov(r3, Operand(var->name())); |
2758 __ push(r3); | 2739 __ push(r3); |
2759 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2740 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
2760 // Perform the assignment. | 2741 // Perform the assignment. |
2761 __ bind(&assign); | 2742 __ bind(&assign); |
2762 EmitStoreToStackLocalOrContextSlot(var, location); | 2743 EmitStoreToStackLocalOrContextSlot(var, location); |
2763 | 2744 |
| 2745 } else if (var->mode() == CONST && op != Token::INIT_CONST) { |
| 2746 // Assignment to const variable needs a write barrier. |
| 2747 DCHECK(!var->IsLookupSlot()); |
| 2748 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2749 Label const_error; |
| 2750 MemOperand location = VarOperand(var, r1); |
| 2751 __ ldr(r3, location); |
| 2752 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
| 2753 __ b(ne, &const_error); |
| 2754 __ mov(r3, Operand(var->name())); |
| 2755 __ push(r3); |
| 2756 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 2757 __ bind(&const_error); |
| 2758 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 2759 |
2764 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { | 2760 } else if (!var->is_const_mode() || op == Token::INIT_CONST) { |
2765 if (var->IsLookupSlot()) { | 2761 if (var->IsLookupSlot()) { |
2766 // Assignment to var. | 2762 // Assignment to var. |
2767 __ push(r0); // Value. | 2763 __ push(r0); // Value. |
2768 __ mov(r1, Operand(var->name())); | 2764 __ mov(r1, Operand(var->name())); |
2769 __ mov(r0, Operand(Smi::FromInt(language_mode()))); | 2765 __ mov(r0, Operand(Smi::FromInt(language_mode()))); |
2770 __ Push(cp, r1, r0); // Context, name, language mode. | 2766 __ Push(cp, r1, r0); // Context, name, language mode. |
2771 __ CallRuntime(Runtime::kStoreLookupSlot, 4); | 2767 __ CallRuntime(Runtime::kStoreLookupSlot, 4); |
2772 } else { | 2768 } else { |
2773 // Assignment to var or initializing assignment to let/const in harmony | 2769 // Assignment to var or initializing assignment to let/const in harmony |
2774 // mode. | 2770 // mode. |
2775 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); | 2771 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); |
2776 MemOperand location = VarOperand(var, r1); | 2772 MemOperand location = VarOperand(var, r1); |
2777 if (generate_debug_code_ && op == Token::INIT_LET) { | 2773 if (generate_debug_code_ && op == Token::INIT_LET) { |
2778 // Check for an uninitialized let binding. | 2774 // Check for an uninitialized let binding. |
2779 __ ldr(r2, location); | 2775 __ ldr(r2, location); |
2780 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); | 2776 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); |
2781 __ Check(eq, kLetBindingReInitialization); | 2777 __ Check(eq, kLetBindingReInitialization); |
2782 } | 2778 } |
2783 EmitStoreToStackLocalOrContextSlot(var, location); | 2779 EmitStoreToStackLocalOrContextSlot(var, location); |
2784 } | 2780 } |
2785 } else if (IsSignallingAssignmentToConst(var, op, language_mode())) { | 2781 |
2786 __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 2782 } else if (op == Token::INIT_CONST_LEGACY) { |
| 2783 // Const initializers need a write barrier. |
| 2784 DCHECK(var->mode() == CONST_LEGACY); |
| 2785 DCHECK(!var->IsParameter()); // No const parameters. |
| 2786 if (var->IsLookupSlot()) { |
| 2787 __ push(r0); |
| 2788 __ mov(r0, Operand(var->name())); |
| 2789 __ Push(cp, r0); // Context and name. |
| 2790 __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3); |
| 2791 } else { |
| 2792 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2793 Label skip; |
| 2794 MemOperand location = VarOperand(var, r1); |
| 2795 __ ldr(r2, location); |
| 2796 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); |
| 2797 __ b(ne, &skip); |
| 2798 EmitStoreToStackLocalOrContextSlot(var, location); |
| 2799 __ bind(&skip); |
| 2800 } |
| 2801 |
| 2802 } else { |
| 2803 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT_CONST_LEGACY); |
| 2804 if (is_strict(language_mode())) { |
| 2805 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
| 2806 } |
| 2807 // Silently ignore store in sloppy mode. |
2787 } | 2808 } |
2788 } | 2809 } |
2789 | 2810 |
2790 | 2811 |
2791 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2812 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2792 // Assignment to a property, using a named store IC. | 2813 // Assignment to a property, using a named store IC. |
2793 Property* prop = expr->target()->AsProperty(); | 2814 Property* prop = expr->target()->AsProperty(); |
2794 DCHECK(prop != NULL); | 2815 DCHECK(prop != NULL); |
2795 DCHECK(prop->key()->IsLiteral()); | 2816 DCHECK(prop->key()->IsLiteral()); |
2796 | 2817 |
(...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5502 | 5523 |
5503 DCHECK(interrupt_address == | 5524 DCHECK(interrupt_address == |
5504 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5525 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5505 return OSR_AFTER_STACK_CHECK; | 5526 return OSR_AFTER_STACK_CHECK; |
5506 } | 5527 } |
5507 | 5528 |
5508 | 5529 |
5509 } } // namespace v8::internal | 5530 } } // namespace v8::internal |
5510 | 5531 |
5511 #endif // V8_TARGET_ARCH_ARM | 5532 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |