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