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_TYPES_INL_H_ | 5 #ifndef V8_TYPES_INL_H_ |
6 #define V8_TYPES_INL_H_ | 6 #define V8_TYPES_INL_H_ |
7 | 7 |
8 #include "src/types.h" | 8 #include "src/types.h" |
9 | 9 |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
11 #include "src/handles-inl.h" | 11 #include "src/handles-inl.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // ----------------------------------------------------------------------------- | 16 // ----------------------------------------------------------------------------- |
17 // TypeImpl | 17 // TypeImpl |
18 | 18 |
19 template <class Config> | |
20 typename TypeImpl<Config>::bitset | |
21 TypeImpl<Config>::BitsetType::SignedSmall() { | |
22 return i::SmiValuesAre31Bits() ? kSigned31 : kSigned32; | |
23 } | |
24 | |
25 | |
26 template <class Config> | |
27 typename TypeImpl<Config>::bitset | |
28 TypeImpl<Config>::BitsetType::UnsignedSmall() { | |
29 return i::SmiValuesAre31Bits() ? kUnsigned30 : kUnsigned31; | |
30 } | |
31 | |
32 | |
33 template<class Config> | 19 template<class Config> |
34 TypeImpl<Config>* TypeImpl<Config>::cast(typename Config::Base* object) { | 20 TypeImpl<Config>* TypeImpl<Config>::cast(typename Config::Base* object) { |
35 TypeImpl* t = static_cast<TypeImpl*>(object); | 21 TypeImpl* t = static_cast<TypeImpl*>(object); |
36 DCHECK(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsRange() || | 22 DCHECK(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsRange() || |
37 t->IsUnion() || t->IsArray() || t->IsFunction() || t->IsContext()); | 23 t->IsUnion() || t->IsArray() || t->IsFunction() || t->IsContext()); |
38 return t; | 24 return t; |
39 } | 25 } |
40 | 26 |
41 | 27 |
42 // Most precise _current_ type of a value (usually its class). | 28 // Most precise _current_ type of a value (usually its class). |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 194 |
209 // static | 195 // static |
210 template<class V> | 196 template<class V> |
211 void ZoneTypeConfig::struct_set_value( | 197 void ZoneTypeConfig::struct_set_value( |
212 Struct* structure, int i, i::Handle<V> x) { | 198 Struct* structure, int i, i::Handle<V> x) { |
213 DCHECK(0 <= i && i <= struct_length(structure)); | 199 DCHECK(0 <= i && i <= struct_length(structure)); |
214 structure[2 + i] = x.location(); | 200 structure[2 + i] = x.location(); |
215 } | 201 } |
216 | 202 |
217 | 203 |
218 // static | |
219 i::Isolate* ZoneTypeConfig::isolate(Zone* zone) { return zone->isolate(); } | |
220 | |
221 // ----------------------------------------------------------------------------- | 204 // ----------------------------------------------------------------------------- |
222 // HeapTypeConfig | 205 // HeapTypeConfig |
223 | 206 |
224 // static | 207 // static |
225 template<class T> | 208 template<class T> |
226 i::Handle<T> HeapTypeConfig::null_handle() { | 209 i::Handle<T> HeapTypeConfig::null_handle() { |
227 return i::Handle<T>(); | 210 return i::Handle<T>(); |
228 } | 211 } |
229 | 212 |
230 | 213 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 341 } |
359 | 342 |
360 | 343 |
361 // static | 344 // static |
362 template<class V> | 345 template<class V> |
363 void HeapTypeConfig::struct_set_value( | 346 void HeapTypeConfig::struct_set_value( |
364 i::Handle<Struct> structure, int i, i::Handle<V> x) { | 347 i::Handle<Struct> structure, int i, i::Handle<V> x) { |
365 structure->set(i + 1, *x); | 348 structure->set(i + 1, *x); |
366 } | 349 } |
367 | 350 |
368 // static | |
369 i::Isolate* HeapTypeConfig::isolate(Isolate* isolate) { return isolate; } | |
370 } } // namespace v8::internal | 351 } } // namespace v8::internal |
371 | 352 |
372 #endif // V8_TYPES_INL_H_ | 353 #endif // V8_TYPES_INL_H_ |
OLD | NEW |