Index: src/lithium.cc |
diff --git a/src/lithium.cc b/src/lithium.cc |
index ab1e630c705376848791c366a46685c719920d1f..5abcbdd79f3eb3db5a64135147ff12fddcbfd3b0 100644 |
--- a/src/lithium.cc |
+++ b/src/lithium.cc |
@@ -117,33 +117,37 @@ void LOperand::PrintTo(StringStream* stream) { |
} |
} |
-#define DEFINE_OPERAND_CACHE(name, type) \ |
- L##name* L##name::cache = NULL; \ |
- \ |
- void L##name::SetUpCache() { \ |
- if (cache) return; \ |
- cache = new L##name[kNumCachedOperands]; \ |
- for (int i = 0; i < kNumCachedOperands; i++) { \ |
- cache[i].ConvertTo(type, i); \ |
- } \ |
- } \ |
- \ |
- void L##name::TearDownCache() { \ |
- delete[] cache; \ |
+ |
+template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
+LSubKindOperand<kOperandKind, kNumCachedOperands>* |
+LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL; |
+ |
+ |
+template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
+void LSubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() { |
+ if (cache) return; |
+ cache = new LSubKindOperand[kNumCachedOperands]; |
+ for (int i = 0; i < kNumCachedOperands; i++) { |
+ cache[i].ConvertTo(kOperandKind, i); |
} |
+} |
+ |
+ |
+template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
+void LSubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() { |
+ delete[] cache; |
+} |
-LITHIUM_OPERAND_LIST(DEFINE_OPERAND_CACHE) |
-#undef DEFINE_OPERAND_CACHE |
void LOperand::SetUpCaches() { |
-#define LITHIUM_OPERAND_SETUP(name, type) L##name::SetUpCache(); |
+#define LITHIUM_OPERAND_SETUP(name, type, number) L##name::SetUpCache(); |
LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP) |
#undef LITHIUM_OPERAND_SETUP |
} |
void LOperand::TearDownCaches() { |
-#define LITHIUM_OPERAND_TEARDOWN(name, type) L##name::TearDownCache(); |
+#define LITHIUM_OPERAND_TEARDOWN(name, type, number) L##name::TearDownCache(); |
LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_TEARDOWN) |
#undef LITHIUM_OPERAND_TEARDOWN |
} |