Index: src/lithium.cc |
=================================================================== |
--- src/lithium.cc (revision 11005) |
+++ src/lithium.cc (working copy) |
@@ -94,7 +94,32 @@ |
} |
} |
+#define DEFINE_OPERAND_CACHE(name, type) \ |
+ name* name::cache = NULL; \ |
+ void name::SetUpCache() { \ |
+ if (cache) return; \ |
+ cache = new name[kNumCachedOperands]; \ |
+ for (int i = 0; i < kNumCachedOperands; i++) { \ |
+ cache[i].ConvertTo(type, i); \ |
+ } \ |
+ } \ |
+DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND) |
+DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT) |
+DEFINE_OPERAND_CACHE(LDoubleStackSlot, DOUBLE_STACK_SLOT) |
+DEFINE_OPERAND_CACHE(LRegister, REGISTER) |
+DEFINE_OPERAND_CACHE(LDoubleRegister, DOUBLE_REGISTER) |
+ |
+#undef DEFINE_OPERAND_CACHE |
+ |
+void LOperand::SetUpCaches() { |
+ LConstantOperand::SetUpCache(); |
+ LStackSlot::SetUpCache(); |
+ LDoubleStackSlot::SetUpCache(); |
+ LRegister::SetUpCache(); |
+ LDoubleRegister::SetUpCache(); |
+} |
+ |
bool LParallelMove::IsRedundant() const { |
for (int i = 0; i < move_operands_.length(); ++i) { |
if (!move_operands_[i].IsRedundant()) return false; |