OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 11769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11780 VariableProxy* proxy = declaration->proxy(); | 11780 VariableProxy* proxy = declaration->proxy(); |
11781 Variable* variable = proxy->var(); | 11781 Variable* variable = proxy->var(); |
11782 DCHECK(!variable->binding_needs_init()); | 11782 DCHECK(!variable->binding_needs_init()); |
11783 switch (variable->location()) { | 11783 switch (variable->location()) { |
11784 case VariableLocation::UNALLOCATED: { | 11784 case VariableLocation::UNALLOCATED: { |
11785 globals_.Add(variable->name(), zone()); | 11785 globals_.Add(variable->name(), zone()); |
11786 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 11786 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
11787 DCHECK(!slot.IsInvalid()); | 11787 DCHECK(!slot.IsInvalid()); |
11788 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 11788 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
11789 globals_.Add(isolate()->factory()->undefined_value(), zone()); | 11789 globals_.Add(isolate()->factory()->undefined_value(), zone()); |
| 11790 globals_.Add(isolate()->factory()->undefined_value(), zone()); |
11790 return; | 11791 return; |
11791 } | 11792 } |
11792 case VariableLocation::PARAMETER: | 11793 case VariableLocation::PARAMETER: |
11793 case VariableLocation::LOCAL: | 11794 case VariableLocation::LOCAL: |
11794 case VariableLocation::CONTEXT: | 11795 case VariableLocation::CONTEXT: |
11795 break; | 11796 break; |
11796 case VariableLocation::LOOKUP: | 11797 case VariableLocation::LOOKUP: |
11797 return Bailout(kUnsupportedLookupSlotInDeclaration); | 11798 return Bailout(kUnsupportedLookupSlotInDeclaration); |
11798 case VariableLocation::MODULE: | 11799 case VariableLocation::MODULE: |
11799 UNREACHABLE(); | 11800 UNREACHABLE(); |
11800 } | 11801 } |
11801 } | 11802 } |
11802 | 11803 |
11803 | 11804 |
11804 void HOptimizedGraphBuilder::VisitFunctionDeclaration( | 11805 void HOptimizedGraphBuilder::VisitFunctionDeclaration( |
11805 FunctionDeclaration* declaration) { | 11806 FunctionDeclaration* declaration) { |
11806 VariableProxy* proxy = declaration->proxy(); | 11807 VariableProxy* proxy = declaration->proxy(); |
11807 Variable* variable = proxy->var(); | 11808 Variable* variable = proxy->var(); |
11808 switch (variable->location()) { | 11809 switch (variable->location()) { |
11809 case VariableLocation::UNALLOCATED: { | 11810 case VariableLocation::UNALLOCATED: { |
11810 globals_.Add(variable->name(), zone()); | 11811 globals_.Add(variable->name(), zone()); |
11811 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 11812 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
11812 DCHECK(!slot.IsInvalid()); | 11813 DCHECK(!slot.IsInvalid()); |
11813 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 11814 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 11815 |
| 11816 // We need the slot where the literals array lives, too. |
| 11817 slot = declaration->fun()->LiteralFeedbackSlot(); |
| 11818 DCHECK(!slot.IsInvalid()); |
| 11819 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 11820 |
11814 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( | 11821 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( |
11815 declaration->fun(), current_info()->script(), top_info()); | 11822 declaration->fun(), current_info()->script(), top_info()); |
11816 // Check for stack-overflow exception. | 11823 // Check for stack-overflow exception. |
11817 if (function.is_null()) return SetStackOverflow(); | 11824 if (function.is_null()) return SetStackOverflow(); |
11818 globals_.Add(function, zone()); | 11825 globals_.Add(function, zone()); |
11819 return; | 11826 return; |
11820 } | 11827 } |
11821 case VariableLocation::PARAMETER: | 11828 case VariableLocation::PARAMETER: |
11822 case VariableLocation::LOCAL: { | 11829 case VariableLocation::LOCAL: { |
11823 CHECK_ALIVE(VisitForValue(declaration->fun())); | 11830 CHECK_ALIVE(VisitForValue(declaration->fun())); |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12937 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12944 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12938 } | 12945 } |
12939 | 12946 |
12940 #ifdef DEBUG | 12947 #ifdef DEBUG |
12941 graph_->Verify(false); // No full verify. | 12948 graph_->Verify(false); // No full verify. |
12942 #endif | 12949 #endif |
12943 } | 12950 } |
12944 | 12951 |
12945 } // namespace internal | 12952 } // namespace internal |
12946 } // namespace v8 | 12953 } // namespace v8 |
OLD | NEW |