Chromium Code Reviews| Index: src/lithium-allocator.cc |
| diff --git a/src/lithium-allocator.cc b/src/lithium-allocator.cc |
| index 2cab9a7665bf125d7477e6aac5ca0f7e364546ef..03636b37755dc4bb9e22acb96f7b8cd61538d211 100644 |
| --- a/src/lithium-allocator.cc |
| +++ b/src/lithium-allocator.cc |
| @@ -29,6 +29,7 @@ |
| #include "lithium-allocator-inl.h" |
| #include "hydrogen.h" |
| +#include "once.h" |
| #include "string-stream.h" |
| #if V8_TARGET_ARCH_IA32 |
| @@ -46,19 +47,14 @@ |
| namespace v8 { |
| namespace internal { |
| - |
| #define DEFINE_OPERAND_CACHE(name, type) \ |
| - name name::cache[name::kNumCachedOperands]; \ |
| + name* name::cache = NULL; \ |
| + OnceType name::init_cache_once_ = V8_ONCE_INIT; \ |
| void name::SetUpCache() { \ |
| - for (int i = 0; i < kNumCachedOperands; i++) { \ |
| - cache[i].ConvertTo(type, i); \ |
| - } \ |
| - } \ |
| - static bool name##_initialize() { \ |
| - name::SetUpCache(); \ |
| - return true; \ |
| + CallOnce(&init_cache_once_, \ |
| + &InitCache<name, kNumCachedOperands, type>, \ |
| + &name::cache); \ |
|
fschneider
2012/02/28 16:54:48
I'd move this initialization to lithium.cc since i
Philippe
2012/02/29 10:24:45
Done.
|
| } \ |
| - static bool name##_cache_initialized = name##_initialize(); |
| DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND) |
| DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT) |