OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 break; | 110 break; |
111 case DOUBLE_REGISTER: | 111 case DOUBLE_REGISTER: |
112 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); | 112 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); |
113 break; | 113 break; |
114 case ARGUMENT: | 114 case ARGUMENT: |
115 stream->Add("[arg:%d]", index()); | 115 stream->Add("[arg:%d]", index()); |
116 break; | 116 break; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 #define DEFINE_OPERAND_CACHE(name, type) \ | 120 |
121 L##name* L##name::cache = NULL; \ | 121 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
122 \ | 122 LSubKindOperand<kOperandKind, kNumCachedOperands>* |
123 void L##name::SetUpCache() { \ | 123 LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL; |
124 if (cache) return; \ | 124 |
125 cache = new L##name[kNumCachedOperands]; \ | 125 |
126 for (int i = 0; i < kNumCachedOperands; i++) { \ | 126 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
127 cache[i].ConvertTo(type, i); \ | 127 void LSubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() { |
128 } \ | 128 if (cache) return; |
129 } \ | 129 cache = new LSubKindOperand[kNumCachedOperands]; |
130 \ | 130 for (int i = 0; i < kNumCachedOperands; i++) { |
131 void L##name::TearDownCache() { \ | 131 cache[i].ConvertTo(kOperandKind, i); |
132 delete[] cache; \ | |
133 } | 132 } |
| 133 } |
134 | 134 |
135 LITHIUM_OPERAND_LIST(DEFINE_OPERAND_CACHE) | 135 |
136 #undef DEFINE_OPERAND_CACHE | 136 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
| 137 void LSubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() { |
| 138 delete[] cache; |
| 139 } |
| 140 |
137 | 141 |
138 void LOperand::SetUpCaches() { | 142 void LOperand::SetUpCaches() { |
139 #define LITHIUM_OPERAND_SETUP(name, type) L##name::SetUpCache(); | 143 #define LITHIUM_OPERAND_SETUP(name, type, number) L##name::SetUpCache(); |
140 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP) | 144 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP) |
141 #undef LITHIUM_OPERAND_SETUP | 145 #undef LITHIUM_OPERAND_SETUP |
142 } | 146 } |
143 | 147 |
144 | 148 |
145 void LOperand::TearDownCaches() { | 149 void LOperand::TearDownCaches() { |
146 #define LITHIUM_OPERAND_TEARDOWN(name, type) L##name::TearDownCache(); | 150 #define LITHIUM_OPERAND_TEARDOWN(name, type, number) L##name::TearDownCache(); |
147 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_TEARDOWN) | 151 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_TEARDOWN) |
148 #undef LITHIUM_OPERAND_TEARDOWN | 152 #undef LITHIUM_OPERAND_TEARDOWN |
149 } | 153 } |
150 | 154 |
151 | 155 |
152 bool LParallelMove::IsRedundant() const { | 156 bool LParallelMove::IsRedundant() const { |
153 for (int i = 0; i < move_operands_.length(); ++i) { | 157 for (int i = 0; i < move_operands_.length(); ++i) { |
154 if (!move_operands_[i].IsRedundant()) return false; | 158 if (!move_operands_[i].IsRedundant()) return false; |
155 } | 159 } |
156 return true; | 160 return true; |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 612 |
609 | 613 |
610 LPhase::~LPhase() { | 614 LPhase::~LPhase() { |
611 if (ShouldProduceTraceOutput()) { | 615 if (ShouldProduceTraceOutput()) { |
612 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 616 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
613 } | 617 } |
614 } | 618 } |
615 | 619 |
616 | 620 |
617 } } // namespace v8::internal | 621 } } // namespace v8::internal |
OLD | NEW |