Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | |
| 2 // Redistribution and use in source and binary forms, with or without | |
| 3 // modification, are permitted provided that the following conditions are | |
| 4 // met: | |
| 5 // | |
| 6 // * Redistributions of source code must retain the above copyright | |
| 7 // notice, this list of conditions and the following disclaimer. | |
| 8 // * Redistributions in binary form must reproduce the above | |
| 9 // copyright notice, this list of conditions and the following | |
| 10 // disclaimer in the documentation and/or other materials provided | |
| 11 // with the distribution. | |
| 12 // * Neither the name of Google Inc. nor the names of its | |
| 13 // contributors may be used to endorse or promote products derived | |
| 14 // from this software without specific prior written permission. | |
| 15 // | |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | |
| 28 #ifndef V8_LITHIUM_ALLOCATOR_INL_H_ | |
| 29 #define V8_LITHIUM_ALLOCATOR_INL_H_ | |
| 30 | |
| 31 #include "lithium-allocator.h" | |
| 32 | |
| 33 #if V8_TARGET_ARCH_IA32 | |
|
Kevin Millikin (Chromium)
2011/01/20 12:20:30
Ultimately (not as part of this change), I'd like
| |
| 34 #include "ia32/lithium-ia32.h" | |
| 35 #elif V8_TARGET_ARCH_X64 | |
| 36 #include "x64/lithium-x64.h" | |
| 37 #elif V8_TARGET_ARCH_ARM | |
| 38 #include "arm/lithium-arm.h" | |
| 39 #else | |
| 40 #error "Unknown architecture." | |
| 41 #endif | |
| 42 | |
| 43 namespace v8 { | |
| 44 namespace internal { | |
| 45 | |
| 46 TempIterator::TempIterator(LInstruction* instr) | |
| 47 : instr_(instr), current_(0) { | |
| 48 Advance(); | |
| 49 } | |
| 50 | |
| 51 | |
| 52 bool TempIterator::HasNext() { return current_ < instr_->TempCount(); } | |
|
Kevin Millikin (Chromium)
2011/01/20 12:20:30
I'm not sure it makes much difference, but I'd put
fschneider
2011/01/20 17:13:08
Good point. Done.
| |
| 53 | |
| 54 | |
| 55 LOperand* TempIterator::Next() { | |
| 56 LOperand* elem = instr_->TempAt(current_++); | |
| 57 Advance(); | |
| 58 return elem; | |
| 59 } | |
| 60 | |
| 61 | |
| 62 void TempIterator::Advance() { | |
| 63 while (HasNext() && instr_->TempAt(current_) == NULL) current_++; | |
| 64 } | |
| 65 | |
| 66 | |
| 67 InputIterator::InputIterator(LInstruction* instr) | |
| 68 : instr_(instr), current_(0) { | |
| 69 Advance(); | |
| 70 } | |
| 71 | |
| 72 | |
| 73 bool InputIterator::HasNext() { return current_ < instr_->InputCount(); } | |
| 74 | |
| 75 | |
| 76 LOperand* InputIterator::Next() { | |
| 77 LOperand* elem = HasNext() ? instr_->InputAt(current_++) : NULL; | |
| 78 Advance(); | |
| 79 return elem; | |
| 80 } | |
| 81 | |
| 82 | |
| 83 void InputIterator::Advance() { | |
| 84 while (HasNext() && instr_->InputAt(current_)->IsConstantOperand()) { | |
| 85 current_++; | |
| 86 } | |
| 87 } | |
| 88 | |
| 89 | |
| 90 UseIterator::UseIterator(LInstruction* instr) | |
| 91 : input_iterator_(instr), | |
| 92 env_iterator_(instr->HasEnvironment() ? instr->environment() : NULL) { } | |
|
Kevin Millikin (Chromium)
2011/01/20 12:20:30
Using SetOncePointer for the environment is probab
fschneider
2011/01/20 17:13:08
Done. Made it a normal pointer.
| |
| 93 | |
| 94 | |
| 95 bool UseIterator::HasNext() { | |
| 96 return input_iterator_.HasNext() || env_iterator_.HasNext(); | |
| 97 } | |
| 98 | |
| 99 | |
| 100 LOperand* UseIterator::Next() { | |
| 101 return input_iterator_.HasNext() | |
| 102 ? input_iterator_.Next() | |
| 103 : env_iterator_.Next(); | |
| 104 } | |
| 105 | |
| 106 | |
| 107 } } // namespace v8::internal | |
| 108 | |
| 109 #endif // V8_LITHIUM_ALLOCATOR_INL_H_ | |
| OLD | NEW |