OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_TYPE_CACHE_H_ | 5 #ifndef V8_COMPILER_TYPE_CACHE_H_ |
6 #define V8_COMPILER_TYPE_CACHE_H_ | 6 #define V8_COMPILER_TYPE_CACHE_H_ |
7 | 7 |
8 #include "src/compiler/types.h" | 8 #include "src/compiler/types.h" |
9 #include "src/date.h" | 9 #include "src/date.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 class TypeCache final { | 15 class TypeCache final { |
16 private: | 16 private: |
17 // This has to be first for the initialization magic to work. | 17 // This has to be first for the initialization magic to work. |
18 AccountingAllocator allocator; | 18 AccountingAllocator allocator; |
19 Zone zone_; | 19 Zone zone_; |
20 | 20 |
21 public: | 21 public: |
22 static TypeCache const& Get(); | 22 static TypeCache const& Get(); |
23 | 23 |
24 TypeCache() : zone_(&allocator, ZONE_NAME) {} | 24 TypeCache() : zone_(&allocator, ZONE_NAME) {} |
25 | 25 |
26 Type* const kInt8 = CreateRange<int8_t>(); | 26 Type* const kInt8 = CreateRange<int8_t>(); |
27 Type* const kUint8 = CreateRange<uint8_t>(); | 27 Type* const kUint8 = CreateRange<uint8_t>(); |
28 Type* const kUint8Clamped = kUint8; | 28 Type* const kUint8Clamped = kUint8; |
| 29 Type* const kUint8OrMinusZeroOrNaN = |
| 30 Type::Union(kUint8, Type::MinusZeroOrNaN(), zone()); |
29 Type* const kInt16 = CreateRange<int16_t>(); | 31 Type* const kInt16 = CreateRange<int16_t>(); |
30 Type* const kUint16 = CreateRange<uint16_t>(); | 32 Type* const kUint16 = CreateRange<uint16_t>(); |
31 Type* const kInt32 = Type::Signed32(); | 33 Type* const kInt32 = Type::Signed32(); |
32 Type* const kUint32 = Type::Unsigned32(); | 34 Type* const kUint32 = Type::Unsigned32(); |
33 Type* const kFloat32 = Type::Number(); | 35 Type* const kFloat32 = Type::Number(); |
34 Type* const kFloat64 = Type::Number(); | 36 Type* const kFloat64 = Type::Number(); |
35 | 37 |
36 Type* const kSmi = Type::SignedSmall(); | 38 Type* const kSmi = Type::SignedSmall(); |
37 Type* const kHoleySmi = Type::Union(kSmi, Type::Hole(), zone()); | 39 Type* const kHoleySmi = Type::Union(kSmi, Type::Hole(), zone()); |
38 Type* const kHeapNumber = Type::Number(); | 40 Type* const kHeapNumber = Type::Number(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 150 } |
149 | 151 |
150 Zone* zone() { return &zone_; } | 152 Zone* zone() { return &zone_; } |
151 }; | 153 }; |
152 | 154 |
153 } // namespace compiler | 155 } // namespace compiler |
154 } // namespace internal | 156 } // namespace internal |
155 } // namespace v8 | 157 } // namespace v8 |
156 | 158 |
157 #endif // V8_COMPILER_TYPE_CACHE_H_ | 159 #endif // V8_COMPILER_TYPE_CACHE_H_ |
OLD | NEW |