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 11 matching lines...) Expand all Loading... | |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 #include "lithium-allocator-inl.h" | 29 #include "lithium-allocator-inl.h" |
30 | 30 |
31 #include "hydrogen.h" | 31 #include "hydrogen.h" |
32 #include "once.h" | |
32 #include "string-stream.h" | 33 #include "string-stream.h" |
33 | 34 |
34 #if V8_TARGET_ARCH_IA32 | 35 #if V8_TARGET_ARCH_IA32 |
35 #include "ia32/lithium-ia32.h" | 36 #include "ia32/lithium-ia32.h" |
36 #elif V8_TARGET_ARCH_X64 | 37 #elif V8_TARGET_ARCH_X64 |
37 #include "x64/lithium-x64.h" | 38 #include "x64/lithium-x64.h" |
38 #elif V8_TARGET_ARCH_ARM | 39 #elif V8_TARGET_ARCH_ARM |
39 #include "arm/lithium-arm.h" | 40 #include "arm/lithium-arm.h" |
40 #elif V8_TARGET_ARCH_MIPS | 41 #elif V8_TARGET_ARCH_MIPS |
41 #include "mips/lithium-mips.h" | 42 #include "mips/lithium-mips.h" |
42 #else | 43 #else |
43 #error "Unknown architecture." | 44 #error "Unknown architecture." |
44 #endif | 45 #endif |
45 | 46 |
46 namespace v8 { | 47 namespace v8 { |
47 namespace internal { | 48 namespace internal { |
48 | 49 |
49 | |
50 #define DEFINE_OPERAND_CACHE(name, type) \ | 50 #define DEFINE_OPERAND_CACHE(name, type) \ |
51 name name::cache[name::kNumCachedOperands]; \ | 51 name* name::cache = NULL; \ |
52 OnceType name::init_cache_once_ = V8_ONCE_INIT; \ | |
52 void name::SetUpCache() { \ | 53 void name::SetUpCache() { \ |
53 for (int i = 0; i < kNumCachedOperands; i++) { \ | 54 CallOnce(&init_cache_once_, \ |
54 cache[i].ConvertTo(type, i); \ | 55 &InitCache<name, kNumCachedOperands, type>, \ |
55 } \ | 56 &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.
| |
56 } \ | 57 } \ |
57 static bool name##_initialize() { \ | |
58 name::SetUpCache(); \ | |
59 return true; \ | |
60 } \ | |
61 static bool name##_cache_initialized = name##_initialize(); | |
62 | 58 |
63 DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND) | 59 DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND) |
64 DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT) | 60 DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT) |
65 DEFINE_OPERAND_CACHE(LDoubleStackSlot, DOUBLE_STACK_SLOT) | 61 DEFINE_OPERAND_CACHE(LDoubleStackSlot, DOUBLE_STACK_SLOT) |
66 DEFINE_OPERAND_CACHE(LRegister, REGISTER) | 62 DEFINE_OPERAND_CACHE(LRegister, REGISTER) |
67 DEFINE_OPERAND_CACHE(LDoubleRegister, DOUBLE_REGISTER) | 63 DEFINE_OPERAND_CACHE(LDoubleRegister, DOUBLE_REGISTER) |
68 | 64 |
69 #undef DEFINE_OPERAND_CACHE | 65 #undef DEFINE_OPERAND_CACHE |
70 | 66 |
71 | 67 |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2119 LiveRange* current = live_ranges()->at(i); | 2115 LiveRange* current = live_ranges()->at(i); |
2120 if (current != NULL) current->Verify(); | 2116 if (current != NULL) current->Verify(); |
2121 } | 2117 } |
2122 } | 2118 } |
2123 | 2119 |
2124 | 2120 |
2125 #endif | 2121 #endif |
2126 | 2122 |
2127 | 2123 |
2128 } } // namespace v8::internal | 2124 } } // namespace v8::internal |
OLD | NEW |