OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/escape-analysis.h" | 5 #include "src/compiler/escape-analysis.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
11 #include "src/compilation-dependencies.h" | 11 #include "src/compilation-dependencies.h" |
12 #include "src/compiler/common-operator.h" | 12 #include "src/compiler/common-operator.h" |
13 #include "src/compiler/graph-reducer.h" | 13 #include "src/compiler/graph-reducer.h" |
14 #include "src/compiler/js-operator.h" | 14 #include "src/compiler/js-operator.h" |
| 15 #include "src/compiler/linkage.h" |
15 #include "src/compiler/node-matchers.h" | 16 #include "src/compiler/node-matchers.h" |
16 #include "src/compiler/node-properties.h" | 17 #include "src/compiler/node-properties.h" |
17 #include "src/compiler/node.h" | 18 #include "src/compiler/node.h" |
18 #include "src/compiler/operator-properties.h" | 19 #include "src/compiler/operator-properties.h" |
19 #include "src/compiler/simplified-operator.h" | 20 #include "src/compiler/simplified-operator.h" |
20 #include "src/compiler/type-cache.h" | 21 #include "src/compiler/type-cache.h" |
21 #include "src/objects-inl.h" | 22 #include "src/objects-inl.h" |
22 | 23 |
23 namespace v8 { | 24 namespace v8 { |
24 namespace internal { | 25 namespace internal { |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 if (++count > 1) { | 1061 if (++count > 1) { |
1061 status_[node->id()] |= kBranchPointComputed | kBranchPoint; | 1062 status_[node->id()] |= kBranchPointComputed | kBranchPoint; |
1062 return true; | 1063 return true; |
1063 } | 1064 } |
1064 } | 1065 } |
1065 } | 1066 } |
1066 status_[node->id()] |= kBranchPointComputed; | 1067 status_[node->id()] |= kBranchPointComputed; |
1067 return false; | 1068 return false; |
1068 } | 1069 } |
1069 | 1070 |
| 1071 namespace { |
| 1072 |
| 1073 bool HasFrameStateInput(const Operator* op) { |
| 1074 if (op->opcode() == IrOpcode::kCall || op->opcode() == IrOpcode::kTailCall) { |
| 1075 const CallDescriptor* d = CallDescriptorOf(op); |
| 1076 return d->NeedsFrameState(); |
| 1077 } else { |
| 1078 return OperatorProperties::HasFrameStateInput(op); |
| 1079 } |
| 1080 } |
| 1081 |
| 1082 } // namespace |
| 1083 |
1070 bool EscapeAnalysis::Process(Node* node) { | 1084 bool EscapeAnalysis::Process(Node* node) { |
1071 switch (node->opcode()) { | 1085 switch (node->opcode()) { |
1072 case IrOpcode::kAllocate: | 1086 case IrOpcode::kAllocate: |
1073 ProcessAllocation(node); | 1087 ProcessAllocation(node); |
1074 break; | 1088 break; |
1075 case IrOpcode::kBeginRegion: | 1089 case IrOpcode::kBeginRegion: |
1076 ForwardVirtualState(node); | 1090 ForwardVirtualState(node); |
1077 break; | 1091 break; |
1078 case IrOpcode::kFinishRegion: | 1092 case IrOpcode::kFinishRegion: |
1079 ProcessFinishRegion(node); | 1093 ProcessFinishRegion(node); |
(...skipping 16 matching lines...) Expand all Loading... |
1096 case IrOpcode::kEffectPhi: | 1110 case IrOpcode::kEffectPhi: |
1097 return ProcessEffectPhi(node); | 1111 return ProcessEffectPhi(node); |
1098 break; | 1112 break; |
1099 default: | 1113 default: |
1100 if (node->op()->EffectInputCount() > 0) { | 1114 if (node->op()->EffectInputCount() > 0) { |
1101 ForwardVirtualState(node); | 1115 ForwardVirtualState(node); |
1102 } | 1116 } |
1103 ProcessAllocationUsers(node); | 1117 ProcessAllocationUsers(node); |
1104 break; | 1118 break; |
1105 } | 1119 } |
1106 if (OperatorProperties::HasFrameStateInput(node->op())) { | 1120 if (HasFrameStateInput(node->op())) { |
1107 virtual_states_[node->id()]->SetCopyRequired(); | 1121 virtual_states_[node->id()]->SetCopyRequired(); |
1108 } | 1122 } |
1109 return true; | 1123 return true; |
1110 } | 1124 } |
1111 | 1125 |
1112 void EscapeAnalysis::ProcessAllocationUsers(Node* node) { | 1126 void EscapeAnalysis::ProcessAllocationUsers(Node* node) { |
1113 for (Edge edge : node->input_edges()) { | 1127 for (Edge edge : node->input_edges()) { |
1114 Node* input = edge.to(); | 1128 Node* input = edge.to(); |
1115 Node* use = edge.from(); | 1129 Node* use = edge.from(); |
1116 if (edge.index() >= use->op()->ValueInputCount() + | 1130 if (edge.index() >= use->op()->ValueInputCount() + |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 } | 1728 } |
1715 } | 1729 } |
1716 return false; | 1730 return false; |
1717 } | 1731 } |
1718 | 1732 |
1719 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1733 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
1720 | 1734 |
1721 } // namespace compiler | 1735 } // namespace compiler |
1722 } // namespace internal | 1736 } // namespace internal |
1723 } // namespace v8 | 1737 } // namespace v8 |
OLD | NEW |