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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 VariableDeclaration* declaration) { | 762 VariableDeclaration* declaration) { |
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 switch (variable->location()) { | 770 switch (variable->location()) { |
771 case VariableLocation::GLOBAL: | 771 case VariableLocation::GLOBAL: |
772 case VariableLocation::UNALLOCATED: | 772 case VariableLocation::UNALLOCATED: { |
773 DCHECK(!variable->binding_needs_init()); | 773 DCHECK(!variable->binding_needs_init()); |
774 globals_->Add(variable->name(), zone()); | 774 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 775 DCHECK(!slot.IsInvalid()); |
| 776 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
775 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 777 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
776 break; | 778 break; |
777 | 779 } |
778 case VariableLocation::PARAMETER: | 780 case VariableLocation::PARAMETER: |
779 case VariableLocation::LOCAL: | 781 case VariableLocation::LOCAL: |
780 if (hole_init) { | 782 if (hole_init) { |
781 Comment cmnt(masm_, "[ VariableDeclaration"); | 783 Comment cmnt(masm_, "[ VariableDeclaration"); |
782 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); | 784 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); |
783 __ sd(a4, StackOperand(variable)); | 785 __ sd(a4, StackOperand(variable)); |
784 } | 786 } |
785 break; | 787 break; |
786 | 788 |
787 case VariableLocation::CONTEXT: | 789 case VariableLocation::CONTEXT: |
(...skipping 21 matching lines...) Expand all Loading... |
809 } | 811 } |
810 | 812 |
811 | 813 |
812 void FullCodeGenerator::VisitFunctionDeclaration( | 814 void FullCodeGenerator::VisitFunctionDeclaration( |
813 FunctionDeclaration* declaration) { | 815 FunctionDeclaration* declaration) { |
814 VariableProxy* proxy = declaration->proxy(); | 816 VariableProxy* proxy = declaration->proxy(); |
815 Variable* variable = proxy->var(); | 817 Variable* variable = proxy->var(); |
816 switch (variable->location()) { | 818 switch (variable->location()) { |
817 case VariableLocation::GLOBAL: | 819 case VariableLocation::GLOBAL: |
818 case VariableLocation::UNALLOCATED: { | 820 case VariableLocation::UNALLOCATED: { |
819 globals_->Add(variable->name(), zone()); | 821 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 822 DCHECK(!slot.IsInvalid()); |
| 823 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
820 Handle<SharedFunctionInfo> function = | 824 Handle<SharedFunctionInfo> function = |
821 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 825 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
822 // Check for stack-overflow exception. | 826 // Check for stack-overflow exception. |
823 if (function.is_null()) return SetStackOverflow(); | 827 if (function.is_null()) return SetStackOverflow(); |
824 globals_->Add(function, zone()); | 828 globals_->Add(function, zone()); |
825 break; | 829 break; |
826 } | 830 } |
827 | 831 |
828 case VariableLocation::PARAMETER: | 832 case VariableLocation::PARAMETER: |
829 case VariableLocation::LOCAL: { | 833 case VariableLocation::LOCAL: { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 break; | 867 break; |
864 } | 868 } |
865 } | 869 } |
866 } | 870 } |
867 | 871 |
868 | 872 |
869 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 873 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
870 // Call the runtime to declare the globals. | 874 // Call the runtime to declare the globals. |
871 __ li(a1, Operand(pairs)); | 875 __ li(a1, Operand(pairs)); |
872 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); | 876 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); |
873 __ Push(a1, a0); | 877 __ EmitLoadTypeFeedbackVector(a2); |
| 878 __ Push(a1, a0, a2); |
874 __ CallRuntime(Runtime::kDeclareGlobals); | 879 __ CallRuntime(Runtime::kDeclareGlobals); |
875 // Return value is ignored. | 880 // Return value is ignored. |
876 } | 881 } |
877 | 882 |
878 | 883 |
879 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 884 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
880 Comment cmnt(masm_, "[ SwitchStatement"); | 885 Comment cmnt(masm_, "[ SwitchStatement"); |
881 Breakable nested_statement(this, stmt); | 886 Breakable nested_statement(this, stmt); |
882 SetStatementPosition(stmt); | 887 SetStatementPosition(stmt); |
883 | 888 |
(...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3805 reinterpret_cast<uint64_t>( | 3810 reinterpret_cast<uint64_t>( |
3806 isolate->builtins()->OnStackReplacement()->entry())); | 3811 isolate->builtins()->OnStackReplacement()->entry())); |
3807 return ON_STACK_REPLACEMENT; | 3812 return ON_STACK_REPLACEMENT; |
3808 } | 3813 } |
3809 | 3814 |
3810 | 3815 |
3811 } // namespace internal | 3816 } // namespace internal |
3812 } // namespace v8 | 3817 } // namespace v8 |
3813 | 3818 |
3814 #endif // V8_TARGET_ARCH_MIPS64 | 3819 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |