Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler/escape-analysis.cc

Issue 2964473002: [turbofan] Extend escape analysis to reduce certain CheckMaps. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 UpdateReplacement(state, node, value); 1510 UpdateReplacement(state, node, value);
1511 } else { 1511 } else {
1512 UpdateReplacement(state, node, nullptr); 1512 UpdateReplacement(state, node, nullptr);
1513 } 1513 }
1514 } 1514 }
1515 1515
1516 void EscapeAnalysis::ProcessCheckMaps(Node* node) { 1516 void EscapeAnalysis::ProcessCheckMaps(Node* node) {
1517 DCHECK_EQ(node->opcode(), IrOpcode::kCheckMaps); 1517 DCHECK_EQ(node->opcode(), IrOpcode::kCheckMaps);
1518 ForwardVirtualState(node); 1518 ForwardVirtualState(node);
1519 Node* checked = ResolveReplacement(NodeProperties::GetValueInput(node, 0)); 1519 Node* checked = ResolveReplacement(NodeProperties::GetValueInput(node, 0));
1520 if (FLAG_turbo_experimental) { 1520 VirtualState* state = virtual_states_[node->id()];
1521 VirtualState* state = virtual_states_[node->id()]; 1521 if (VirtualObject* object = GetVirtualObject(state, checked)) {
1522 if (VirtualObject* object = GetVirtualObject(state, checked)) { 1522 if (!object->IsTracked()) {
1523 if (!object->IsTracked()) { 1523 if (status_analysis_->SetEscaped(node)) {
1524 if (status_analysis_->SetEscaped(node)) { 1524 TRACE(
1525 TRACE( 1525 "Setting #%d (%s) to escaped because checked object #%i is not "
1526 "Setting #%d (%s) to escaped because checked object #%i is not " 1526 "tracked\n",
1527 "tracked\n", 1527 node->id(), node->op()->mnemonic(), object->id());
1528 node->id(), node->op()->mnemonic(), object->id()); 1528 }
1529 } 1529 return;
1530 }
1531 CheckMapsParameters params = CheckMapsParametersOf(node->op());
1532
1533 Node* value = object->GetField(HeapObject::kMapOffset / kPointerSize);
1534 if (value) {
1535 value = ResolveReplacement(value);
1536 // TODO(tebbi): We want to extend this beyond constant folding with a
1537 // CheckMapsValue operator that takes the load-eliminated map value as
1538 // input.
1539 if (value->opcode() == IrOpcode::kHeapConstant &&
1540 params.maps().contains(ZoneHandleSet<Map>(
1541 Handle<Map>::cast(OpParameter<Handle<HeapObject>>(value))))) {
1542 TRACE("CheckMaps #%i seems to be redundant (until now).\n", node->id());
1530 return; 1543 return;
1531 } 1544 }
1532 CheckMapsParameters params = CheckMapsParametersOf(node->op());
1533
1534 Node* value = object->GetField(HeapObject::kMapOffset / kPointerSize);
1535 if (value) {
1536 value = ResolveReplacement(value);
1537 // TODO(tebbi): We want to extend this beyond constant folding with a
1538 // CheckMapsValue operator that takes the load-eliminated map value as
1539 // input.
1540 if (value->opcode() == IrOpcode::kHeapConstant &&
1541 params.maps().contains(ZoneHandleSet<Map>(
1542 Handle<Map>::cast(OpParameter<Handle<HeapObject>>(value))))) {
1543 TRACE("CheckMaps #%i seems to be redundant (until now).\n",
1544 node->id());
1545 return;
1546 }
1547 }
1548 } 1545 }
1549 } 1546 }
1550 if (status_analysis_->SetEscaped(node)) { 1547 if (status_analysis_->SetEscaped(node)) {
1551 TRACE("Setting #%d (%s) to escaped (checking #%i)\n", node->id(), 1548 TRACE("Setting #%d (%s) to escaped (checking #%i)\n", node->id(),
1552 node->op()->mnemonic(), checked->id()); 1549 node->op()->mnemonic(), checked->id());
1553 } 1550 }
1554 } 1551 }
1555 1552
1556 void EscapeAnalysis::ProcessLoadElement(Node* node) { 1553 void EscapeAnalysis::ProcessLoadElement(Node* node) {
1557 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement); 1554 DCHECK_EQ(node->opcode(), IrOpcode::kLoadElement);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 } 1783 }
1787 } 1784 }
1788 return false; 1785 return false;
1789 } 1786 }
1790 1787
1791 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } 1788 Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); }
1792 1789
1793 } // namespace compiler 1790 } // namespace compiler
1794 } // namespace internal 1791 } // namespace internal
1795 } // namespace v8 1792 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698