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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 PendingEffectPhi(Node* effect_phi, BasicBlock* block) | 68 PendingEffectPhi(Node* effect_phi, BasicBlock* block) |
69 : effect_phi(effect_phi), block(block) {} | 69 : effect_phi(effect_phi), block(block) {} |
70 }; | 70 }; |
71 | 71 |
72 void UpdateEffectPhi(Node* node, BasicBlock* block, | 72 void UpdateEffectPhi(Node* node, BasicBlock* block, |
73 BlockEffectControlMap* block_effects) { | 73 BlockEffectControlMap* block_effects) { |
74 // Update all inputs to an effect phi with the effects from the given | 74 // Update all inputs to an effect phi with the effects from the given |
75 // block->effect map. | 75 // block->effect map. |
76 DCHECK_EQ(IrOpcode::kEffectPhi, node->opcode()); | 76 DCHECK_EQ(IrOpcode::kEffectPhi, node->opcode()); |
77 DCHECK_EQ(node->op()->EffectInputCount(), block->PredecessorCount()); | 77 DCHECK_EQ(static_cast<size_t>(node->op()->EffectInputCount()), |
| 78 block->PredecessorCount()); |
78 for (int i = 0; i < node->op()->EffectInputCount(); i++) { | 79 for (int i = 0; i < node->op()->EffectInputCount(); i++) { |
79 Node* input = node->InputAt(i); | 80 Node* input = node->InputAt(i); |
80 BasicBlock* predecessor = block->PredecessorAt(static_cast<size_t>(i)); | 81 BasicBlock* predecessor = block->PredecessorAt(static_cast<size_t>(i)); |
81 const BlockEffectControlData& block_effect = | 82 const BlockEffectControlData& block_effect = |
82 block_effects->For(predecessor, block); | 83 block_effects->For(predecessor, block); |
83 if (input != block_effect.current_effect) { | 84 if (input != block_effect.current_effect) { |
84 node->ReplaceInput(i, block_effect.current_effect); | 85 node->ReplaceInput(i, block_effect.current_effect); |
85 } | 86 } |
86 } | 87 } |
87 } | 88 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 merge_false_inputs[index] = graph->NewNode(common->IfFalse(), branch1); | 242 merge_false_inputs[index] = graph->NewNode(common->IfFalse(), branch1); |
242 } | 243 } |
243 Node* const merge_true = matcher.IfTrue(); | 244 Node* const merge_true = matcher.IfTrue(); |
244 Node* const merge_false = matcher.IfFalse(); | 245 Node* const merge_false = matcher.IfFalse(); |
245 merge_true->TrimInputCount(0); | 246 merge_true->TrimInputCount(0); |
246 merge_false->TrimInputCount(0); | 247 merge_false->TrimInputCount(0); |
247 for (int i = 0; i < input_count; ++i) { | 248 for (int i = 0; i < input_count; ++i) { |
248 merge_true->AppendInput(graph->zone(), merge_true_inputs[i]); | 249 merge_true->AppendInput(graph->zone(), merge_true_inputs[i]); |
249 merge_false->AppendInput(graph->zone(), merge_false_inputs[i]); | 250 merge_false->AppendInput(graph->zone(), merge_false_inputs[i]); |
250 } | 251 } |
251 DCHECK_EQ(2, block->SuccessorCount()); | 252 DCHECK_EQ(2u, block->SuccessorCount()); |
252 NodeProperties::ChangeOp(matcher.IfTrue(), common->Merge(input_count)); | 253 NodeProperties::ChangeOp(matcher.IfTrue(), common->Merge(input_count)); |
253 NodeProperties::ChangeOp(matcher.IfFalse(), common->Merge(input_count)); | 254 NodeProperties::ChangeOp(matcher.IfFalse(), common->Merge(input_count)); |
254 int const true_index = | 255 int const true_index = |
255 block->SuccessorAt(0)->NodeAt(0) == matcher.IfTrue() ? 0 : 1; | 256 block->SuccessorAt(0)->NodeAt(0) == matcher.IfTrue() ? 0 : 1; |
256 BlockEffectControlData* true_block_data = | 257 BlockEffectControlData* true_block_data = |
257 &block_effects->For(block, block->SuccessorAt(true_index)); | 258 &block_effects->For(block, block->SuccessorAt(true_index)); |
258 BlockEffectControlData* false_block_data = | 259 BlockEffectControlData* false_block_data = |
259 &block_effects->For(block, block->SuccessorAt(true_index ^ 1)); | 260 &block_effects->For(block, block->SuccessorAt(true_index ^ 1)); |
260 for (Node* const phi : phis) { | 261 for (Node* const phi : phis) { |
261 for (int index = 0; index < input_count; ++index) { | 262 for (int index = 0; index < input_count; ++index) { |
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3753 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3754 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3754 Operator::kEliminatable); | 3755 Operator::kEliminatable); |
3755 to_number_operator_.set(common()->Call(desc)); | 3756 to_number_operator_.set(common()->Call(desc)); |
3756 } | 3757 } |
3757 return to_number_operator_.get(); | 3758 return to_number_operator_.get(); |
3758 } | 3759 } |
3759 | 3760 |
3760 } // namespace compiler | 3761 } // namespace compiler |
3761 } // namespace internal | 3762 } // namespace internal |
3762 } // namespace v8 | 3763 } // namespace v8 |
OLD | NEW |