| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 469 } |
| 470 return changed; | 470 return changed; |
| 471 } | 471 } |
| 472 | 472 |
| 473 bool VirtualObject::MergeFrom(MergeCache* cache, Node* at, Graph* graph, | 473 bool VirtualObject::MergeFrom(MergeCache* cache, Node* at, Graph* graph, |
| 474 CommonOperatorBuilder* common) { | 474 CommonOperatorBuilder* common) { |
| 475 DCHECK(at->opcode() == IrOpcode::kEffectPhi || | 475 DCHECK(at->opcode() == IrOpcode::kEffectPhi || |
| 476 at->opcode() == IrOpcode::kPhi); | 476 at->opcode() == IrOpcode::kPhi); |
| 477 bool changed = false; | 477 bool changed = false; |
| 478 for (size_t i = 0; i < field_count(); ++i) { | 478 for (size_t i = 0; i < field_count(); ++i) { |
| 479 if (Node* field = cache->GetFields(i)) { | 479 Node* field = cache->GetFields(i); |
| 480 if (field && !IsCreatedPhi(i)) { |
| 480 changed = changed || GetField(i) != field; | 481 changed = changed || GetField(i) != field; |
| 481 SetField(i, field); | 482 SetField(i, field); |
| 482 TRACE(" Field %zu agree on rep #%d\n", i, field->id()); | 483 TRACE(" Field %zu agree on rep #%d\n", i, field->id()); |
| 483 } else { | 484 } else { |
| 484 size_t arity = at->opcode() == IrOpcode::kEffectPhi | 485 size_t arity = at->opcode() == IrOpcode::kEffectPhi |
| 485 ? at->op()->EffectInputCount() | 486 ? at->op()->EffectInputCount() |
| 486 : at->op()->ValueInputCount(); | 487 : at->op()->ValueInputCount(); |
| 487 if (cache->fields().size() == arity) { | 488 if (cache->fields().size() == arity) { |
| 488 changed = MergeFields(i, at, cache, graph, common) || changed; | 489 changed = MergeFields(i, at, cache, graph, common) || changed; |
| 489 } else { | 490 } else { |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 Node* use = edge.from(); | 960 Node* use = edge.from(); |
| 960 if (status_analysis_->IsNotReachable(use)) { | 961 if (status_analysis_->IsNotReachable(use)) { |
| 961 continue; | 962 continue; |
| 962 } | 963 } |
| 963 if (NodeProperties::IsEffectEdge(edge)) { | 964 if (NodeProperties::IsEffectEdge(edge)) { |
| 964 // Iteration order: depth first, but delay phis. | 965 // Iteration order: depth first, but delay phis. |
| 965 // We need DFS do avoid some duplication of VirtualStates and | 966 // We need DFS do avoid some duplication of VirtualStates and |
| 966 // VirtualObjects, and we want to delay phis to improve performance. | 967 // VirtualObjects, and we want to delay phis to improve performance. |
| 967 if (use->opcode() == IrOpcode::kEffectPhi) { | 968 if (use->opcode() == IrOpcode::kEffectPhi) { |
| 968 if (!status_analysis_->IsInQueue(use->id())) { | 969 if (!status_analysis_->IsInQueue(use->id())) { |
| 970 status_analysis_->SetInQueue(use->id(), true); |
| 969 queue.push_front(use); | 971 queue.push_front(use); |
| 970 } | 972 } |
| 971 } else if ((use->opcode() != IrOpcode::kLoadField && | 973 } else if ((use->opcode() != IrOpcode::kLoadField && |
| 972 use->opcode() != IrOpcode::kLoadElement) || | 974 use->opcode() != IrOpcode::kLoadElement) || |
| 973 !status_analysis_->IsDanglingEffectNode(use)) { | 975 !status_analysis_->IsDanglingEffectNode(use)) { |
| 974 if (!status_analysis_->IsInQueue(use->id())) { | 976 if (!status_analysis_->IsInQueue(use->id())) { |
| 975 status_analysis_->SetInQueue(use->id(), true); | 977 status_analysis_->SetInQueue(use->id(), true); |
| 976 queue.push_back(use); | 978 queue.push_back(use); |
| 977 } | 979 } |
| 978 } else { | 980 } else { |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 } | 1684 } |
| 1683 } | 1685 } |
| 1684 return false; | 1686 return false; |
| 1685 } | 1687 } |
| 1686 | 1688 |
| 1687 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1689 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
| 1688 | 1690 |
| 1689 } // namespace compiler | 1691 } // namespace compiler |
| 1690 } // namespace internal | 1692 } // namespace internal |
| 1691 } // namespace v8 | 1693 } // namespace v8 |
| OLD | NEW |