OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 7819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7830 TRACK_ALLOCATION_SITE, | 7830 TRACK_ALLOCATION_SITE, |
7831 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7831 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
7832 }; | 7832 }; |
7833 | 7833 |
7834 | 7834 |
7835 class AllocationSite: public Struct { | 7835 class AllocationSite: public Struct { |
7836 public: | 7836 public: |
7837 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | 7837 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
7838 | 7838 |
7839 DECL_ACCESSORS(transition_info, Object) | 7839 DECL_ACCESSORS(transition_info, Object) |
| 7840 DECL_ACCESSORS(dependent_code, DependentCode) |
7840 DECL_ACCESSORS(weak_next, Object) | 7841 DECL_ACCESSORS(weak_next, Object) |
7841 | 7842 |
7842 void Initialize() { | 7843 inline void Initialize(); |
7843 SetElementsKind(GetInitialFastElementsKind()); | |
7844 } | |
7845 | 7844 |
7846 ElementsKind GetElementsKind() { | 7845 ElementsKind GetElementsKind() { |
7847 ASSERT(!IsLiteralSite()); | 7846 ASSERT(!IsLiteralSite()); |
7848 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7847 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
7849 } | 7848 } |
7850 | 7849 |
7851 void SetElementsKind(ElementsKind kind) { | 7850 void SetElementsKind(ElementsKind kind) { |
7852 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7851 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
7853 } | 7852 } |
7854 | 7853 |
7855 bool IsLiteralSite() { | 7854 bool IsLiteralSite() { |
7856 // If transition_info is a smi, then it represents an ElementsKind | 7855 // If transition_info is a smi, then it represents an ElementsKind |
7857 // for a constructed array. Otherwise, it must be a boilerplate | 7856 // for a constructed array. Otherwise, it must be a boilerplate |
7858 // for an array literal | 7857 // for an array literal |
7859 return transition_info()->IsJSArray(); | 7858 return transition_info()->IsJSArray(); |
7860 } | 7859 } |
7861 | 7860 |
7862 DECLARE_PRINTER(AllocationSite) | 7861 DECLARE_PRINTER(AllocationSite) |
7863 DECLARE_VERIFIER(AllocationSite) | 7862 DECLARE_VERIFIER(AllocationSite) |
7864 | 7863 |
7865 static inline AllocationSite* cast(Object* obj); | 7864 static inline AllocationSite* cast(Object* obj); |
7866 static inline AllocationSiteMode GetMode( | 7865 static inline AllocationSiteMode GetMode( |
7867 ElementsKind boilerplate_elements_kind); | 7866 ElementsKind boilerplate_elements_kind); |
7868 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7867 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
7869 static inline bool CanTrack(InstanceType type); | 7868 static inline bool CanTrack(InstanceType type); |
7870 | 7869 |
7871 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 7870 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
7872 static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize; | 7871 static const int kDependentCodeOffset = kTransitionInfoOffset + kPointerSize; |
| 7872 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
7873 static const int kSize = kWeakNextOffset + kPointerSize; | 7873 static const int kSize = kWeakNextOffset + kPointerSize; |
7874 | 7874 |
7875 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 7875 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
7876 kTransitionInfoOffset + kPointerSize, | 7876 kDependentCodeOffset + kPointerSize, |
7877 kSize> BodyDescriptor; | 7877 kSize> BodyDescriptor; |
7878 | 7878 |
7879 private: | 7879 private: |
7880 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 7880 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
7881 }; | 7881 }; |
7882 | 7882 |
7883 | 7883 |
7884 class AllocationMemento: public Struct { | 7884 class AllocationMemento: public Struct { |
7885 public: | 7885 public: |
7886 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 7886 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10242 } else { | 10242 } else { |
10243 value &= ~(1 << bit_position); | 10243 value &= ~(1 << bit_position); |
10244 } | 10244 } |
10245 return value; | 10245 return value; |
10246 } | 10246 } |
10247 }; | 10247 }; |
10248 | 10248 |
10249 } } // namespace v8::internal | 10249 } } // namespace v8::internal |
10250 | 10250 |
10251 #endif // V8_OBJECTS_H_ | 10251 #endif // V8_OBJECTS_H_ |
OLD | NEW |