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