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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 } | 642 } |
| 643 inline Object* ToObjectUnchecked() { | 643 inline Object* ToObjectUnchecked() { |
| 644 ASSERT(!IsFailure()); | 644 ASSERT(!IsFailure()); |
| 645 return reinterpret_cast<Object*>(this); | 645 return reinterpret_cast<Object*>(this); |
| 646 } | 646 } |
| 647 inline Object* ToObjectChecked() { | 647 inline Object* ToObjectChecked() { |
| 648 CHECK(!IsFailure()); | 648 CHECK(!IsFailure()); |
| 649 return reinterpret_cast<Object*>(this); | 649 return reinterpret_cast<Object*>(this); |
| 650 } | 650 } |
| 651 | 651 |
| 652 template<typename T> | |
| 653 inline bool To(T** obj) { | |
| 654 if (IsFailure()) return false; | |
| 655 *obj = T::cast(reinterpret_cast<Object*>(this)); | |
| 656 return true; | |
| 657 } | |
| 658 | |
| 652 #ifdef OBJECT_PRINT | 659 #ifdef OBJECT_PRINT |
| 653 // Prints this object with details. | 660 // Prints this object with details. |
| 654 inline void Print() { | 661 inline void Print() { |
| 655 Print(stdout); | 662 Print(stdout); |
| 656 }; | 663 }; |
| 657 inline void PrintLn() { | 664 inline void PrintLn() { |
| 658 PrintLn(stdout); | 665 PrintLn(stdout); |
| 659 } | 666 } |
| 660 void Print(FILE* out); | 667 void Print(FILE* out); |
| 661 void PrintLn(FILE* out); | 668 void PrintLn(FILE* out); |
| (...skipping 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3737 DECL_ACCESSORS(constructor, Object) | 3744 DECL_ACCESSORS(constructor, Object) |
| 3738 | 3745 |
| 3739 inline JSFunction* unchecked_constructor(); | 3746 inline JSFunction* unchecked_constructor(); |
| 3740 | 3747 |
| 3741 // [instance descriptors]: describes the object. | 3748 // [instance descriptors]: describes the object. |
| 3742 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 3749 DECL_ACCESSORS(instance_descriptors, DescriptorArray) |
| 3743 | 3750 |
| 3744 // [stub cache]: contains stubs compiled for this map. | 3751 // [stub cache]: contains stubs compiled for this map. |
| 3745 DECL_ACCESSORS(code_cache, Object) | 3752 DECL_ACCESSORS(code_cache, Object) |
| 3746 | 3753 |
| 3754 // [prototype transitions]: cache of prototype transitions. | |
| 3755 // Prototypre transition is a transition that happens | |
|
Mads Ager (chromium)
2011/04/26 09:14:23
Prototypre -> Prototype
| |
| 3756 // when we change object's prototype to a new one. | |
| 3757 // Cache format: | |
| 3758 // 0: finger - index of the first free cell in the cache | |
| 3759 // 1 + 2 * i: prototype | |
| 3760 // 2 + 2 * i: target map | |
| 3761 DECL_ACCESSORS(prototype_transitions, FixedArray) | |
| 3762 inline FixedArray* unchecked_prototype_transitions(); | |
| 3763 | |
| 3747 // Lookup in the map's instance descriptors and fill out the result | 3764 // Lookup in the map's instance descriptors and fill out the result |
| 3748 // with the given holder if the name is found. The holder may be | 3765 // with the given holder if the name is found. The holder may be |
| 3749 // NULL when this function is used from the compiler. | 3766 // NULL when this function is used from the compiler. |
| 3750 void LookupInDescriptors(JSObject* holder, | 3767 void LookupInDescriptors(JSObject* holder, |
| 3751 String* name, | 3768 String* name, |
| 3752 LookupResult* result); | 3769 LookupResult* result); |
| 3753 | 3770 |
| 3754 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 3771 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
| 3755 | 3772 |
| 3756 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 3773 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3836 inline void set_visitor_id(int visitor_id); | 3853 inline void set_visitor_id(int visitor_id); |
| 3837 | 3854 |
| 3838 // Returns the isolate/heap this map belongs to. | 3855 // Returns the isolate/heap this map belongs to. |
| 3839 inline Isolate* isolate(); | 3856 inline Isolate* isolate(); |
| 3840 inline Heap* heap(); | 3857 inline Heap* heap(); |
| 3841 | 3858 |
| 3842 typedef void (*TraverseCallback)(Map* map, void* data); | 3859 typedef void (*TraverseCallback)(Map* map, void* data); |
| 3843 | 3860 |
| 3844 void TraverseTransitionTree(TraverseCallback callback, void* data); | 3861 void TraverseTransitionTree(TraverseCallback callback, void* data); |
| 3845 | 3862 |
| 3863 Object* GetPrototypeTransition(Object* prototype); | |
| 3864 | |
| 3865 MaybeObject* PutPrototypeTransition(Object* prototype, Map* map); | |
| 3866 | |
| 3846 static const int kMaxPreAllocatedPropertyFields = 255; | 3867 static const int kMaxPreAllocatedPropertyFields = 255; |
| 3847 | 3868 |
| 3848 // Layout description. | 3869 // Layout description. |
| 3849 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 3870 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
| 3850 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 3871 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
| 3851 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 3872 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
| 3852 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 3873 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; |
| 3853 static const int kInstanceDescriptorsOffset = | 3874 static const int kInstanceDescriptorsOffset = |
| 3854 kConstructorOffset + kPointerSize; | 3875 kConstructorOffset + kPointerSize; |
| 3855 static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; | 3876 static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; |
| 3856 static const int kPadStart = kCodeCacheOffset + kPointerSize; | 3877 static const int kPrototypeTransitionsOffset = kCodeCacheOffset + kPointerSize ; |
|
Mads Ager (chromium)
2011/04/26 09:14:23
Line length.
| |
| 3878 static const int kPadStart = kPrototypeTransitionsOffset + kPointerSize; | |
| 3857 static const int kSize = MAP_POINTER_ALIGN(kPadStart); | 3879 static const int kSize = MAP_POINTER_ALIGN(kPadStart); |
| 3858 | 3880 |
| 3859 // Layout of pointer fields. Heap iteration code relies on them | 3881 // Layout of pointer fields. Heap iteration code relies on them |
| 3860 // being continiously allocated. | 3882 // being continiously allocated. |
| 3861 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 3883 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
| 3862 static const int kPointerFieldsEndOffset = | 3884 static const int kPointerFieldsEndOffset = |
| 3863 Map::kCodeCacheOffset + kPointerSize; | 3885 Map::kPrototypeTransitionsOffset + kPointerSize; |
| 3864 | 3886 |
| 3865 // Byte offsets within kInstanceSizesOffset. | 3887 // Byte offsets within kInstanceSizesOffset. |
| 3866 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 3888 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
| 3867 static const int kInObjectPropertiesByte = 1; | 3889 static const int kInObjectPropertiesByte = 1; |
| 3868 static const int kInObjectPropertiesOffset = | 3890 static const int kInObjectPropertiesOffset = |
| 3869 kInstanceSizesOffset + kInObjectPropertiesByte; | 3891 kInstanceSizesOffset + kInObjectPropertiesByte; |
| 3870 static const int kPreAllocatedPropertyFieldsByte = 2; | 3892 static const int kPreAllocatedPropertyFieldsByte = 2; |
| 3871 static const int kPreAllocatedPropertyFieldsOffset = | 3893 static const int kPreAllocatedPropertyFieldsOffset = |
| 3872 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; | 3894 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; |
| 3873 static const int kVisitorIdByte = 3; | 3895 static const int kVisitorIdByte = 3; |
| (...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6680 } else { | 6702 } else { |
| 6681 value &= ~(1 << bit_position); | 6703 value &= ~(1 << bit_position); |
| 6682 } | 6704 } |
| 6683 return value; | 6705 return value; |
| 6684 } | 6706 } |
| 6685 }; | 6707 }; |
| 6686 | 6708 |
| 6687 } } // namespace v8::internal | 6709 } } // namespace v8::internal |
| 6688 | 6710 |
| 6689 #endif // V8_OBJECTS_H_ | 6711 #endif // V8_OBJECTS_H_ |
| OLD | NEW |