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-reducer.h" | 5 #include "src/compiler/escape-analysis-reducer.h" |
6 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 default: | 42 default: |
43 break; | 43 break; |
44 } | 44 } |
45 return NoChange(); | 45 return NoChange(); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 Reduction EscapeAnalysisReducer::ReduceLoad(Node* node) { | 49 Reduction EscapeAnalysisReducer::ReduceLoad(Node* node) { |
50 DCHECK(node->opcode() == IrOpcode::kLoadField || | 50 DCHECK(node->opcode() == IrOpcode::kLoadField || |
51 node->opcode() == IrOpcode::kLoadElement); | 51 node->opcode() == IrOpcode::kLoadElement); |
52 if (Node* rep = escape_analysis()->GetReplacement(node, node->id())) { | 52 if (Node* rep = escape_analysis()->GetReplacement(node)) { |
53 if (FLAG_trace_turbo_escape) { | 53 if (FLAG_trace_turbo_escape) { |
54 PrintF("Replaced #%d (%s) with #%d (%s)\n", node->id(), | 54 PrintF("Replaced #%d (%s) with #%d (%s)\n", node->id(), |
55 node->op()->mnemonic(), rep->id(), rep->op()->mnemonic()); | 55 node->op()->mnemonic(), rep->id(), rep->op()->mnemonic()); |
56 } | 56 } |
57 ReplaceWithValue(node, rep); | 57 ReplaceWithValue(node, rep); |
58 return Changed(rep); | 58 return Changed(rep); |
59 } | 59 } |
60 return NoChange(); | 60 return NoChange(); |
61 } | 61 } |
62 | 62 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return NoChange(); | 109 return NoChange(); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 Reduction EscapeAnalysisReducer::ReduceReferenceEqual(Node* node) { | 113 Reduction EscapeAnalysisReducer::ReduceReferenceEqual(Node* node) { |
114 DCHECK_EQ(node->opcode(), IrOpcode::kReferenceEqual); | 114 DCHECK_EQ(node->opcode(), IrOpcode::kReferenceEqual); |
115 Node* left = NodeProperties::GetValueInput(node, 0); | 115 Node* left = NodeProperties::GetValueInput(node, 0); |
116 Node* right = NodeProperties::GetValueInput(node, 1); | 116 Node* right = NodeProperties::GetValueInput(node, 1); |
117 if (escape_analysis()->IsVirtual(left)) { | 117 if (escape_analysis()->IsVirtual(left)) { |
118 if (escape_analysis()->IsVirtual(right)) { | 118 if (escape_analysis()->IsVirtual(right)) { |
119 if (Node* rep = escape_analysis()->GetReplacement(node, left->id())) { | 119 if (Node* rep = escape_analysis()->GetReplacement(left)) { |
120 left = rep; | 120 left = rep; |
121 } | 121 } |
122 if (Node* rep = escape_analysis()->GetReplacement(node, right->id())) { | 122 if (Node* rep = escape_analysis()->GetReplacement(right)) { |
123 right = rep; | 123 right = rep; |
124 } | 124 } |
125 // TODO(sigurds): What to do if either is a PHI? | 125 // TODO(sigurds): What to do if either is a PHI? |
126 if (left == right) { | 126 if (left == right) { |
127 ReplaceWithValue(node, jsgraph()->TrueConstant()); | 127 ReplaceWithValue(node, jsgraph()->TrueConstant()); |
128 if (FLAG_trace_turbo_escape) { | 128 if (FLAG_trace_turbo_escape) { |
129 PrintF("Replaced ref eq #%d with true\n", node->id()); | 129 PrintF("Replaced ref eq #%d with true\n", node->id()); |
130 } | 130 } |
131 return Replace(node); | 131 return Replace(node); |
132 } | 132 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 return r; | 186 return r; |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 } // namespace compiler | 190 } // namespace compiler |
191 } // namespace internal | 191 } // namespace internal |
192 } // namespace v8 | 192 } // namespace v8 |
OLD | NEW |