| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 current_(0) { | 92 current_(0) { |
| 93 SkipUninteresting(); | 93 SkipUninteresting(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 bool InputIterator::Done() { return current_ >= limit_; } | 97 bool InputIterator::Done() { return current_ >= limit_; } |
| 98 | 98 |
| 99 | 99 |
| 100 LOperand* InputIterator::Current() { | 100 LOperand* InputIterator::Current() { |
| 101 ASSERT(!Done()); | 101 ASSERT(!Done()); |
| 102 ASSERT(instr_->InputAt(current_) != NULL); |
| 102 return instr_->InputAt(current_); | 103 return instr_->InputAt(current_); |
| 103 } | 104 } |
| 104 | 105 |
| 105 | 106 |
| 106 void InputIterator::Advance() { | 107 void InputIterator::Advance() { |
| 107 ++current_; | 108 ++current_; |
| 108 SkipUninteresting(); | 109 SkipUninteresting(); |
| 109 } | 110 } |
| 110 | 111 |
| 111 | 112 |
| 112 void InputIterator::SkipUninteresting() { | 113 void InputIterator::SkipUninteresting() { |
| 113 while (current_ < limit_ && instr_->InputAt(current_)->IsConstantOperand()) { | 114 while (current_ < limit_) { |
| 115 LOperand* current = instr_->InputAt(current_); |
| 116 if (current != NULL && !current->IsConstantOperand()) break; |
| 114 ++current_; | 117 ++current_; |
| 115 } | 118 } |
| 116 } | 119 } |
| 117 | 120 |
| 118 | 121 |
| 119 UseIterator::UseIterator(LInstruction* instr) | 122 UseIterator::UseIterator(LInstruction* instr) |
| 120 : input_iterator_(instr), env_iterator_(instr->environment()) { } | 123 : input_iterator_(instr), env_iterator_(instr->environment()) { } |
| 121 | 124 |
| 122 | 125 |
| 123 bool UseIterator::Done() { | 126 bool UseIterator::Done() { |
| 124 return input_iterator_.Done() && env_iterator_.Done(); | 127 return input_iterator_.Done() && env_iterator_.Done(); |
| 125 } | 128 } |
| 126 | 129 |
| 127 | 130 |
| 128 LOperand* UseIterator::Current() { | 131 LOperand* UseIterator::Current() { |
| 129 ASSERT(!Done()); | 132 ASSERT(!Done()); |
| 130 return input_iterator_.Done() | 133 LOperand* result = input_iterator_.Done() |
| 131 ? env_iterator_.Current() | 134 ? env_iterator_.Current() |
| 132 : input_iterator_.Current(); | 135 : input_iterator_.Current(); |
| 136 ASSERT(result != NULL); |
| 137 return result; |
| 133 } | 138 } |
| 134 | 139 |
| 135 | 140 |
| 136 void UseIterator::Advance() { | 141 void UseIterator::Advance() { |
| 137 input_iterator_.Done() | 142 input_iterator_.Done() |
| 138 ? env_iterator_.Advance() | 143 ? env_iterator_.Advance() |
| 139 : input_iterator_.Advance(); | 144 : input_iterator_.Advance(); |
| 140 } | 145 } |
| 141 | 146 |
| 142 } } // namespace v8::internal | 147 } } // namespace v8::internal |
| 143 | 148 |
| 144 #endif // V8_LITHIUM_ALLOCATOR_INL_H_ | 149 #endif // V8_LITHIUM_ALLOCATOR_INL_H_ |
| OLD | NEW |