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

Unified Diff: src/compiler/escape-analysis-reducer.cc

Issue 2664683003: [turbofan] escape analysis reducer no longer confused by TypeGuards it introduced itself (Closed)
Patch Set: added testcase Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/escape-analysis-12.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/escape-analysis-reducer.cc
diff --git a/src/compiler/escape-analysis-reducer.cc b/src/compiler/escape-analysis-reducer.cc
index 148fb031dd9d7fa5cdde72953ff66aec836ea295..10b7f285a6d622b736b9d60f6d537fa2e1957fdf 100644
--- a/src/compiler/escape-analysis-reducer.cc
+++ b/src/compiler/escape-analysis-reducer.cc
@@ -121,6 +121,13 @@ Node* MaybeGuard(JSGraph* jsgraph, Zone* zone, Node* original,
return replacement;
}
+Node* SkipTypeGuards(Node* node) {
+ while (node->opcode() == IrOpcode::kTypeGuard) {
+ node = NodeProperties::GetValueInput(node, 0);
+ }
+ return node;
+}
+
} // namespace
Reduction EscapeAnalysisReducer::ReduceLoad(Node* node) {
@@ -129,7 +136,8 @@ Reduction EscapeAnalysisReducer::ReduceLoad(Node* node) {
if (node->id() < static_cast<NodeId>(fully_reduced_.length())) {
fully_reduced_.Add(node->id());
}
- if (escape_analysis()->IsVirtual(NodeProperties::GetValueInput(node, 0))) {
+ if (escape_analysis()->IsVirtual(
+ SkipTypeGuards(NodeProperties::GetValueInput(node, 0)))) {
if (Node* rep = escape_analysis()->GetReplacement(node)) {
isolate()->counters()->turbo_escape_loads_replaced()->Increment();
TRACE("Replaced #%d (%s) with #%d (%s)\n", node->id(),
@@ -149,7 +157,8 @@ Reduction EscapeAnalysisReducer::ReduceStore(Node* node) {
if (node->id() < static_cast<NodeId>(fully_reduced_.length())) {
fully_reduced_.Add(node->id());
}
- if (escape_analysis()->IsVirtual(NodeProperties::GetValueInput(node, 0))) {
+ if (escape_analysis()->IsVirtual(
+ SkipTypeGuards(NodeProperties::GetValueInput(node, 0)))) {
TRACE("Removed #%d (%s) from effect chain\n", node->id(),
node->op()->mnemonic());
RelaxEffectsAndControls(node);
@@ -204,8 +213,8 @@ Reduction EscapeAnalysisReducer::ReduceFinishRegion(Node* node) {
Reduction EscapeAnalysisReducer::ReduceReferenceEqual(Node* node) {
DCHECK_EQ(node->opcode(), IrOpcode::kReferenceEqual);
- Node* left = NodeProperties::GetValueInput(node, 0);
- Node* right = NodeProperties::GetValueInput(node, 1);
+ Node* left = SkipTypeGuards(NodeProperties::GetValueInput(node, 0));
+ Node* right = SkipTypeGuards(NodeProperties::GetValueInput(node, 1));
if (escape_analysis()->IsVirtual(left)) {
if (escape_analysis()->IsVirtual(right) &&
escape_analysis()->CompareVirtualObjects(left, right)) {
@@ -229,7 +238,7 @@ Reduction EscapeAnalysisReducer::ReduceReferenceEqual(Node* node) {
Reduction EscapeAnalysisReducer::ReduceObjectIsSmi(Node* node) {
DCHECK_EQ(node->opcode(), IrOpcode::kObjectIsSmi);
- Node* input = NodeProperties::GetValueInput(node, 0);
+ Node* input = SkipTypeGuards(NodeProperties::GetValueInput(node, 0));
if (escape_analysis()->IsVirtual(input)) {
ReplaceWithValue(node, jsgraph()->FalseConstant());
TRACE("Replaced ObjectIsSmi #%d with false\n", node->id());
@@ -322,7 +331,7 @@ Node* EscapeAnalysisReducer::ReduceStateValueInput(Node* node, int node_index,
bool node_multiused,
bool already_cloned,
bool multiple_users) {
- Node* input = NodeProperties::GetValueInput(node, node_index);
+ Node* input = SkipTypeGuards(NodeProperties::GetValueInput(node, node_index));
if (node->id() < static_cast<NodeId>(fully_reduced_.length()) &&
fully_reduced_.Contains(node->id())) {
return nullptr;
« no previous file with comments | « no previous file | test/mjsunit/compiler/escape-analysis-12.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698