| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 | 612 |
| 613 #define DECL_ACCESSORS(name, type) \ | 613 #define DECL_ACCESSORS(name, type) \ |
| 614 inline type* name(); \ | 614 inline type* name(); \ |
| 615 inline void set_##name(type* value, \ | 615 inline void set_##name(type* value, \ |
| 616 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ | 616 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ |
| 617 | 617 |
| 618 | 618 |
| 619 class StringStream; | 619 class StringStream; |
| 620 class ObjectVisitor; | 620 class ObjectVisitor; |
| 621 class Failure; |
| 621 | 622 |
| 622 struct ValueInfo : public Malloced { | 623 struct ValueInfo : public Malloced { |
| 623 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | 624 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
| 624 InstanceType type; | 625 InstanceType type; |
| 625 Object* ptr; | 626 Object* ptr; |
| 626 const char* str; | 627 const char* str; |
| 627 double number; | 628 double number; |
| 628 }; | 629 }; |
| 629 | 630 |
| 630 | 631 |
| 631 // A template-ized version of the IsXXX functions. | 632 // A template-ized version of the IsXXX functions. |
| 632 template <class C> static inline bool Is(Object* obj); | 633 template <class C> static inline bool Is(Object* obj); |
| 633 | 634 |
| 634 | |
| 635 class MaybeObject BASE_EMBEDDED { | 635 class MaybeObject BASE_EMBEDDED { |
| 636 public: | 636 public: |
| 637 inline bool IsFailure(); | 637 inline bool IsFailure(); |
| 638 inline bool IsRetryAfterGC(); | 638 inline bool IsRetryAfterGC(); |
| 639 inline bool IsOutOfMemory(); | 639 inline bool IsOutOfMemory(); |
| 640 inline bool IsException(); | 640 inline bool IsException(); |
| 641 INLINE(bool IsTheHole()); | 641 INLINE(bool IsTheHole()); |
| 642 inline bool ToObject(Object** obj) { | 642 inline bool ToObject(Object** obj) { |
| 643 if (IsFailure()) return false; | 643 if (IsFailure()) return false; |
| 644 *obj = reinterpret_cast<Object*>(this); | 644 *obj = reinterpret_cast<Object*>(this); |
| 645 return true; | 645 return true; |
| 646 } | 646 } |
| 647 inline Failure* ToFailureUnchecked() { |
| 648 ASSERT(IsFailure()); |
| 649 return reinterpret_cast<Failure*>(this); |
| 650 } |
| 647 inline Object* ToObjectUnchecked() { | 651 inline Object* ToObjectUnchecked() { |
| 648 ASSERT(!IsFailure()); | 652 ASSERT(!IsFailure()); |
| 649 return reinterpret_cast<Object*>(this); | 653 return reinterpret_cast<Object*>(this); |
| 650 } | 654 } |
| 651 inline Object* ToObjectChecked() { | 655 inline Object* ToObjectChecked() { |
| 652 CHECK(!IsFailure()); | 656 CHECK(!IsFailure()); |
| 653 return reinterpret_cast<Object*>(this); | 657 return reinterpret_cast<Object*>(this); |
| 654 } | 658 } |
| 655 | 659 |
| 656 template<typename T> | 660 template<typename T> |
| (...skipping 5994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6651 } else { | 6655 } else { |
| 6652 value &= ~(1 << bit_position); | 6656 value &= ~(1 << bit_position); |
| 6653 } | 6657 } |
| 6654 return value; | 6658 return value; |
| 6655 } | 6659 } |
| 6656 }; | 6660 }; |
| 6657 | 6661 |
| 6658 } } // namespace v8::internal | 6662 } } // namespace v8::internal |
| 6659 | 6663 |
| 6660 #endif // V8_OBJECTS_H_ | 6664 #endif // V8_OBJECTS_H_ |
| OLD | NEW |