| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 VariableDeclaration* declaration) { | 766 VariableDeclaration* declaration) { |
| 767 // If it was not possible to allocate the variable at compile time, we | 767 // If it was not possible to allocate the variable at compile time, we |
| 768 // need to "declare" it at runtime to make sure it actually exists in the | 768 // need to "declare" it at runtime to make sure it actually exists in the |
| 769 // local context. | 769 // local context. |
| 770 VariableProxy* proxy = declaration->proxy(); | 770 VariableProxy* proxy = declaration->proxy(); |
| 771 VariableMode mode = declaration->mode(); | 771 VariableMode mode = declaration->mode(); |
| 772 Variable* variable = proxy->var(); | 772 Variable* variable = proxy->var(); |
| 773 bool hole_init = mode == LET || mode == CONST; | 773 bool hole_init = mode == LET || mode == CONST; |
| 774 switch (variable->location()) { | 774 switch (variable->location()) { |
| 775 case VariableLocation::GLOBAL: | 775 case VariableLocation::GLOBAL: |
| 776 case VariableLocation::UNALLOCATED: | 776 case VariableLocation::UNALLOCATED: { |
| 777 DCHECK(!variable->binding_needs_init()); | 777 DCHECK(!variable->binding_needs_init()); |
| 778 globals_->Add(variable->name(), zone()); | 778 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 779 DCHECK(!slot.IsInvalid()); |
| 780 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 779 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 781 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
| 780 break; | 782 break; |
| 781 | 783 } |
| 782 case VariableLocation::PARAMETER: | 784 case VariableLocation::PARAMETER: |
| 783 case VariableLocation::LOCAL: | 785 case VariableLocation::LOCAL: |
| 784 if (hole_init) { | 786 if (hole_init) { |
| 785 Comment cmnt(masm_, "[ VariableDeclaration"); | 787 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 786 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); | 788 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); |
| 787 __ str(r0, StackOperand(variable)); | 789 __ str(r0, StackOperand(variable)); |
| 788 } | 790 } |
| 789 break; | 791 break; |
| 790 | 792 |
| 791 case VariableLocation::CONTEXT: | 793 case VariableLocation::CONTEXT: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 813 } | 815 } |
| 814 | 816 |
| 815 | 817 |
| 816 void FullCodeGenerator::VisitFunctionDeclaration( | 818 void FullCodeGenerator::VisitFunctionDeclaration( |
| 817 FunctionDeclaration* declaration) { | 819 FunctionDeclaration* declaration) { |
| 818 VariableProxy* proxy = declaration->proxy(); | 820 VariableProxy* proxy = declaration->proxy(); |
| 819 Variable* variable = proxy->var(); | 821 Variable* variable = proxy->var(); |
| 820 switch (variable->location()) { | 822 switch (variable->location()) { |
| 821 case VariableLocation::GLOBAL: | 823 case VariableLocation::GLOBAL: |
| 822 case VariableLocation::UNALLOCATED: { | 824 case VariableLocation::UNALLOCATED: { |
| 823 globals_->Add(variable->name(), zone()); | 825 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 826 DCHECK(!slot.IsInvalid()); |
| 827 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 824 Handle<SharedFunctionInfo> function = | 828 Handle<SharedFunctionInfo> function = |
| 825 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 829 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
| 826 // Check for stack-overflow exception. | 830 // Check for stack-overflow exception. |
| 827 if (function.is_null()) return SetStackOverflow(); | 831 if (function.is_null()) return SetStackOverflow(); |
| 828 globals_->Add(function, zone()); | 832 globals_->Add(function, zone()); |
| 829 break; | 833 break; |
| 830 } | 834 } |
| 831 | 835 |
| 832 case VariableLocation::PARAMETER: | 836 case VariableLocation::PARAMETER: |
| 833 case VariableLocation::LOCAL: { | 837 case VariableLocation::LOCAL: { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 break; | 871 break; |
| 868 } | 872 } |
| 869 } | 873 } |
| 870 } | 874 } |
| 871 | 875 |
| 872 | 876 |
| 873 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 877 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| 874 // Call the runtime to declare the globals. | 878 // Call the runtime to declare the globals. |
| 875 __ mov(r1, Operand(pairs)); | 879 __ mov(r1, Operand(pairs)); |
| 876 __ mov(r0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); | 880 __ mov(r0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); |
| 877 __ Push(r1, r0); | 881 __ EmitLoadTypeFeedbackVector(r2); |
| 882 __ Push(r1, r0, r2); |
| 878 __ CallRuntime(Runtime::kDeclareGlobals); | 883 __ CallRuntime(Runtime::kDeclareGlobals); |
| 879 // Return value is ignored. | 884 // Return value is ignored. |
| 880 } | 885 } |
| 881 | 886 |
| 882 | 887 |
| 883 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 888 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
| 884 Comment cmnt(masm_, "[ SwitchStatement"); | 889 Comment cmnt(masm_, "[ SwitchStatement"); |
| 885 Breakable nested_statement(this, stmt); | 890 Breakable nested_statement(this, stmt); |
| 886 SetStatementPosition(stmt); | 891 SetStatementPosition(stmt); |
| 887 | 892 |
| (...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3854 DCHECK(interrupt_address == | 3859 DCHECK(interrupt_address == |
| 3855 isolate->builtins()->OnStackReplacement()->entry()); | 3860 isolate->builtins()->OnStackReplacement()->entry()); |
| 3856 return ON_STACK_REPLACEMENT; | 3861 return ON_STACK_REPLACEMENT; |
| 3857 } | 3862 } |
| 3858 | 3863 |
| 3859 | 3864 |
| 3860 } // namespace internal | 3865 } // namespace internal |
| 3861 } // namespace v8 | 3866 } // namespace v8 |
| 3862 | 3867 |
| 3863 #endif // V8_TARGET_ARCH_ARM | 3868 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |