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