| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 InstanceType type; | 621 InstanceType type; |
| 622 Object* ptr; | 622 Object* ptr; |
| 623 const char* str; | 623 const char* str; |
| 624 double number; | 624 double number; |
| 625 }; | 625 }; |
| 626 | 626 |
| 627 | 627 |
| 628 // A template-ized version of the IsXXX functions. | 628 // A template-ized version of the IsXXX functions. |
| 629 template <class C> static inline bool Is(Object* obj); | 629 template <class C> static inline bool Is(Object* obj); |
| 630 | 630 |
| 631 class Failure; |
| 631 | 632 |
| 632 class MaybeObject BASE_EMBEDDED { | 633 class MaybeObject BASE_EMBEDDED { |
| 633 public: | 634 public: |
| 634 inline bool IsFailure(); | 635 inline bool IsFailure(); |
| 635 inline bool IsRetryAfterGC(); | 636 inline bool IsRetryAfterGC(); |
| 636 inline bool IsOutOfMemory(); | 637 inline bool IsOutOfMemory(); |
| 637 inline bool IsException(); | 638 inline bool IsException(); |
| 638 INLINE(bool IsTheHole()); | 639 INLINE(bool IsTheHole()); |
| 639 inline bool ToObject(Object** obj) { | 640 inline bool ToObject(Object** obj) { |
| 640 if (IsFailure()) return false; | 641 if (IsFailure()) return false; |
| 641 *obj = reinterpret_cast<Object*>(this); | 642 *obj = reinterpret_cast<Object*>(this); |
| 642 return true; | 643 return true; |
| 643 } | 644 } |
| 645 inline Failure* ToFailureUnchecked() { |
| 646 ASSERT(IsFailure()); |
| 647 return reinterpret_cast<Failure*>(this); |
| 648 } |
| 644 inline Object* ToObjectUnchecked() { | 649 inline Object* ToObjectUnchecked() { |
| 645 ASSERT(!IsFailure()); | 650 ASSERT(!IsFailure()); |
| 646 return reinterpret_cast<Object*>(this); | 651 return reinterpret_cast<Object*>(this); |
| 647 } | 652 } |
| 648 inline Object* ToObjectChecked() { | 653 inline Object* ToObjectChecked() { |
| 649 CHECK(!IsFailure()); | 654 CHECK(!IsFailure()); |
| 650 return reinterpret_cast<Object*>(this); | 655 return reinterpret_cast<Object*>(this); |
| 651 } | 656 } |
| 652 | 657 |
| 653 template<typename T> | 658 template<typename T> |
| (...skipping 6124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6778 } else { | 6783 } else { |
| 6779 value &= ~(1 << bit_position); | 6784 value &= ~(1 << bit_position); |
| 6780 } | 6785 } |
| 6781 return value; | 6786 return value; |
| 6782 } | 6787 } |
| 6783 }; | 6788 }; |
| 6784 | 6789 |
| 6785 } } // namespace v8::internal | 6790 } } // namespace v8::internal |
| 6786 | 6791 |
| 6787 #endif // V8_OBJECTS_H_ | 6792 #endif // V8_OBJECTS_H_ |
| OLD | NEW |