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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 fields_.resize(field_number); | 161 fields_.resize(field_number); |
162 phi_.resize(field_number, false); | 162 phi_.resize(field_number, false); |
163 } | 163 } |
164 | 164 |
165 Node* GetField(size_t offset) { return fields_[offset]; } | 165 Node* GetField(size_t offset) { return fields_[offset]; } |
166 | 166 |
167 bool IsCreatedPhi(size_t offset) { return phi_[offset]; } | 167 bool IsCreatedPhi(size_t offset) { return phi_[offset]; } |
168 | 168 |
169 void SetField(size_t offset, Node* node, bool created_phi = false) { | 169 void SetField(size_t offset, Node* node, bool created_phi = false) { |
170 fields_[offset] = node; | 170 fields_[offset] = node; |
171 phi_[offset] = phi_[offset] || created_phi; | 171 phi_[offset] = created_phi; |
172 } | 172 } |
173 bool IsTracked() const { return status_ & kTracked; } | 173 bool IsTracked() const { return status_ & kTracked; } |
174 bool IsInitialized() const { return status_ & kInitialized; } | 174 bool IsInitialized() const { return status_ & kInitialized; } |
175 bool SetInitialized() { return status_ |= kInitialized; } | 175 bool SetInitialized() { return status_ |= kInitialized; } |
176 VirtualState* owner() const { return owner_; } | 176 VirtualState* owner() const { return owner_; } |
177 | 177 |
178 Node** fields_array() { return &fields_.front(); } | 178 Node** fields_array() { return &fields_.front(); } |
179 size_t field_count() { return fields_.size(); } | 179 size_t field_count() { return fields_.size(); } |
180 bool ResizeFields(size_t field_count) { | 180 bool ResizeFields(size_t field_count) { |
181 if (field_count > fields_.size()) { | 181 if (field_count > fields_.size()) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 for (size_t i = 0; i < field_count(); ++i) { | 487 for (size_t i = 0; i < field_count(); ++i) { |
488 Node* field = cache->GetFields(i); | 488 Node* field = cache->GetFields(i); |
489 if (field && !IsCreatedPhi(i)) { | 489 if (field && !IsCreatedPhi(i)) { |
490 changed = changed || GetField(i) != field; | 490 changed = changed || GetField(i) != field; |
491 SetField(i, field); | 491 SetField(i, field); |
492 TRACE(" Field %zu agree on rep #%d\n", i, field->id()); | 492 TRACE(" Field %zu agree on rep #%d\n", i, field->id()); |
493 } else { | 493 } else { |
494 size_t arity = at->opcode() == IrOpcode::kEffectPhi | 494 size_t arity = at->opcode() == IrOpcode::kEffectPhi |
495 ? at->op()->EffectInputCount() | 495 ? at->op()->EffectInputCount() |
496 : at->op()->ValueInputCount(); | 496 : at->op()->ValueInputCount(); |
497 if (cache->fields().size() == arity && | 497 if (cache->fields().size() == arity) { |
498 (GetField(i) || !IsCreatedPhi(i))) { | |
499 changed = MergeFields(i, at, cache, graph, common) || changed; | 498 changed = MergeFields(i, at, cache, graph, common) || changed; |
500 } else { | 499 } else { |
501 if (GetField(i) != nullptr) { | 500 if (GetField(i) != nullptr) { |
502 TRACE(" Field %zu cleared\n", i); | 501 TRACE(" Field %zu cleared\n", i); |
503 changed = true; | 502 changed = true; |
504 } | 503 } |
505 SetField(i, nullptr); | 504 SetField(i, nullptr); |
506 } | 505 } |
507 } | 506 } |
508 } | 507 } |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 } | 1696 } |
1698 } | 1697 } |
1699 return false; | 1698 return false; |
1700 } | 1699 } |
1701 | 1700 |
1702 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1701 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
1703 | 1702 |
1704 } // namespace compiler | 1703 } // namespace compiler |
1705 } // namespace internal | 1704 } // namespace internal |
1706 } // namespace v8 | 1705 } // namespace v8 |
OLD | NEW |