| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } else if (!stack.is_empty()) { | 116 } else if (!stack.is_empty()) { |
| 117 // Pop next pending block from stack. | 117 // Pop next pending block from stack. |
| 118 Pending pending = stack.RemoveLast(); | 118 Pending pending = stack.RemoveLast(); |
| 119 RollBackTo(pending.last_changed_range()); | 119 RollBackTo(pending.last_changed_range()); |
| 120 block = pending.block(); | 120 block = pending.block(); |
| 121 } else { | 121 } else { |
| 122 // All blocks done. | 122 // All blocks done. |
| 123 block = NULL; | 123 block = NULL; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 |
| 127 // The ranges are not valid anymore due to SSI vs. SSA! |
| 128 PoisonRanges(); |
| 126 } | 129 } |
| 127 | 130 |
| 128 | 131 |
| 132 void HRangeAnalysisPhase::PoisonRanges() { |
| 133 #ifdef DEBUG |
| 134 for (int i = 0; i < graph()->blocks()->length(); ++i) { |
| 135 HBasicBlock* block = graph()->blocks()->at(i); |
| 136 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { |
| 137 HInstruction* instr = it.Current(); |
| 138 if (instr->HasRange()) instr->PoisonRange(); |
| 139 } |
| 140 } |
| 141 #endif |
| 142 } |
| 143 |
| 144 |
| 129 void HRangeAnalysisPhase::InferControlFlowRange(HCompareNumericAndBranch* test, | 145 void HRangeAnalysisPhase::InferControlFlowRange(HCompareNumericAndBranch* test, |
| 130 HBasicBlock* dest) { | 146 HBasicBlock* dest) { |
| 131 ASSERT((test->FirstSuccessor() == dest) == (test->SecondSuccessor() != dest)); | 147 ASSERT((test->FirstSuccessor() == dest) == (test->SecondSuccessor() != dest)); |
| 132 if (test->representation().IsSmiOrInteger32()) { | 148 if (test->representation().IsSmiOrInteger32()) { |
| 133 Token::Value op = test->token(); | 149 Token::Value op = test->token(); |
| 134 if (test->SecondSuccessor() == dest) { | 150 if (test->SecondSuccessor() == dest) { |
| 135 op = Token::NegateCompareOp(op); | 151 op = Token::NegateCompareOp(op); |
| 136 } | 152 } |
| 137 Token::Value inverted_op = Token::ReverseCompareOp(op); | 153 Token::Value inverted_op = Token::ReverseCompareOp(op); |
| 138 UpdateControlFlowRange(op, test->left(), test->right()); | 154 UpdateControlFlowRange(op, test->left(), test->right()); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 304 } |
| 289 } | 305 } |
| 290 | 306 |
| 291 in_worklist_.Clear(); | 307 in_worklist_.Clear(); |
| 292 ASSERT(in_worklist_.IsEmpty()); | 308 ASSERT(in_worklist_.IsEmpty()); |
| 293 ASSERT(worklist_.is_empty()); | 309 ASSERT(worklist_.is_empty()); |
| 294 } | 310 } |
| 295 | 311 |
| 296 | 312 |
| 297 } } // namespace v8::internal | 313 } } // namespace v8::internal |
| OLD | NEW |