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/all-nodes.h" | 7 #include "src/compiler/all-nodes.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 return NoChange(); | 37 return NoChange(); |
38 } | 38 } |
39 | 39 |
40 switch (node->opcode()) { | 40 switch (node->opcode()) { |
41 case IrOpcode::kLoadField: | 41 case IrOpcode::kLoadField: |
42 case IrOpcode::kLoadElement: | 42 case IrOpcode::kLoadElement: |
43 return ReduceLoad(node); | 43 return ReduceLoad(node); |
44 case IrOpcode::kStoreField: | 44 case IrOpcode::kStoreField: |
45 case IrOpcode::kStoreElement: | 45 case IrOpcode::kStoreElement: |
46 return ReduceStore(node); | 46 return ReduceStore(node); |
47 case IrOpcode::kCheckMaps: | |
48 return ReduceCheckMaps(node); | |
49 case IrOpcode::kAllocate: | 47 case IrOpcode::kAllocate: |
50 return ReduceAllocate(node); | 48 return ReduceAllocate(node); |
51 case IrOpcode::kFinishRegion: | 49 case IrOpcode::kFinishRegion: |
52 return ReduceFinishRegion(node); | 50 return ReduceFinishRegion(node); |
53 case IrOpcode::kReferenceEqual: | 51 case IrOpcode::kReferenceEqual: |
54 return ReduceReferenceEqual(node); | 52 return ReduceReferenceEqual(node); |
55 case IrOpcode::kObjectIsSmi: | 53 case IrOpcode::kObjectIsSmi: |
56 return ReduceObjectIsSmi(node); | 54 return ReduceObjectIsSmi(node); |
57 // FrameStates and Value nodes are preprocessed here, | 55 // FrameStates and Value nodes are preprocessed here, |
58 // and visited via ReduceFrameStateUses from their user nodes. | 56 // and visited via ReduceFrameStateUses from their user nodes. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (escape_analysis()->IsVirtual( | 159 if (escape_analysis()->IsVirtual( |
162 SkipTypeGuards(NodeProperties::GetValueInput(node, 0)))) { | 160 SkipTypeGuards(NodeProperties::GetValueInput(node, 0)))) { |
163 TRACE("Removed #%d (%s) from effect chain\n", node->id(), | 161 TRACE("Removed #%d (%s) from effect chain\n", node->id(), |
164 node->op()->mnemonic()); | 162 node->op()->mnemonic()); |
165 RelaxEffectsAndControls(node); | 163 RelaxEffectsAndControls(node); |
166 return Changed(node); | 164 return Changed(node); |
167 } | 165 } |
168 return NoChange(); | 166 return NoChange(); |
169 } | 167 } |
170 | 168 |
171 Reduction EscapeAnalysisReducer::ReduceCheckMaps(Node* node) { | |
172 DCHECK(node->opcode() == IrOpcode::kCheckMaps); | |
173 if (node->id() < static_cast<NodeId>(fully_reduced_.length())) { | |
174 fully_reduced_.Add(node->id()); | |
175 } | |
176 if (escape_analysis()->IsVirtual( | |
177 SkipTypeGuards(NodeProperties::GetValueInput(node, 0))) && | |
178 !escape_analysis()->IsEscaped(node)) { | |
179 TRACE("Removed #%d (%s) from effect chain\n", node->id(), | |
180 node->op()->mnemonic()); | |
181 RelaxEffectsAndControls(node); | |
182 return Changed(node); | |
183 } | |
184 return NoChange(); | |
185 } | |
186 | 169 |
187 Reduction EscapeAnalysisReducer::ReduceAllocate(Node* node) { | 170 Reduction EscapeAnalysisReducer::ReduceAllocate(Node* node) { |
188 DCHECK_EQ(node->opcode(), IrOpcode::kAllocate); | 171 DCHECK_EQ(node->opcode(), IrOpcode::kAllocate); |
189 if (node->id() < static_cast<NodeId>(fully_reduced_.length())) { | 172 if (node->id() < static_cast<NodeId>(fully_reduced_.length())) { |
190 fully_reduced_.Add(node->id()); | 173 fully_reduced_.Add(node->id()); |
191 } | 174 } |
192 if (escape_analysis()->IsVirtual(node)) { | 175 if (escape_analysis()->IsVirtual(node)) { |
193 RelaxEffectsAndControls(node); | 176 RelaxEffectsAndControls(node); |
194 TRACE("Removed allocate #%d from effect chain\n", node->id()); | 177 TRACE("Removed allocate #%d from effect chain\n", node->id()); |
195 return Changed(node); | 178 return Changed(node); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (node->opcode() == IrOpcode::kAllocate) { | 376 if (node->opcode() == IrOpcode::kAllocate) { |
394 CHECK(!escape_analysis_->IsVirtual(node)); | 377 CHECK(!escape_analysis_->IsVirtual(node)); |
395 } | 378 } |
396 } | 379 } |
397 #endif // DEBUG | 380 #endif // DEBUG |
398 } | 381 } |
399 | 382 |
400 } // namespace compiler | 383 } // namespace compiler |
401 } // namespace internal | 384 } // namespace internal |
402 } // namespace v8 | 385 } // namespace v8 |
OLD | NEW |