| 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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 if (++count > 1) { | 1060 if (++count > 1) { |
| 1060 status_[node->id()] |= kBranchPointComputed | kBranchPoint; | 1061 status_[node->id()] |= kBranchPointComputed | kBranchPoint; |
| 1061 return true; | 1062 return true; |
| 1062 } | 1063 } |
| 1063 } | 1064 } |
| 1064 } | 1065 } |
| 1065 status_[node->id()] |= kBranchPointComputed; | 1066 status_[node->id()] |= kBranchPointComputed; |
| 1066 return false; | 1067 return false; |
| 1067 } | 1068 } |
| 1068 | 1069 |
| 1070 namespace { |
| 1071 |
| 1072 bool HasFrameStateInput(const Operator* op) { |
| 1073 if (op->opcode() == IrOpcode::kCall || op->opcode() == IrOpcode::kTailCall) { |
| 1074 const CallDescriptor* d = CallDescriptorOf(op); |
| 1075 return d->NeedsFrameState(); |
| 1076 } else { |
| 1077 return OperatorProperties::HasFrameStateInput(op); |
| 1078 } |
| 1079 } |
| 1080 |
| 1081 } // namespace |
| 1082 |
| 1069 bool EscapeAnalysis::Process(Node* node) { | 1083 bool EscapeAnalysis::Process(Node* node) { |
| 1070 switch (node->opcode()) { | 1084 switch (node->opcode()) { |
| 1071 case IrOpcode::kAllocate: | 1085 case IrOpcode::kAllocate: |
| 1072 ProcessAllocation(node); | 1086 ProcessAllocation(node); |
| 1073 break; | 1087 break; |
| 1074 case IrOpcode::kBeginRegion: | 1088 case IrOpcode::kBeginRegion: |
| 1075 ForwardVirtualState(node); | 1089 ForwardVirtualState(node); |
| 1076 break; | 1090 break; |
| 1077 case IrOpcode::kFinishRegion: | 1091 case IrOpcode::kFinishRegion: |
| 1078 ProcessFinishRegion(node); | 1092 ProcessFinishRegion(node); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1095 case IrOpcode::kEffectPhi: | 1109 case IrOpcode::kEffectPhi: |
| 1096 return ProcessEffectPhi(node); | 1110 return ProcessEffectPhi(node); |
| 1097 break; | 1111 break; |
| 1098 default: | 1112 default: |
| 1099 if (node->op()->EffectInputCount() > 0) { | 1113 if (node->op()->EffectInputCount() > 0) { |
| 1100 ForwardVirtualState(node); | 1114 ForwardVirtualState(node); |
| 1101 } | 1115 } |
| 1102 ProcessAllocationUsers(node); | 1116 ProcessAllocationUsers(node); |
| 1103 break; | 1117 break; |
| 1104 } | 1118 } |
| 1105 if (OperatorProperties::HasFrameStateInput(node->op())) { | 1119 if (HasFrameStateInput(node->op())) { |
| 1106 virtual_states_[node->id()]->SetCopyRequired(); | 1120 virtual_states_[node->id()]->SetCopyRequired(); |
| 1107 } | 1121 } |
| 1108 return true; | 1122 return true; |
| 1109 } | 1123 } |
| 1110 | 1124 |
| 1111 void EscapeAnalysis::ProcessAllocationUsers(Node* node) { | 1125 void EscapeAnalysis::ProcessAllocationUsers(Node* node) { |
| 1112 for (Edge edge : node->input_edges()) { | 1126 for (Edge edge : node->input_edges()) { |
| 1113 Node* input = edge.to(); | 1127 Node* input = edge.to(); |
| 1114 Node* use = edge.from(); | 1128 Node* use = edge.from(); |
| 1115 if (edge.index() >= use->op()->ValueInputCount() + | 1129 if (edge.index() >= use->op()->ValueInputCount() + |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 } | 1727 } |
| 1714 } | 1728 } |
| 1715 return false; | 1729 return false; |
| 1716 } | 1730 } |
| 1717 | 1731 |
| 1718 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1732 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
| 1719 | 1733 |
| 1720 } // namespace compiler | 1734 } // namespace compiler |
| 1721 } // namespace internal | 1735 } // namespace internal |
| 1722 } // namespace v8 | 1736 } // namespace v8 |
| OLD | NEW |