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 11830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11841 VariableProxy* proxy = declaration->proxy(); | 11841 VariableProxy* proxy = declaration->proxy(); |
11842 Variable* variable = proxy->var(); | 11842 Variable* variable = proxy->var(); |
11843 switch (variable->location()) { | 11843 switch (variable->location()) { |
11844 case VariableLocation::UNALLOCATED: { | 11844 case VariableLocation::UNALLOCATED: { |
11845 DCHECK(!variable->binding_needs_init()); | 11845 DCHECK(!variable->binding_needs_init()); |
11846 globals_.Add(variable->name(), zone()); | 11846 globals_.Add(variable->name(), zone()); |
11847 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 11847 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
11848 DCHECK(!slot.IsInvalid()); | 11848 DCHECK(!slot.IsInvalid()); |
11849 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 11849 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
11850 globals_.Add(isolate()->factory()->undefined_value(), zone()); | 11850 globals_.Add(isolate()->factory()->undefined_value(), zone()); |
| 11851 globals_.Add(isolate()->factory()->undefined_value(), zone()); |
11851 return; | 11852 return; |
11852 } | 11853 } |
11853 case VariableLocation::PARAMETER: | 11854 case VariableLocation::PARAMETER: |
11854 case VariableLocation::LOCAL: | 11855 case VariableLocation::LOCAL: |
11855 if (variable->binding_needs_init()) { | 11856 if (variable->binding_needs_init()) { |
11856 HValue* value = graph()->GetConstantHole(); | 11857 HValue* value = graph()->GetConstantHole(); |
11857 environment()->Bind(variable, value); | 11858 environment()->Bind(variable, value); |
11858 } | 11859 } |
11859 break; | 11860 break; |
11860 case VariableLocation::CONTEXT: | 11861 case VariableLocation::CONTEXT: |
(...skipping 18 matching lines...) Expand all Loading... |
11879 void HOptimizedGraphBuilder::VisitFunctionDeclaration( | 11880 void HOptimizedGraphBuilder::VisitFunctionDeclaration( |
11880 FunctionDeclaration* declaration) { | 11881 FunctionDeclaration* declaration) { |
11881 VariableProxy* proxy = declaration->proxy(); | 11882 VariableProxy* proxy = declaration->proxy(); |
11882 Variable* variable = proxy->var(); | 11883 Variable* variable = proxy->var(); |
11883 switch (variable->location()) { | 11884 switch (variable->location()) { |
11884 case VariableLocation::UNALLOCATED: { | 11885 case VariableLocation::UNALLOCATED: { |
11885 globals_.Add(variable->name(), zone()); | 11886 globals_.Add(variable->name(), zone()); |
11886 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 11887 FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); |
11887 DCHECK(!slot.IsInvalid()); | 11888 DCHECK(!slot.IsInvalid()); |
11888 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 11889 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 11890 |
| 11891 // We need the slot where the literals array lives, too. |
| 11892 slot = declaration->fun()->LiteralFeedbackSlot(); |
| 11893 DCHECK(!slot.IsInvalid()); |
| 11894 globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); |
| 11895 |
11889 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( | 11896 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( |
11890 declaration->fun(), current_info()->script(), top_info()); | 11897 declaration->fun(), current_info()->script(), top_info()); |
11891 // Check for stack-overflow exception. | 11898 // Check for stack-overflow exception. |
11892 if (function.is_null()) return SetStackOverflow(); | 11899 if (function.is_null()) return SetStackOverflow(); |
11893 globals_.Add(function, zone()); | 11900 globals_.Add(function, zone()); |
11894 return; | 11901 return; |
11895 } | 11902 } |
11896 case VariableLocation::PARAMETER: | 11903 case VariableLocation::PARAMETER: |
11897 case VariableLocation::LOCAL: { | 11904 case VariableLocation::LOCAL: { |
11898 CHECK_ALIVE(VisitForValue(declaration->fun())); | 11905 CHECK_ALIVE(VisitForValue(declaration->fun())); |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13012 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13019 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13013 } | 13020 } |
13014 | 13021 |
13015 #ifdef DEBUG | 13022 #ifdef DEBUG |
13016 graph_->Verify(false); // No full verify. | 13023 graph_->Verify(false); // No full verify. |
13017 #endif | 13024 #endif |
13018 } | 13025 } |
13019 | 13026 |
13020 } // namespace internal | 13027 } // namespace internal |
13021 } // namespace v8 | 13028 } // namespace v8 |
OLD | NEW |