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> | 19 template<class Config> |
20 typename TypeImpl<Config>::bitset TypeImpl<Config>::BitsetType::SignedSmall() { | 20 typename TypeImpl<Config>::bitset TypeImpl<Config>::BitsetType::SignedSmall() { |
21 return i::SmiValuesAre31Bits() ? kSigned31 : kSigned32; | 21 return i::SmiValuesAre31Bits() ? kSigned31 : kSigned32; |
22 } | 22 } |
23 | 23 |
24 | 24 |
25 template <class Config> | 25 template<class Config> |
26 typename TypeImpl<Config>::bitset | 26 typename TypeImpl<Config>::bitset |
27 TypeImpl<Config>::BitsetType::UnsignedSmall() { | 27 TypeImpl<Config>::BitsetType::UnsignedSmall() { |
28 return i::SmiValuesAre31Bits() ? kUnsigned30 : kUnsigned31; | 28 return i::SmiValuesAre31Bits() ? kUnsigned30 : kUnsigned31; |
29 } | 29 } |
30 | 30 |
31 | 31 |
| 32 #define CONSTRUCT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) \ |
| 33 template<class Config> \ |
| 34 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Name( \ |
| 35 Isolate* isolate, Region* region) { \ |
| 36 return Class(i::handle(isolate->heap()->name##_map()), region); \ |
| 37 } |
| 38 SIMD128_TYPES(CONSTRUCT_SIMD_TYPE) |
| 39 #undef CONSTRUCT_SIMD_TYPE |
| 40 |
| 41 |
32 template<class Config> | 42 template<class Config> |
33 TypeImpl<Config>* TypeImpl<Config>::cast(typename Config::Base* object) { | 43 TypeImpl<Config>* TypeImpl<Config>::cast(typename Config::Base* object) { |
34 TypeImpl* t = static_cast<TypeImpl*>(object); | 44 TypeImpl* t = static_cast<TypeImpl*>(object); |
35 DCHECK(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsRange() || | 45 DCHECK(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsRange() || |
36 t->IsUnion() || t->IsArray() || t->IsFunction() || t->IsContext()); | 46 t->IsUnion() || t->IsArray() || t->IsFunction() || t->IsContext()); |
37 return t; | 47 return t; |
38 } | 48 } |
39 | 49 |
40 | 50 |
41 // Most precise _current_ type of a value (usually its class). | 51 // Most precise _current_ type of a value (usually its class). |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 void HeapTypeConfig::range_set_double(i::Handle<HeapTypeConfig::Range> range, | 477 void HeapTypeConfig::range_set_double(i::Handle<HeapTypeConfig::Range> range, |
468 int index, double value, | 478 int index, double value, |
469 Isolate* isolate) { | 479 Isolate* isolate) { |
470 DCHECK(index >= 0 && index < 2); | 480 DCHECK(index >= 0 && index < 2); |
471 i::Handle<Object> number = isolate->factory()->NewNumber(value); | 481 i::Handle<Object> number = isolate->factory()->NewNumber(value); |
472 range->set(index + 2, *number); | 482 range->set(index + 2, *number); |
473 } | 483 } |
474 } } // namespace v8::internal | 484 } } // namespace v8::internal |
475 | 485 |
476 #endif // V8_TYPES_INL_H_ | 486 #endif // V8_TYPES_INL_H_ |
OLD | NEW |