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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 VariableDeclaration* declaration) { | 763 VariableDeclaration* declaration) { |
764 // If it was not possible to allocate the variable at compile time, we | 764 // If it was not possible to allocate the variable at compile time, we |
765 // need to "declare" it at runtime to make sure it actually exists in the | 765 // need to "declare" it at runtime to make sure it actually exists in the |
766 // local context. | 766 // local context. |
767 VariableProxy* proxy = declaration->proxy(); | 767 VariableProxy* proxy = declaration->proxy(); |
768 VariableMode mode = declaration->mode(); | 768 VariableMode mode = declaration->mode(); |
769 Variable* variable = proxy->var(); | 769 Variable* variable = proxy->var(); |
770 bool hole_init = mode == LET || mode == CONST; | 770 bool hole_init = mode == LET || mode == CONST; |
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(t0, Heap::kTheHoleValueRootIndex); | 785 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
784 __ sw(t0, StackOperand(variable)); | 786 __ sw(t0, 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 break; | 868 break; |
865 } | 869 } |
866 } | 870 } |
867 } | 871 } |
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 __ li(a1, Operand(pairs)); | 876 __ li(a1, Operand(pairs)); |
873 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); | 877 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); |
874 __ Push(a1, a0); | 878 __ EmitLoadTypeFeedbackVector(a2); |
| 879 __ Push(a1, a0, a2); |
875 __ CallRuntime(Runtime::kDeclareGlobals); | 880 __ CallRuntime(Runtime::kDeclareGlobals); |
876 // Return value is ignored. | 881 // Return value is ignored. |
877 } | 882 } |
878 | 883 |
879 | 884 |
880 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 885 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
881 Comment cmnt(masm_, "[ SwitchStatement"); | 886 Comment cmnt(masm_, "[ SwitchStatement"); |
882 Breakable nested_statement(this, stmt); | 887 Breakable nested_statement(this, stmt); |
883 SetStatementPosition(stmt); | 888 SetStatementPosition(stmt); |
884 | 889 |
(...skipping 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 reinterpret_cast<uint32_t>( | 3803 reinterpret_cast<uint32_t>( |
3799 isolate->builtins()->OnStackReplacement()->entry())); | 3804 isolate->builtins()->OnStackReplacement()->entry())); |
3800 return ON_STACK_REPLACEMENT; | 3805 return ON_STACK_REPLACEMENT; |
3801 } | 3806 } |
3802 | 3807 |
3803 | 3808 |
3804 } // namespace internal | 3809 } // namespace internal |
3805 } // namespace v8 | 3810 } // namespace v8 |
3806 | 3811 |
3807 #endif // V8_TARGET_ARCH_MIPS | 3812 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |