Chromium Code Reviews| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 InstanceType type; | 624 InstanceType type; |
| 625 Object* ptr; | 625 Object* ptr; |
| 626 const char* str; | 626 const char* str; |
| 627 double number; | 627 double number; |
| 628 }; | 628 }; |
| 629 | 629 |
| 630 | 630 |
| 631 // A template-ized version of the IsXXX functions. | 631 // A template-ized version of the IsXXX functions. |
| 632 template <class C> static inline bool Is(Object* obj); | 632 template <class C> static inline bool Is(Object* obj); |
| 633 | 633 |
| 634 class Failure; | |
|
Erik Corry
2011/05/19 07:22:32
It would perhaps be neater to group this with the
Lasse Reichstein
2011/05/19 08:40:40
Done.
| |
| 634 | 635 |
| 635 class MaybeObject BASE_EMBEDDED { | 636 class MaybeObject BASE_EMBEDDED { |
| 636 public: | 637 public: |
| 637 inline bool IsFailure(); | 638 inline bool IsFailure(); |
| 638 inline bool IsRetryAfterGC(); | 639 inline bool IsRetryAfterGC(); |
| 639 inline bool IsOutOfMemory(); | 640 inline bool IsOutOfMemory(); |
| 640 inline bool IsException(); | 641 inline bool IsException(); |
| 641 INLINE(bool IsTheHole()); | 642 INLINE(bool IsTheHole()); |
| 642 inline bool ToObject(Object** obj) { | 643 inline bool ToObject(Object** obj) { |
| 643 if (IsFailure()) return false; | 644 if (IsFailure()) return false; |
| 644 *obj = reinterpret_cast<Object*>(this); | 645 *obj = reinterpret_cast<Object*>(this); |
| 645 return true; | 646 return true; |
| 646 } | 647 } |
| 648 inline Failure* ToFailureUnchecked() { | |
| 649 ASSERT(IsFailure()); | |
| 650 return reinterpret_cast<Failure*>(this); | |
| 651 } | |
| 647 inline Object* ToObjectUnchecked() { | 652 inline Object* ToObjectUnchecked() { |
| 648 ASSERT(!IsFailure()); | 653 ASSERT(!IsFailure()); |
| 649 return reinterpret_cast<Object*>(this); | 654 return reinterpret_cast<Object*>(this); |
| 650 } | 655 } |
| 651 inline Object* ToObjectChecked() { | 656 inline Object* ToObjectChecked() { |
| 652 CHECK(!IsFailure()); | 657 CHECK(!IsFailure()); |
| 653 return reinterpret_cast<Object*>(this); | 658 return reinterpret_cast<Object*>(this); |
| 654 } | 659 } |
| 655 | 660 |
| 656 template<typename T> | 661 template<typename T> |
| (...skipping 5994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6651 } else { | 6656 } else { |
| 6652 value &= ~(1 << bit_position); | 6657 value &= ~(1 << bit_position); |
| 6653 } | 6658 } |
| 6654 return value; | 6659 return value; |
| 6655 } | 6660 } |
| 6656 }; | 6661 }; |
| 6657 | 6662 |
| 6658 } } // namespace v8::internal | 6663 } } // namespace v8::internal |
| 6659 | 6664 |
| 6660 #endif // V8_OBJECTS_H_ | 6665 #endif // V8_OBJECTS_H_ |
| OLD | NEW |