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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 // No write barrier since the_hole_value is in old space. | 793 // No write barrier since the_hole_value is in old space. |
794 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 794 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
795 } | 795 } |
796 break; | 796 break; |
797 | 797 |
798 case VariableLocation::LOOKUP: { | 798 case VariableLocation::LOOKUP: { |
799 Comment cmnt(masm_, "[ VariableDeclaration"); | 799 Comment cmnt(masm_, "[ VariableDeclaration"); |
800 __ Mov(x2, Operand(variable->name())); | 800 __ Mov(x2, Operand(variable->name())); |
801 // Declaration nodes are always introduced in one of four modes. | 801 // Declaration nodes are always introduced in one of four modes. |
802 DCHECK(IsDeclaredVariableMode(mode)); | 802 DCHECK(IsDeclaredVariableMode(mode)); |
803 // Push initial value, if any. | 803 DCHECK(!hole_init); |
804 // Note: For variables we must not push an initial value (such as | 804 // Pushing 0 (xzr) indicates no initial value. |
805 // 'undefined') because we may have a (legal) redeclaration and we | 805 __ Push(x2, xzr); |
806 // must not destroy the current value. | |
807 if (hole_init) { | |
808 __ LoadRoot(x0, Heap::kTheHoleValueRootIndex); | |
809 __ Push(x2, x0); | |
810 } else { | |
811 // Pushing 0 (xzr) indicates no initial value. | |
812 __ Push(x2, xzr); | |
813 } | |
814 __ Push(Smi::FromInt(variable->DeclarationPropertyAttributes())); | 806 __ Push(Smi::FromInt(variable->DeclarationPropertyAttributes())); |
815 __ CallRuntime(Runtime::kDeclareLookupSlot); | 807 __ CallRuntime(Runtime::kDeclareLookupSlot); |
816 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 808 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
817 break; | 809 break; |
818 } | 810 } |
819 } | 811 } |
820 } | 812 } |
821 | 813 |
822 | 814 |
823 void FullCodeGenerator::VisitFunctionDeclaration( | 815 void FullCodeGenerator::VisitFunctionDeclaration( |
(...skipping 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 } | 3884 } |
3893 | 3885 |
3894 return INTERRUPT; | 3886 return INTERRUPT; |
3895 } | 3887 } |
3896 | 3888 |
3897 | 3889 |
3898 } // namespace internal | 3890 } // namespace internal |
3899 } // namespace v8 | 3891 } // namespace v8 |
3900 | 3892 |
3901 #endif // V8_TARGET_ARCH_ARM64 | 3893 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |