OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 VariableDeclaration* declaration) { | 728 VariableDeclaration* declaration) { |
729 // If it was not possible to allocate the variable at compile time, we | 729 // If it was not possible to allocate the variable at compile time, we |
730 // need to "declare" it at runtime to make sure it actually exists in the | 730 // need to "declare" it at runtime to make sure it actually exists in the |
731 // local context. | 731 // local context. |
732 VariableProxy* proxy = declaration->proxy(); | 732 VariableProxy* proxy = declaration->proxy(); |
733 VariableMode mode = declaration->mode(); | 733 VariableMode mode = declaration->mode(); |
734 Variable* variable = proxy->var(); | 734 Variable* variable = proxy->var(); |
735 bool hole_init = mode == LET || mode == CONST; | 735 bool hole_init = mode == LET || mode == CONST; |
736 switch (variable->location()) { | 736 switch (variable->location()) { |
737 case VariableLocation::GLOBAL: | 737 case VariableLocation::GLOBAL: |
738 case VariableLocation::UNALLOCATED: | 738 case VariableLocation::UNALLOCATED: { |
739 DCHECK(!variable->binding_needs_init()); | 739 DCHECK(!variable->binding_needs_init()); |
740 globals_->Add(variable->name(), zone()); | 740 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 741 DCHECK(!slot.IsInvalid()); |
| 742 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
741 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 743 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
742 break; | 744 break; |
743 | 745 } |
744 case VariableLocation::PARAMETER: | 746 case VariableLocation::PARAMETER: |
745 case VariableLocation::LOCAL: | 747 case VariableLocation::LOCAL: |
746 if (hole_init) { | 748 if (hole_init) { |
747 Comment cmnt(masm_, "[ VariableDeclaration"); | 749 Comment cmnt(masm_, "[ VariableDeclaration"); |
748 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 750 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
749 __ StoreP(ip, StackOperand(variable)); | 751 __ StoreP(ip, StackOperand(variable)); |
750 } | 752 } |
751 break; | 753 break; |
752 | 754 |
753 case VariableLocation::CONTEXT: | 755 case VariableLocation::CONTEXT: |
(...skipping 21 matching lines...) Expand all Loading... |
775 } | 777 } |
776 | 778 |
777 | 779 |
778 void FullCodeGenerator::VisitFunctionDeclaration( | 780 void FullCodeGenerator::VisitFunctionDeclaration( |
779 FunctionDeclaration* declaration) { | 781 FunctionDeclaration* declaration) { |
780 VariableProxy* proxy = declaration->proxy(); | 782 VariableProxy* proxy = declaration->proxy(); |
781 Variable* variable = proxy->var(); | 783 Variable* variable = proxy->var(); |
782 switch (variable->location()) { | 784 switch (variable->location()) { |
783 case VariableLocation::GLOBAL: | 785 case VariableLocation::GLOBAL: |
784 case VariableLocation::UNALLOCATED: { | 786 case VariableLocation::UNALLOCATED: { |
785 globals_->Add(variable->name(), zone()); | 787 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 788 DCHECK(!slot.IsInvalid()); |
| 789 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
786 Handle<SharedFunctionInfo> function = | 790 Handle<SharedFunctionInfo> function = |
787 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 791 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
788 // Check for stack-overflow exception. | 792 // Check for stack-overflow exception. |
789 if (function.is_null()) return SetStackOverflow(); | 793 if (function.is_null()) return SetStackOverflow(); |
790 globals_->Add(function, zone()); | 794 globals_->Add(function, zone()); |
791 break; | 795 break; |
792 } | 796 } |
793 | 797 |
794 case VariableLocation::PARAMETER: | 798 case VariableLocation::PARAMETER: |
795 case VariableLocation::LOCAL: { | 799 case VariableLocation::LOCAL: { |
(...skipping 29 matching lines...) Expand all Loading... |
825 break; | 829 break; |
826 } | 830 } |
827 } | 831 } |
828 } | 832 } |
829 | 833 |
830 | 834 |
831 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 835 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
832 // Call the runtime to declare the globals. | 836 // Call the runtime to declare the globals. |
833 __ mov(r4, Operand(pairs)); | 837 __ mov(r4, Operand(pairs)); |
834 __ LoadSmiLiteral(r3, Smi::FromInt(DeclareGlobalsFlags())); | 838 __ LoadSmiLiteral(r3, Smi::FromInt(DeclareGlobalsFlags())); |
835 __ Push(r4, r3); | 839 __ EmitLoadTypeFeedbackVector(r0); |
| 840 __ Push(r4, r3, r0); |
836 __ CallRuntime(Runtime::kDeclareGlobals); | 841 __ CallRuntime(Runtime::kDeclareGlobals); |
837 // Return value is ignored. | 842 // Return value is ignored. |
838 } | 843 } |
839 | 844 |
840 | 845 |
841 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 846 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
842 Comment cmnt(masm_, "[ SwitchStatement"); | 847 Comment cmnt(masm_, "[ SwitchStatement"); |
843 Breakable nested_statement(this, stmt); | 848 Breakable nested_statement(this, stmt); |
844 SetStatementPosition(stmt); | 849 SetStatementPosition(stmt); |
845 | 850 |
(...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3776 | 3781 |
3777 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3782 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
3778 | 3783 |
3779 DCHECK(interrupt_address == | 3784 DCHECK(interrupt_address == |
3780 isolate->builtins()->OnStackReplacement()->entry()); | 3785 isolate->builtins()->OnStackReplacement()->entry()); |
3781 return ON_STACK_REPLACEMENT; | 3786 return ON_STACK_REPLACEMENT; |
3782 } | 3787 } |
3783 } // namespace internal | 3788 } // namespace internal |
3784 } // namespace v8 | 3789 } // namespace v8 |
3785 #endif // V8_TARGET_ARCH_PPC | 3790 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |