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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 VariableProxy* proxy = declaration->proxy(); | 716 VariableProxy* proxy = declaration->proxy(); |
717 Variable* variable = proxy->var(); | 717 Variable* variable = proxy->var(); |
718 DCHECK(!variable->binding_needs_init()); | 718 DCHECK(!variable->binding_needs_init()); |
719 switch (variable->location()) { | 719 switch (variable->location()) { |
720 case VariableLocation::UNALLOCATED: { | 720 case VariableLocation::UNALLOCATED: { |
721 globals_->Add(variable->name(), zone()); | 721 globals_->Add(variable->name(), zone()); |
722 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 722 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
723 DCHECK(!slot.IsInvalid()); | 723 DCHECK(!slot.IsInvalid()); |
724 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 724 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
725 globals_->Add(isolate()->factory()->undefined_value(), zone()); | 725 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
| 726 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
726 break; | 727 break; |
727 } | 728 } |
728 case VariableLocation::PARAMETER: | 729 case VariableLocation::PARAMETER: |
729 case VariableLocation::LOCAL: | 730 case VariableLocation::LOCAL: |
730 case VariableLocation::CONTEXT: | 731 case VariableLocation::CONTEXT: |
731 break; | 732 break; |
732 | 733 |
733 case VariableLocation::LOOKUP: | 734 case VariableLocation::LOOKUP: |
734 case VariableLocation::MODULE: | 735 case VariableLocation::MODULE: |
735 UNREACHABLE(); | 736 UNREACHABLE(); |
736 } | 737 } |
737 } | 738 } |
738 | 739 |
739 | 740 |
740 void FullCodeGenerator::VisitFunctionDeclaration( | 741 void FullCodeGenerator::VisitFunctionDeclaration( |
741 FunctionDeclaration* declaration) { | 742 FunctionDeclaration* declaration) { |
742 VariableProxy* proxy = declaration->proxy(); | 743 VariableProxy* proxy = declaration->proxy(); |
743 Variable* variable = proxy->var(); | 744 Variable* variable = proxy->var(); |
744 switch (variable->location()) { | 745 switch (variable->location()) { |
745 case VariableLocation::UNALLOCATED: { | 746 case VariableLocation::UNALLOCATED: { |
746 globals_->Add(variable->name(), zone()); | 747 globals_->Add(variable->name(), zone()); |
747 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 748 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
748 DCHECK(!slot.IsInvalid()); | 749 DCHECK(!slot.IsInvalid()); |
749 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 750 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 751 |
| 752 // We need the slot where the literals array lives, too. |
| 753 slot = declaration->fun()->LiteralFeedbackSlot(); |
| 754 DCHECK(!slot.IsInvalid()); |
| 755 globals_->Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 756 |
750 Handle<SharedFunctionInfo> function = | 757 Handle<SharedFunctionInfo> function = |
751 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 758 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
752 // Check for stack-overflow exception. | 759 // Check for stack-overflow exception. |
753 if (function.is_null()) return SetStackOverflow(); | 760 if (function.is_null()) return SetStackOverflow(); |
754 globals_->Add(function, zone()); | 761 globals_->Add(function, zone()); |
755 break; | 762 break; |
756 } | 763 } |
757 | 764 |
758 case VariableLocation::PARAMETER: | 765 case VariableLocation::PARAMETER: |
759 case VariableLocation::LOCAL: { | 766 case VariableLocation::LOCAL: { |
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2685 DCHECK_EQ( | 2692 DCHECK_EQ( |
2686 isolate->builtins()->OnStackReplacement()->entry(), | 2693 isolate->builtins()->OnStackReplacement()->entry(), |
2687 Assembler::target_address_at(call_target_address, unoptimized_code)); | 2694 Assembler::target_address_at(call_target_address, unoptimized_code)); |
2688 return ON_STACK_REPLACEMENT; | 2695 return ON_STACK_REPLACEMENT; |
2689 } | 2696 } |
2690 | 2697 |
2691 } // namespace internal | 2698 } // namespace internal |
2692 } // namespace v8 | 2699 } // namespace v8 |
2693 | 2700 |
2694 #endif // V8_TARGET_ARCH_X64 | 2701 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |