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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 Node* input2 = NodeProperties::GetValueInput(node2, i); | 413 Node* input2 = NodeProperties::GetValueInput(node2, i); |
414 if (!IsEquivalentPhi(input1, input2)) { | 414 if (!IsEquivalentPhi(input1, input2)) { |
415 return false; | 415 return false; |
416 } | 416 } |
417 } | 417 } |
418 return true; | 418 return true; |
419 } | 419 } |
420 | 420 |
421 bool IsEquivalentPhi(Node* phi, ZoneVector<Node*>& inputs) { | 421 bool IsEquivalentPhi(Node* phi, ZoneVector<Node*>& inputs) { |
422 if (phi->opcode() != IrOpcode::kPhi) return false; | 422 if (phi->opcode() != IrOpcode::kPhi) return false; |
423 if (phi->op()->ValueInputCount() != inputs.size()) { | 423 if (static_cast<size_t>(phi->op()->ValueInputCount()) != inputs.size()) { |
424 return false; | 424 return false; |
425 } | 425 } |
426 for (size_t i = 0; i < inputs.size(); ++i) { | 426 for (size_t i = 0; i < inputs.size(); ++i) { |
427 Node* input = NodeProperties::GetValueInput(phi, static_cast<int>(i)); | 427 Node* input = NodeProperties::GetValueInput(phi, static_cast<int>(i)); |
428 if (!IsEquivalentPhi(input, inputs[i])) { | 428 if (!IsEquivalentPhi(input, inputs[i])) { |
429 return false; | 429 return false; |
430 } | 430 } |
431 } | 431 } |
432 return true; | 432 return true; |
433 } | 433 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (Node* field = cache->GetFields(i)) { |
480 changed = changed || GetField(i) != field; | 480 changed = changed || GetField(i) != field; |
481 SetField(i, field); | 481 SetField(i, field); |
482 TRACE(" Field %zu agree on rep #%d\n", i, field->id()); | 482 TRACE(" Field %zu agree on rep #%d\n", i, field->id()); |
483 } else { | 483 } else { |
484 int arity = at->opcode() == IrOpcode::kEffectPhi | 484 size_t arity = at->opcode() == IrOpcode::kEffectPhi |
485 ? at->op()->EffectInputCount() | 485 ? at->op()->EffectInputCount() |
486 : at->op()->ValueInputCount(); | 486 : at->op()->ValueInputCount(); |
487 if (cache->fields().size() == arity) { | 487 if (cache->fields().size() == arity) { |
488 changed = MergeFields(i, at, cache, graph, common) || changed; | 488 changed = MergeFields(i, at, cache, graph, common) || changed; |
489 } else { | 489 } else { |
490 if (GetField(i) != nullptr) { | 490 if (GetField(i) != nullptr) { |
491 TRACE(" Field %zu cleared\n", i); | 491 TRACE(" Field %zu cleared\n", i); |
492 changed = true; | 492 changed = true; |
493 } | 493 } |
494 SetField(i, nullptr); | 494 SetField(i, nullptr); |
495 } | 495 } |
496 } | 496 } |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 } | 1682 } |
1683 } | 1683 } |
1684 return false; | 1684 return false; |
1685 } | 1685 } |
1686 | 1686 |
1687 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1687 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
1688 | 1688 |
1689 } // namespace compiler | 1689 } // namespace compiler |
1690 } // namespace internal | 1690 } // namespace internal |
1691 } // namespace v8 | 1691 } // namespace v8 |
OLD | NEW |