Index: src/objects-inl.h |
=================================================================== |
--- src/objects-inl.h (revision 3561) |
+++ src/objects-inl.h (working copy) |
@@ -150,8 +150,12 @@ |
bool Object::IsSymbol() { |
if (!this->IsHeapObject()) return false; |
uint32_t type = HeapObject::cast(this)->map()->instance_type(); |
- return (type & (kIsNotStringMask | kIsSymbolMask)) == |
- (kStringTag | kSymbolTag); |
+ // Because the symbol tag is non-zero and no non-string types have the |
+ // symbol bit set we can test for symbols with a very simple test |
+ // operation. |
+ ASSERT(kSymbolTag != 0); |
+ ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); |
+ return (type & kIsSymbolMask != 0); |
} |
@@ -226,7 +230,8 @@ |
bool StringShape::IsSymbol() { |
ASSERT(valid()); |
- return (type_ & kIsSymbolMask) == kSymbolTag; |
+ ASSERT(kSymbolTag != 0); |
+ return (type_ & kIsSymbolMask) != 0; |
} |