OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
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/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) { | 926 void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) { |
927 Variable* variable = decl->proxy()->var(); | 927 Variable* variable = decl->proxy()->var(); |
928 switch (variable->location()) { | 928 switch (variable->location()) { |
929 case VariableLocation::UNALLOCATED: { | 929 case VariableLocation::UNALLOCATED: { |
930 DCHECK(!variable->binding_needs_init()); | 930 DCHECK(!variable->binding_needs_init()); |
931 globals()->push_back(variable->name()); | 931 globals()->push_back(variable->name()); |
932 FeedbackVectorSlot slot = decl->proxy()->VariableFeedbackSlot(); | 932 FeedbackVectorSlot slot = decl->proxy()->VariableFeedbackSlot(); |
933 DCHECK(!slot.IsInvalid()); | 933 DCHECK(!slot.IsInvalid()); |
934 globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); | 934 globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); |
935 globals()->push_back(isolate()->factory()->undefined_value()); | 935 globals()->push_back(isolate()->factory()->undefined_value()); |
| 936 globals()->push_back(isolate()->factory()->undefined_value()); |
936 break; | 937 break; |
937 } | 938 } |
938 case VariableLocation::PARAMETER: | 939 case VariableLocation::PARAMETER: |
939 case VariableLocation::LOCAL: | 940 case VariableLocation::LOCAL: |
940 if (variable->binding_needs_init()) { | 941 if (variable->binding_needs_init()) { |
941 Node* value = jsgraph()->TheHoleConstant(); | 942 Node* value = jsgraph()->TheHoleConstant(); |
942 environment()->Bind(variable, value); | 943 environment()->Bind(variable, value); |
943 } | 944 } |
944 break; | 945 break; |
945 case VariableLocation::CONTEXT: | 946 case VariableLocation::CONTEXT: |
(...skipping 15 matching lines...) Expand all Loading... |
961 switch (variable->location()) { | 962 switch (variable->location()) { |
962 case VariableLocation::UNALLOCATED: { | 963 case VariableLocation::UNALLOCATED: { |
963 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( | 964 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( |
964 decl->fun(), info()->script(), info()); | 965 decl->fun(), info()->script(), info()); |
965 // Check for stack-overflow exception. | 966 // Check for stack-overflow exception. |
966 if (function.is_null()) return SetStackOverflow(); | 967 if (function.is_null()) return SetStackOverflow(); |
967 globals()->push_back(variable->name()); | 968 globals()->push_back(variable->name()); |
968 FeedbackVectorSlot slot = decl->proxy()->VariableFeedbackSlot(); | 969 FeedbackVectorSlot slot = decl->proxy()->VariableFeedbackSlot(); |
969 DCHECK(!slot.IsInvalid()); | 970 DCHECK(!slot.IsInvalid()); |
970 globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); | 971 globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); |
| 972 |
| 973 // We need the slot where the literals array lives, too. |
| 974 slot = decl->fun()->LiteralFeedbackSlot(); |
| 975 DCHECK(!slot.IsInvalid()); |
| 976 globals()->push_back(handle(Smi::FromInt(slot.ToInt()), isolate())); |
| 977 |
971 globals()->push_back(function); | 978 globals()->push_back(function); |
972 break; | 979 break; |
973 } | 980 } |
974 case VariableLocation::PARAMETER: | 981 case VariableLocation::PARAMETER: |
975 case VariableLocation::LOCAL: { | 982 case VariableLocation::LOCAL: { |
976 VisitForValue(decl->fun()); | 983 VisitForValue(decl->fun()); |
977 Node* value = environment()->Pop(); | 984 Node* value = environment()->Pop(); |
978 environment()->Bind(variable, value); | 985 environment()->Bind(variable, value); |
979 break; | 986 break; |
980 } | 987 } |
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3300 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, | 3307 float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, |
3301 SourcePositionTable* source_positions, int inlining_id) | 3308 SourcePositionTable* source_positions, int inlining_id) |
3302 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, | 3309 : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, |
3303 loop_assignment), | 3310 loop_assignment), |
3304 source_positions_(source_positions), | 3311 source_positions_(source_positions), |
3305 start_position_(info->shared_info()->start_position(), inlining_id) {} | 3312 start_position_(info->shared_info()->start_position(), inlining_id) {} |
3306 | 3313 |
3307 } // namespace compiler | 3314 } // namespace compiler |
3308 } // namespace internal | 3315 } // namespace internal |
3309 } // namespace v8 | 3316 } // namespace v8 |
OLD | NEW |