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 owner_(owner) { | 161 owner_(owner) { |
162 fields_.resize(field_number); | 162 fields_.resize(field_number); |
163 phi_.resize(field_number, false); | 163 phi_.resize(field_number, false); |
164 } | 164 } |
165 | 165 |
166 Node* GetField(size_t offset) { return fields_[offset]; } | 166 Node* GetField(size_t offset) { return fields_[offset]; } |
167 | 167 |
168 bool IsCreatedPhi(size_t offset) { return phi_[offset]; } | 168 bool IsCreatedPhi(size_t offset) { return phi_[offset]; } |
169 | 169 |
170 void SetField(size_t offset, Node* node, bool created_phi = false) { | 170 void SetField(size_t offset, Node* node, bool created_phi = false) { |
171 TRACE(" VirtualObject(%p)[%zu] changes from #%i to #%i\n", this, offset, | 171 TRACE(" VirtualObject(%p)[%zu] changes from #%i to #%i\n", |
| 172 static_cast<void*>(this), offset, |
172 fields_[offset] ? fields_[offset]->id() : -1, node ? node->id() : -1); | 173 fields_[offset] ? fields_[offset]->id() : -1, node ? node->id() : -1); |
173 fields_[offset] = node; | 174 fields_[offset] = node; |
174 phi_[offset] = created_phi; | 175 phi_[offset] = created_phi; |
175 } | 176 } |
176 bool IsTracked() const { return status_ & kTracked; } | 177 bool IsTracked() const { return status_ & kTracked; } |
177 bool IsInitialized() const { return status_ & kInitialized; } | 178 bool IsInitialized() const { return status_ & kInitialized; } |
178 bool SetInitialized() { return status_ |= kInitialized; } | 179 bool SetInitialized() { return status_ |= kInitialized; } |
179 VirtualState* owner() const { return owner_; } | 180 VirtualState* owner() const { return owner_; } |
180 | 181 |
181 Node** fields_array() { return &fields_.front(); } | 182 Node** fields_array() { return &fields_.front(); } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ZoneVector<bool> phi_; | 230 ZoneVector<bool> phi_; |
230 Node* object_state_; | 231 Node* object_state_; |
231 VirtualState* owner_; | 232 VirtualState* owner_; |
232 | 233 |
233 DISALLOW_COPY_AND_ASSIGN(VirtualObject); | 234 DISALLOW_COPY_AND_ASSIGN(VirtualObject); |
234 }; | 235 }; |
235 | 236 |
236 DEFINE_OPERATORS_FOR_FLAGS(VirtualObject::StatusFlags) | 237 DEFINE_OPERATORS_FOR_FLAGS(VirtualObject::StatusFlags) |
237 | 238 |
238 bool VirtualObject::UpdateFrom(const VirtualObject& other) { | 239 bool VirtualObject::UpdateFrom(const VirtualObject& other) { |
239 TRACE("%p.UpdateFrom(%p)\n", this, &other); | 240 TRACE("%p.UpdateFrom(%p)\n", static_cast<void*>(this), |
| 241 static_cast<const void*>(&other)); |
240 bool changed = status_ != other.status_; | 242 bool changed = status_ != other.status_; |
241 status_ = other.status_; | 243 status_ = other.status_; |
242 phi_ = other.phi_; | 244 phi_ = other.phi_; |
243 if (fields_.size() != other.fields_.size()) { | 245 if (fields_.size() != other.fields_.size()) { |
244 fields_ = other.fields_; | 246 fields_ = other.fields_; |
245 return true; | 247 return true; |
246 } | 248 } |
247 for (size_t i = 0; i < fields_.size(); ++i) { | 249 for (size_t i = 0; i < fields_.size(); ++i) { |
248 if (fields_[i] != other.fields_[i]) { | 250 if (fields_[i] != other.fields_[i]) { |
249 changed = true; | 251 changed = true; |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 status_analysis_->IsDanglingEffectNode(node)) { | 1248 status_analysis_->IsDanglingEffectNode(node)) { |
1247 PrintF("Dangeling effect node: #%d (%s)\n", node->id(), | 1249 PrintF("Dangeling effect node: #%d (%s)\n", node->id(), |
1248 node->op()->mnemonic()); | 1250 node->op()->mnemonic()); |
1249 UNREACHABLE(); | 1251 UNREACHABLE(); |
1250 } | 1252 } |
1251 #endif // DEBUG | 1253 #endif // DEBUG |
1252 Node* effect = NodeProperties::GetEffectInput(node); | 1254 Node* effect = NodeProperties::GetEffectInput(node); |
1253 DCHECK_NOT_NULL(virtual_states_[effect->id()]); | 1255 DCHECK_NOT_NULL(virtual_states_[effect->id()]); |
1254 if (virtual_states_[node->id()]) { | 1256 if (virtual_states_[node->id()]) { |
1255 TRACE("Updating virtual state %p at %s#%d from virtual state %p at %s#%d\n", | 1257 TRACE("Updating virtual state %p at %s#%d from virtual state %p at %s#%d\n", |
1256 virtual_states_[node->id()], node->op()->mnemonic(), node->id(), | 1258 static_cast<void*>(virtual_states_[node->id()]), |
1257 virtual_states_[effect->id()], effect->op()->mnemonic(), | 1259 node->op()->mnemonic(), node->id(), |
1258 effect->id()); | 1260 static_cast<void*>(virtual_states_[effect->id()]), |
| 1261 effect->op()->mnemonic(), effect->id()); |
1259 virtual_states_[node->id()]->UpdateFrom(virtual_states_[effect->id()], | 1262 virtual_states_[node->id()]->UpdateFrom(virtual_states_[effect->id()], |
1260 zone()); | 1263 zone()); |
1261 } else { | 1264 } else { |
1262 virtual_states_[node->id()] = virtual_states_[effect->id()]; | 1265 virtual_states_[node->id()] = virtual_states_[effect->id()]; |
1263 TRACE("Forwarding object state %p from %s#%d to %s#%d", | 1266 TRACE("Forwarding object state %p from %s#%d to %s#%d", |
1264 static_cast<void*>(virtual_states_[effect->id()]), | 1267 static_cast<void*>(virtual_states_[effect->id()]), |
1265 effect->op()->mnemonic(), effect->id(), node->op()->mnemonic(), | 1268 effect->op()->mnemonic(), effect->id(), node->op()->mnemonic(), |
1266 node->id()); | 1269 node->id()); |
1267 if (status_analysis_->IsEffectBranchPoint(effect)) { | 1270 if (status_analysis_->IsEffectBranchPoint(effect)) { |
1268 virtual_states_[node->id()]->SetCopyRequired(); | 1271 virtual_states_[node->id()]->SetCopyRequired(); |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 } | 1776 } |
1774 } | 1777 } |
1775 return false; | 1778 return false; |
1776 } | 1779 } |
1777 | 1780 |
1778 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1781 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
1779 | 1782 |
1780 } // namespace compiler | 1783 } // namespace compiler |
1781 } // namespace internal | 1784 } // namespace internal |
1782 } // namespace v8 | 1785 } // namespace v8 |
OLD | NEW |