Chromium Code Reviews| 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1522 ProcessLoadFromPhi(offset, from, node, state); | 1522 ProcessLoadFromPhi(offset, from, node, state); |
| 1523 } else { | 1523 } else { |
| 1524 UpdateReplacement(state, node, nullptr); | 1524 UpdateReplacement(state, node, nullptr); |
| 1525 } | 1525 } |
| 1526 } | 1526 } |
| 1527 | 1527 |
| 1528 void EscapeAnalysis::ProcessCheckMaps(Node* node) { | 1528 void EscapeAnalysis::ProcessCheckMaps(Node* node) { |
| 1529 DCHECK_EQ(node->opcode(), IrOpcode::kCheckMaps); | 1529 DCHECK_EQ(node->opcode(), IrOpcode::kCheckMaps); |
| 1530 ForwardVirtualState(node); | 1530 ForwardVirtualState(node); |
| 1531 Node* checked = ResolveReplacement(NodeProperties::GetValueInput(node, 0)); | 1531 Node* checked = ResolveReplacement(NodeProperties::GetValueInput(node, 0)); |
| 1532 if (FLAG_turbo_experimental) { | 1532 VirtualState* state = virtual_states_[node->id()]; |
|
Tobias Tebbi
2017/04/06 13:45:17
Why doesn't it ignore whitespace? This CL really j
| |
| 1533 VirtualState* state = virtual_states_[node->id()]; | 1533 if (VirtualObject* object = GetVirtualObject(state, checked)) { |
| 1534 if (VirtualObject* object = GetVirtualObject(state, checked)) { | 1534 if (!object->IsTracked()) { |
| 1535 if (!object->IsTracked()) { | 1535 if (status_analysis_->SetEscaped(node)) { |
| 1536 if (status_analysis_->SetEscaped(node)) { | 1536 TRACE( |
| 1537 TRACE( | 1537 "Setting #%d (%s) to escaped because checked object #%i is not " |
| 1538 "Setting #%d (%s) to escaped because checked object #%i is not " | 1538 "tracked\n", |
| 1539 "tracked\n", | 1539 node->id(), node->op()->mnemonic(), object->id()); |
| 1540 node->id(), node->op()->mnemonic(), object->id()); | 1540 } |
| 1541 } | 1541 return; |
| 1542 } | |
| 1543 CheckMapsParameters params = CheckMapsParametersOf(node->op()); | |
| 1544 | |
| 1545 Node* value = object->GetField(HeapObject::kMapOffset / kPointerSize); | |
| 1546 if (value) { | |
| 1547 value = ResolveReplacement(value); | |
| 1548 // TODO(tebbi): We want to extend this beyond constant folding with a | |
| 1549 // CheckMapsValue operator that takes the load-eliminated map value as | |
| 1550 // input. | |
| 1551 if (value->opcode() == IrOpcode::kHeapConstant && | |
| 1552 params.maps().contains(ZoneHandleSet<Map>( | |
| 1553 Handle<Map>::cast(OpParameter<Handle<HeapObject>>(value))))) { | |
| 1554 TRACE("CheckMaps #%i seems to be redundant (until now).\n", node->id()); | |
| 1542 return; | 1555 return; |
| 1543 } | 1556 } |
| 1544 CheckMapsParameters params = CheckMapsParametersOf(node->op()); | |
| 1545 | |
| 1546 Node* value = object->GetField(HeapObject::kMapOffset / kPointerSize); | |
| 1547 if (value) { | |
| 1548 value = ResolveReplacement(value); | |
| 1549 // TODO(tebbi): We want to extend this beyond constant folding with a | |
| 1550 // CheckMapsValue operator that takes the load-eliminated map value as | |
| 1551 // input. | |
| 1552 if (value->opcode() == IrOpcode::kHeapConstant && | |
| 1553 params.maps().contains(ZoneHandleSet<Map>( | |
| 1554 Handle<Map>::cast(OpParameter<Handle<HeapObject>>(value))))) { | |
| 1555 TRACE("CheckMaps #%i seems to be redundant (until now).\n", | |
| 1556 node->id()); | |
| 1557 return; | |
| 1558 } | |
| 1559 } | |
| 1560 } | 1557 } |
| 1561 } | 1558 } |
| 1562 if (status_analysis_->SetEscaped(node)) { | 1559 if (status_analysis_->SetEscaped(node)) { |
| 1563 TRACE("Setting #%d (%s) to escaped (checking #%i)\n", node->id(), | 1560 TRACE("Setting #%d (%s) to escaped (checking #%i)\n", node->id(), |
| 1564 node->op()->mnemonic(), checked->id()); | 1561 node->op()->mnemonic(), checked->id()); |
| 1565 } | 1562 } |
| 1566 } | 1563 } |
| 1567 | 1564 |
| 1568 void EscapeAnalysis::ProcessLoadElement(Node* node) { | 1565 void EscapeAnalysis::ProcessLoadElement(Node* node) { |
| 1569 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement); | 1566 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1799 } | 1796 } |
| 1800 } | 1797 } |
| 1801 return false; | 1798 return false; |
| 1802 } | 1799 } |
| 1803 | 1800 |
| 1804 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } | 1801 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } |
| 1805 | 1802 |
| 1806 } // namespace compiler | 1803 } // namespace compiler |
| 1807 } // namespace internal | 1804 } // namespace internal |
| 1808 } // namespace v8 | 1805 } // namespace v8 |
| OLD | NEW |