| 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" |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 return new_state; | 1128 return new_state; |
| 1129 } | 1129 } |
| 1130 return state; | 1130 return state; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 VirtualObject* EscapeAnalysis::CopyForModificationAt(VirtualObject* obj, | 1133 VirtualObject* EscapeAnalysis::CopyForModificationAt(VirtualObject* obj, |
| 1134 VirtualState* state, | 1134 VirtualState* state, |
| 1135 Node* node) { | 1135 Node* node) { |
| 1136 if (obj->NeedCopyForModification()) { | 1136 if (obj->NeedCopyForModification()) { |
| 1137 state = CopyForModificationAt(state, node); | 1137 state = CopyForModificationAt(state, node); |
| 1138 return state->Copy(obj, status_analysis_->GetAlias(obj->id())); | 1138 // TODO(tebbi): this copies the complete virtual state. Replace with a more |
| 1139 // precise analysis of which objects are actually affected by the change. |
| 1140 Alias changed_alias = status_analysis_->GetAlias(obj->id()); |
| 1141 for (Alias alias = 0; alias < state->size(); ++alias) { |
| 1142 if (VirtualObject* next_obj = state->VirtualObjectFromAlias(alias)) { |
| 1143 if (alias != changed_alias && next_obj->NeedCopyForModification()) { |
| 1144 state->Copy(next_obj, alias); |
| 1145 } |
| 1146 } |
| 1147 } |
| 1148 return state->Copy(obj, changed_alias); |
| 1139 } | 1149 } |
| 1140 return obj; | 1150 return obj; |
| 1141 } | 1151 } |
| 1142 | 1152 |
| 1143 void EscapeAnalysis::ForwardVirtualState(Node* node) { | 1153 void EscapeAnalysis::ForwardVirtualState(Node* node) { |
| 1144 DCHECK_EQ(node->op()->EffectInputCount(), 1); | 1154 DCHECK_EQ(node->op()->EffectInputCount(), 1); |
| 1145 #ifdef DEBUG | 1155 #ifdef DEBUG |
| 1146 if (node->opcode() != IrOpcode::kLoadField && | 1156 if (node->opcode() != IrOpcode::kLoadField && |
| 1147 node->opcode() != IrOpcode::kLoadElement && | 1157 node->opcode() != IrOpcode::kLoadElement && |
| 1148 node->opcode() != IrOpcode::kLoad && | 1158 node->opcode() != IrOpcode::kLoad && |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 } | 1682 } |
| 1673 } | 1683 } |
| 1674 return false; | 1684 return false; |
| 1675 } | 1685 } |
| 1676 | 1686 |
| 1677 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1687 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
| 1678 | 1688 |
| 1679 } // namespace compiler | 1689 } // namespace compiler |
| 1680 } // namespace internal | 1690 } // namespace internal |
| 1681 } // namespace v8 | 1691 } // namespace v8 |
| OLD | NEW |