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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 break; | 87 break; |
88 case DOUBLE_REGISTER: | 88 case DOUBLE_REGISTER: |
89 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); | 89 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); |
90 break; | 90 break; |
91 case ARGUMENT: | 91 case ARGUMENT: |
92 stream->Add("[arg:%d]", index()); | 92 stream->Add("[arg:%d]", index()); |
93 break; | 93 break; |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
| 97 #define DEFINE_OPERAND_CACHE(name, type) \ |
| 98 name* name::cache = NULL; \ |
| 99 void name::SetUpCache() { \ |
| 100 if (cache) return; \ |
| 101 cache = new name[kNumCachedOperands]; \ |
| 102 for (int i = 0; i < kNumCachedOperands; i++) { \ |
| 103 cache[i].ConvertTo(type, i); \ |
| 104 } \ |
| 105 } \ |
| 106 |
| 107 DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND) |
| 108 DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT) |
| 109 DEFINE_OPERAND_CACHE(LDoubleStackSlot, DOUBLE_STACK_SLOT) |
| 110 DEFINE_OPERAND_CACHE(LRegister, REGISTER) |
| 111 DEFINE_OPERAND_CACHE(LDoubleRegister, DOUBLE_REGISTER) |
| 112 |
| 113 #undef DEFINE_OPERAND_CACHE |
| 114 |
| 115 void LOperand::SetUpCaches() { |
| 116 LConstantOperand::SetUpCache(); |
| 117 LStackSlot::SetUpCache(); |
| 118 LDoubleStackSlot::SetUpCache(); |
| 119 LRegister::SetUpCache(); |
| 120 LDoubleRegister::SetUpCache(); |
| 121 } |
97 | 122 |
98 bool LParallelMove::IsRedundant() const { | 123 bool LParallelMove::IsRedundant() const { |
99 for (int i = 0; i < move_operands_.length(); ++i) { | 124 for (int i = 0; i < move_operands_.length(); ++i) { |
100 if (!move_operands_[i].IsRedundant()) return false; | 125 if (!move_operands_[i].IsRedundant()) return false; |
101 } | 126 } |
102 return true; | 127 return true; |
103 } | 128 } |
104 | 129 |
105 | 130 |
106 void LParallelMove::PrintDataTo(StringStream* stream) const { | 131 void LParallelMove::PrintDataTo(StringStream* stream) const { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 case DICTIONARY_ELEMENTS: | 225 case DICTIONARY_ELEMENTS: |
201 case NON_STRICT_ARGUMENTS_ELEMENTS: | 226 case NON_STRICT_ARGUMENTS_ELEMENTS: |
202 return kPointerSizeLog2; | 227 return kPointerSizeLog2; |
203 } | 228 } |
204 UNREACHABLE(); | 229 UNREACHABLE(); |
205 return 0; | 230 return 0; |
206 } | 231 } |
207 | 232 |
208 | 233 |
209 } } // namespace v8::internal | 234 } } // namespace v8::internal |
OLD | NEW |