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_TYPE_CACHE_H_ | 5 #ifndef V8_TYPE_CACHE_H_ |
6 #define V8_TYPE_CACHE_H_ | 6 #define V8_TYPE_CACHE_H_ |
7 | 7 |
8 #include "src/types.h" | 8 #include "src/types.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // The JSArray::length property always contains a tagged number in the range | 87 // The JSArray::length property always contains a tagged number in the range |
88 // [0, kMaxUInt32]. | 88 // [0, kMaxUInt32]. |
89 Type* const kJSArrayLengthType = | 89 Type* const kJSArrayLengthType = |
90 CreateNative(Type::Unsigned32(), Type::Tagged()); | 90 CreateNative(Type::Unsigned32(), Type::Tagged()); |
91 | 91 |
92 // The String::length property always contains a smi in the range | 92 // The String::length property always contains a smi in the range |
93 // [0, String::kMaxLength]. | 93 // [0, String::kMaxLength]. |
94 Type* const kStringLengthType = | 94 Type* const kStringLengthType = |
95 CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned()); | 95 CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned()); |
96 | 96 |
| 97 // When initializing arrays, we'll unfold the loop if the number of |
| 98 // elements is known to be of this type. |
| 99 Type* const kElementLoopUnrollType = CreateRange(0.0, 16.0); |
| 100 |
97 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ | 101 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ |
98 Type* const k##TypeName##Array = CreateArray(k##TypeName); | 102 Type* const k##TypeName##Array = CreateArray(k##TypeName); |
99 TYPED_ARRAYS(TYPED_ARRAY) | 103 TYPED_ARRAYS(TYPED_ARRAY) |
100 #undef TYPED_ARRAY | 104 #undef TYPED_ARRAY |
101 | 105 |
102 private: | 106 private: |
103 Type* CreateArray(Type* element) { return Type::Array(element, zone()); } | 107 Type* CreateArray(Type* element) { return Type::Array(element, zone()); } |
104 | 108 |
105 Type* CreateArrayFunction(Type* array) { | 109 Type* CreateArrayFunction(Type* array) { |
106 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone()); | 110 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone()); |
(...skipping 16 matching lines...) Expand all Loading... |
123 return Type::Range(min, max, zone()); | 127 return Type::Range(min, max, zone()); |
124 } | 128 } |
125 | 129 |
126 Zone* zone() { return &zone_; } | 130 Zone* zone() { return &zone_; } |
127 }; | 131 }; |
128 | 132 |
129 } // namespace internal | 133 } // namespace internal |
130 } // namespace v8 | 134 } // namespace v8 |
131 | 135 |
132 #endif // V8_TYPE_CACHE_H_ | 136 #endif // V8_TYPE_CACHE_H_ |
OLD | NEW |