OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 VariableDeclaration* declaration) { | 706 VariableDeclaration* declaration) { |
707 // If it was not possible to allocate the variable at compile time, we | 707 // If it was not possible to allocate the variable at compile time, we |
708 // need to "declare" it at runtime to make sure it actually exists in the | 708 // need to "declare" it at runtime to make sure it actually exists in the |
709 // local context. | 709 // local context. |
710 VariableProxy* proxy = declaration->proxy(); | 710 VariableProxy* proxy = declaration->proxy(); |
711 VariableMode mode = declaration->mode(); | 711 VariableMode mode = declaration->mode(); |
712 Variable* variable = proxy->var(); | 712 Variable* variable = proxy->var(); |
713 bool hole_init = mode == LET || mode == CONST; | 713 bool hole_init = mode == LET || mode == CONST; |
714 switch (variable->location()) { | 714 switch (variable->location()) { |
715 case VariableLocation::GLOBAL: | 715 case VariableLocation::GLOBAL: |
716 case VariableLocation::UNALLOCATED: | 716 case VariableLocation::UNALLOCATED: { |
717 DCHECK(!variable->binding_needs_init()); | 717 DCHECK(!variable->binding_needs_init()); |
718 globals_->Add(variable->name(), zone()); | 718 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 719 DCHECK(!slot.IsInvalid()); |
| 720 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
719 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 721 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
720 break; | 722 break; |
721 | 723 } |
722 case VariableLocation::PARAMETER: | 724 case VariableLocation::PARAMETER: |
723 case VariableLocation::LOCAL: | 725 case VariableLocation::LOCAL: |
724 if (hole_init) { | 726 if (hole_init) { |
725 Comment cmnt(masm_, "[ VariableDeclaration"); | 727 Comment cmnt(masm_, "[ VariableDeclaration"); |
726 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 728 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
727 __ StoreP(ip, StackOperand(variable)); | 729 __ StoreP(ip, StackOperand(variable)); |
728 } | 730 } |
729 break; | 731 break; |
730 | 732 |
731 case VariableLocation::CONTEXT: | 733 case VariableLocation::CONTEXT: |
(...skipping 20 matching lines...) Expand all Loading... |
752 } | 754 } |
753 } | 755 } |
754 | 756 |
755 void FullCodeGenerator::VisitFunctionDeclaration( | 757 void FullCodeGenerator::VisitFunctionDeclaration( |
756 FunctionDeclaration* declaration) { | 758 FunctionDeclaration* declaration) { |
757 VariableProxy* proxy = declaration->proxy(); | 759 VariableProxy* proxy = declaration->proxy(); |
758 Variable* variable = proxy->var(); | 760 Variable* variable = proxy->var(); |
759 switch (variable->location()) { | 761 switch (variable->location()) { |
760 case VariableLocation::GLOBAL: | 762 case VariableLocation::GLOBAL: |
761 case VariableLocation::UNALLOCATED: { | 763 case VariableLocation::UNALLOCATED: { |
762 globals_->Add(variable->name(), zone()); | 764 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
| 765 DCHECK(!slot.IsInvalid()); |
| 766 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
763 Handle<SharedFunctionInfo> function = | 767 Handle<SharedFunctionInfo> function = |
764 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 768 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
765 // Check for stack-overflow exception. | 769 // Check for stack-overflow exception. |
766 if (function.is_null()) return SetStackOverflow(); | 770 if (function.is_null()) return SetStackOverflow(); |
767 globals_->Add(function, zone()); | 771 globals_->Add(function, zone()); |
768 break; | 772 break; |
769 } | 773 } |
770 | 774 |
771 case VariableLocation::PARAMETER: | 775 case VariableLocation::PARAMETER: |
772 case VariableLocation::LOCAL: { | 776 case VariableLocation::LOCAL: { |
(...skipping 27 matching lines...) Expand all Loading... |
800 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 804 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
801 break; | 805 break; |
802 } | 806 } |
803 } | 807 } |
804 } | 808 } |
805 | 809 |
806 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 810 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
807 // Call the runtime to declare the globals. | 811 // Call the runtime to declare the globals. |
808 __ mov(r3, Operand(pairs)); | 812 __ mov(r3, Operand(pairs)); |
809 __ LoadSmiLiteral(r2, Smi::FromInt(DeclareGlobalsFlags())); | 813 __ LoadSmiLiteral(r2, Smi::FromInt(DeclareGlobalsFlags())); |
810 __ Push(r3, r2); | 814 __ EmitLoadTypeFeedbackVector(r0); |
| 815 __ Push(r3, r2, r0); |
811 __ CallRuntime(Runtime::kDeclareGlobals); | 816 __ CallRuntime(Runtime::kDeclareGlobals); |
812 // Return value is ignored. | 817 // Return value is ignored. |
813 } | 818 } |
814 | 819 |
815 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | 820 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
816 Comment cmnt(masm_, "[ SwitchStatement"); | 821 Comment cmnt(masm_, "[ SwitchStatement"); |
817 Breakable nested_statement(this, stmt); | 822 Breakable nested_statement(this, stmt); |
818 SetStatementPosition(stmt); | 823 SetStatementPosition(stmt); |
819 | 824 |
820 // Keep the switch value on the stack until a case matches. | 825 // Keep the switch value on the stack until a case matches. |
(...skipping 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3689 DCHECK(kOSRBranchInstruction == br_instr); | 3694 DCHECK(kOSRBranchInstruction == br_instr); |
3690 | 3695 |
3691 DCHECK(interrupt_address == | 3696 DCHECK(interrupt_address == |
3692 isolate->builtins()->OnStackReplacement()->entry()); | 3697 isolate->builtins()->OnStackReplacement()->entry()); |
3693 return ON_STACK_REPLACEMENT; | 3698 return ON_STACK_REPLACEMENT; |
3694 } | 3699 } |
3695 | 3700 |
3696 } // namespace internal | 3701 } // namespace internal |
3697 } // namespace v8 | 3702 } // namespace v8 |
3698 #endif // V8_TARGET_ARCH_S390 | 3703 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |