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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 // If it was not possible to allocate the variable at compile time, we | 763 // If it was not possible to allocate the variable at compile time, we |
764 // need to "declare" it at runtime to make sure it actually exists in the | 764 // need to "declare" it at runtime to make sure it actually exists in the |
765 // local context. | 765 // local context. |
766 VariableProxy* proxy = declaration->proxy(); | 766 VariableProxy* proxy = declaration->proxy(); |
767 VariableMode mode = declaration->mode(); | 767 VariableMode mode = declaration->mode(); |
768 Variable* variable = proxy->var(); | 768 Variable* variable = proxy->var(); |
769 bool hole_init = mode == LET || mode == CONST; | 769 bool hole_init = mode == LET || mode == CONST; |
770 | 770 |
771 switch (variable->location()) { | 771 switch (variable->location()) { |
772 case VariableLocation::GLOBAL: | 772 case VariableLocation::GLOBAL: |
773 case VariableLocation::UNALLOCATED: | 773 case VariableLocation::UNALLOCATED: { |
774 DCHECK(!variable->binding_needs_init()); | 774 DCHECK(!variable->binding_needs_init()); |
775 globals_->Add(variable->name(), zone()); | 775 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 776 DCHECK(!slot.IsInvalid()); |
| 777 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
776 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 778 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
777 break; | 779 break; |
778 | 780 } |
779 case VariableLocation::PARAMETER: | 781 case VariableLocation::PARAMETER: |
780 case VariableLocation::LOCAL: | 782 case VariableLocation::LOCAL: |
781 if (hole_init) { | 783 if (hole_init) { |
782 Comment cmnt(masm_, "[ VariableDeclaration"); | 784 Comment cmnt(masm_, "[ VariableDeclaration"); |
783 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); | 785 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); |
784 __ Str(x10, StackOperand(variable)); | 786 __ Str(x10, StackOperand(variable)); |
785 } | 787 } |
786 break; | 788 break; |
787 | 789 |
788 case VariableLocation::CONTEXT: | 790 case VariableLocation::CONTEXT: |
(...skipping 21 matching lines...) Expand all Loading... |
810 } | 812 } |
811 | 813 |
812 | 814 |
813 void FullCodeGenerator::VisitFunctionDeclaration( | 815 void FullCodeGenerator::VisitFunctionDeclaration( |
814 FunctionDeclaration* declaration) { | 816 FunctionDeclaration* declaration) { |
815 VariableProxy* proxy = declaration->proxy(); | 817 VariableProxy* proxy = declaration->proxy(); |
816 Variable* variable = proxy->var(); | 818 Variable* variable = proxy->var(); |
817 switch (variable->location()) { | 819 switch (variable->location()) { |
818 case VariableLocation::GLOBAL: | 820 case VariableLocation::GLOBAL: |
819 case VariableLocation::UNALLOCATED: { | 821 case VariableLocation::UNALLOCATED: { |
820 globals_->Add(variable->name(), zone()); | 822 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 823 DCHECK(!slot.IsInvalid()); |
| 824 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
821 Handle<SharedFunctionInfo> function = | 825 Handle<SharedFunctionInfo> function = |
822 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 826 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
823 // Check for stack overflow exception. | 827 // Check for stack overflow exception. |
824 if (function.is_null()) return SetStackOverflow(); | 828 if (function.is_null()) return SetStackOverflow(); |
825 globals_->Add(function, zone()); | 829 globals_->Add(function, zone()); |
826 break; | 830 break; |
827 } | 831 } |
828 | 832 |
829 case VariableLocation::PARAMETER: | 833 case VariableLocation::PARAMETER: |
830 case VariableLocation::LOCAL: { | 834 case VariableLocation::LOCAL: { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 | 872 |
869 | 873 |
870 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 874 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
871 // Call the runtime to declare the globals. | 875 // Call the runtime to declare the globals. |
872 __ Mov(x11, Operand(pairs)); | 876 __ Mov(x11, Operand(pairs)); |
873 Register flags = xzr; | 877 Register flags = xzr; |
874 if (Smi::FromInt(DeclareGlobalsFlags())) { | 878 if (Smi::FromInt(DeclareGlobalsFlags())) { |
875 flags = x10; | 879 flags = x10; |
876 __ Mov(flags, Smi::FromInt(DeclareGlobalsFlags())); | 880 __ Mov(flags, Smi::FromInt(DeclareGlobalsFlags())); |
877 } | 881 } |
878 __ Push(x11, flags); | 882 __ EmitLoadTypeFeedbackVector(x12); |
| 883 __ Push(x11, flags, x12); |
879 __ CallRuntime(Runtime::kDeclareGlobals); | 884 __ CallRuntime(Runtime::kDeclareGlobals); |
880 // Return value is ignored. | 885 // Return value is ignored. |
881 } | 886 } |
882 | 887 |
883 | 888 |
884 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 889 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
885 ASM_LOCATION("FullCodeGenerator::VisitSwitchStatement"); | 890 ASM_LOCATION("FullCodeGenerator::VisitSwitchStatement"); |
886 Comment cmnt(masm_, "[ SwitchStatement"); | 891 Comment cmnt(masm_, "[ SwitchStatement"); |
887 Breakable nested_statement(this, stmt); | 892 Breakable nested_statement(this, stmt); |
888 SetStatementPosition(stmt); | 893 SetStatementPosition(stmt); |
(...skipping 2973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3862 } | 3867 } |
3863 | 3868 |
3864 return INTERRUPT; | 3869 return INTERRUPT; |
3865 } | 3870 } |
3866 | 3871 |
3867 | 3872 |
3868 } // namespace internal | 3873 } // namespace internal |
3869 } // namespace v8 | 3874 } // namespace v8 |
3870 | 3875 |
3871 #endif // V8_TARGET_ARCH_ARM64 | 3876 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |