Chromium Code Reviews| Index: src/types-inl.h |
| diff --git a/src/types-inl.h b/src/types-inl.h |
| index f102ae3e137ad6c50ee4afc15c4309041b55fde7..66146199ab8ed20433151e5fb7da7dfcaad0ed68 100644 |
| --- a/src/types-inl.h |
| +++ b/src/types-inl.h |
| @@ -70,7 +70,7 @@ T* ZoneTypeConfig::cast(Type* type) { |
| // static |
| bool ZoneTypeConfig::is_bitset(Type* type) { |
| - return reinterpret_cast<intptr_t>(type) & 1; |
| + return reinterpret_cast<uintptr_t>(type) & 1; |
| } |
| @@ -87,9 +87,9 @@ bool ZoneTypeConfig::is_class(Type* type) { |
| // static |
| -int ZoneTypeConfig::as_bitset(Type* type) { |
| +ZoneTypeConfig::Type::bitset ZoneTypeConfig::as_bitset(Type* type) { |
| DCHECK(is_bitset(type)); |
| - return static_cast<int>(reinterpret_cast<intptr_t>(type) >> 1); |
| + return reinterpret_cast<Type::bitset>(type) >> 1; |
| } |
| @@ -108,13 +108,14 @@ i::Handle<i::Map> ZoneTypeConfig::as_class(Type* type) { |
| // static |
| -ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset(int bitset) { |
| +ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset(Type::bitset bitset) { |
| return reinterpret_cast<Type*>((bitset << 1) | 1); |
| } |
| // static |
| -ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset(int bitset, Zone* Zone) { |
| +ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset( |
| + Type::bitset bitset, Zone* Zone) { |
| return from_bitset(bitset); |
| } |
| @@ -229,8 +230,8 @@ bool HeapTypeConfig::is_struct(Type* type, int tag) { |
| // static |
| -int HeapTypeConfig::as_bitset(Type* type) { |
| - return i::Smi::cast(type)->value(); |
| +HeapTypeConfig::Type::bitset HeapTypeConfig::as_bitset(Type* type) { |
| + return static_cast<Type::bitset>(i::Smi::cast(type)->value()); |
| } |
| @@ -247,14 +248,15 @@ i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::as_struct(Type* type) { |
| // static |
| -HeapTypeConfig::Type* HeapTypeConfig::from_bitset(int bitset) { |
| - return Type::cast(i::Smi::FromInt(bitset)); |
| +HeapTypeConfig::Type* HeapTypeConfig::from_bitset(Type::bitset bitset) { |
| + // TODO(rossberg): This is implementation-defined. How can we avoid it? |
| + return Type::cast(i::Smi::FromInt(static_cast<int>(bitset))); |
|
Benedikt Meurer
2014/09/10 04:13:23
Use
Type::cast(i::Smi::FromIntptr(bit_cast<intptr
|
| } |
| // static |
| i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_bitset( |
| - int bitset, Isolate* isolate) { |
| + Type::bitset bitset, Isolate* isolate) { |
| return i::handle(from_bitset(bitset), isolate); |
| } |