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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // The JSArray::length property always contains a tagged number in the range | 105 // The JSArray::length property always contains a tagged number in the range |
106 // [0, kMaxUInt32]. | 106 // [0, kMaxUInt32]. |
107 Type* const kJSArrayLengthType = | 107 Type* const kJSArrayLengthType = |
108 CreateNative(Type::Unsigned32(), Type::Tagged()); | 108 CreateNative(Type::Unsigned32(), Type::Tagged()); |
109 | 109 |
110 // The String::length property always contains a smi in the range | 110 // The String::length property always contains a smi in the range |
111 // [0, String::kMaxLength]. | 111 // [0, String::kMaxLength]. |
112 Type* const kStringLengthType = | 112 Type* const kStringLengthType = |
113 CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned()); | 113 CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned()); |
114 | 114 |
115 // When initializing arrays, we'll unfold the loop if the number of | |
116 // elements is known to be of this type. | |
117 Type* const kElementLoopUnrollType = CreateRange(0.0, 16.0); | |
118 | |
119 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ | 115 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ |
120 Type* const k##TypeName##Array = CreateArray(k##TypeName); | 116 Type* const k##TypeName##Array = CreateArray(k##TypeName); |
121 TYPED_ARRAYS(TYPED_ARRAY) | 117 TYPED_ARRAYS(TYPED_ARRAY) |
122 #undef TYPED_ARRAY | 118 #undef TYPED_ARRAY |
123 | 119 |
124 private: | 120 private: |
125 Type* CreateArray(Type* element) { return Type::Array(element, zone()); } | 121 Type* CreateArray(Type* element) { return Type::Array(element, zone()); } |
126 | 122 |
127 Type* CreateArrayFunction(Type* array) { | 123 Type* CreateArrayFunction(Type* array) { |
128 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone()); | 124 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone()); |
(...skipping 16 matching lines...) Expand all Loading... |
145 return Type::Range(min, max, zone()); | 141 return Type::Range(min, max, zone()); |
146 } | 142 } |
147 | 143 |
148 Zone* zone() { return &zone_; } | 144 Zone* zone() { return &zone_; } |
149 }; | 145 }; |
150 | 146 |
151 } // namespace internal | 147 } // namespace internal |
152 } // namespace v8 | 148 } // namespace v8 |
153 | 149 |
154 #endif // V8_TYPE_CACHE_H_ | 150 #endif // V8_TYPE_CACHE_H_ |
OLD | NEW |