| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 502 } |
| 503 | 503 |
| 504 | 504 |
| 505 Failure* Failure::cast(MaybeObject* obj) { | 505 Failure* Failure::cast(MaybeObject* obj) { |
| 506 ASSERT(HAS_FAILURE_TAG(obj)); | 506 ASSERT(HAS_FAILURE_TAG(obj)); |
| 507 return reinterpret_cast<Failure*>(obj); | 507 return reinterpret_cast<Failure*>(obj); |
| 508 } | 508 } |
| 509 | 509 |
| 510 | 510 |
| 511 bool Object::IsJSReceiver() { | 511 bool Object::IsJSReceiver() { |
| 512 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 512 return IsHeapObject() && | 513 return IsHeapObject() && |
| 513 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE; | 514 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE; |
| 514 } | 515 } |
| 515 | 516 |
| 516 | 517 |
| 517 bool Object::IsJSObject() { | 518 bool Object::IsJSObject() { |
| 518 return IsJSReceiver() && !IsJSProxy(); | 519 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); |
| 520 return IsHeapObject() && |
| 521 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE; |
| 519 } | 522 } |
| 520 | 523 |
| 521 | 524 |
| 522 bool Object::IsJSProxy() { | 525 bool Object::IsJSProxy() { |
| 523 return Object::IsHeapObject() && | 526 if (!Object::IsHeapObject()) return false; |
| 524 (HeapObject::cast(this)->map()->instance_type() == JS_PROXY_TYPE || | 527 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
| 525 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE); | 528 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE; |
| 526 } | 529 } |
| 527 | 530 |
| 528 | 531 |
| 529 bool Object::IsJSFunctionProxy() { | 532 bool Object::IsJSFunctionProxy() { |
| 530 return Object::IsHeapObject() && | 533 return Object::IsHeapObject() && |
| 531 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE; | 534 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE; |
| 532 } | 535 } |
| 533 | 536 |
| 534 | 537 |
| 535 bool Object::IsJSWeakMap() { | 538 bool Object::IsJSWeakMap() { |
| (...skipping 4146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4682 #undef WRITE_INT_FIELD | 4685 #undef WRITE_INT_FIELD |
| 4683 #undef READ_SHORT_FIELD | 4686 #undef READ_SHORT_FIELD |
| 4684 #undef WRITE_SHORT_FIELD | 4687 #undef WRITE_SHORT_FIELD |
| 4685 #undef READ_BYTE_FIELD | 4688 #undef READ_BYTE_FIELD |
| 4686 #undef WRITE_BYTE_FIELD | 4689 #undef WRITE_BYTE_FIELD |
| 4687 | 4690 |
| 4688 | 4691 |
| 4689 } } // namespace v8::internal | 4692 } } // namespace v8::internal |
| 4690 | 4693 |
| 4691 #endif // V8_OBJECTS_INL_H_ | 4694 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |