OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; | 158 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 bool Object::IsSpecObject() { | 162 bool Object::IsSpecObject() { |
163 return Object::IsHeapObject() | 163 return Object::IsHeapObject() |
164 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; | 164 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; |
165 } | 165 } |
166 | 166 |
167 | 167 |
| 168 bool Object::IsSpecFunction() { |
| 169 if (!Object::IsHeapObject()) return false; |
| 170 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
| 171 return type == JS_FUNCTION_TYPE || type == JS_FUNCTION_PROXY_TYPE; |
| 172 } |
| 173 |
| 174 |
168 bool Object::IsSymbol() { | 175 bool Object::IsSymbol() { |
169 if (!this->IsHeapObject()) return false; | 176 if (!this->IsHeapObject()) return false; |
170 uint32_t type = HeapObject::cast(this)->map()->instance_type(); | 177 uint32_t type = HeapObject::cast(this)->map()->instance_type(); |
171 // Because the symbol tag is non-zero and no non-string types have the | 178 // Because the symbol tag is non-zero and no non-string types have the |
172 // symbol bit set we can test for symbols with a very simple test | 179 // symbol bit set we can test for symbols with a very simple test |
173 // operation. | 180 // operation. |
174 STATIC_ASSERT(kSymbolTag != 0); | 181 STATIC_ASSERT(kSymbolTag != 0); |
175 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); | 182 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); |
176 return (type & kIsSymbolMask) != 0; | 183 return (type & kIsSymbolMask) != 0; |
177 } | 184 } |
(...skipping 4504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 #undef WRITE_INT_FIELD | 4689 #undef WRITE_INT_FIELD |
4683 #undef READ_SHORT_FIELD | 4690 #undef READ_SHORT_FIELD |
4684 #undef WRITE_SHORT_FIELD | 4691 #undef WRITE_SHORT_FIELD |
4685 #undef READ_BYTE_FIELD | 4692 #undef READ_BYTE_FIELD |
4686 #undef WRITE_BYTE_FIELD | 4693 #undef WRITE_BYTE_FIELD |
4687 | 4694 |
4688 | 4695 |
4689 } } // namespace v8::internal | 4696 } } // namespace v8::internal |
4690 | 4697 |
4691 #endif // V8_OBJECTS_INL_H_ | 4698 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |