| 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 7798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7809 TRACK_ALLOCATION_SITE, | 7809 TRACK_ALLOCATION_SITE, |
| 7810 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7810 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
| 7811 }; | 7811 }; |
| 7812 | 7812 |
| 7813 | 7813 |
| 7814 class AllocationSite: public Struct { | 7814 class AllocationSite: public Struct { |
| 7815 public: | 7815 public: |
| 7816 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | 7816 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
| 7817 | 7817 |
| 7818 DECL_ACCESSORS(transition_info, Object) | 7818 DECL_ACCESSORS(transition_info, Object) |
| 7819 DECL_ACCESSORS(dependent_code, DependentCode) |
| 7819 DECL_ACCESSORS(weak_next, Object) | 7820 DECL_ACCESSORS(weak_next, Object) |
| 7820 | 7821 |
| 7821 void Initialize() { | 7822 inline void Initialize(); |
| 7822 SetElementsKind(GetInitialFastElementsKind()); | |
| 7823 } | |
| 7824 | 7823 |
| 7825 ElementsKind GetElementsKind() { | 7824 ElementsKind GetElementsKind() { |
| 7826 ASSERT(!IsLiteralSite()); | 7825 ASSERT(!IsLiteralSite()); |
| 7827 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7826 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
| 7828 } | 7827 } |
| 7829 | 7828 |
| 7830 void SetElementsKind(ElementsKind kind) { | 7829 void SetElementsKind(ElementsKind kind) { |
| 7831 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7830 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
| 7832 } | 7831 } |
| 7833 | 7832 |
| 7834 bool IsLiteralSite() { | 7833 bool IsLiteralSite() { |
| 7835 // If transition_info is a smi, then it represents an ElementsKind | 7834 // If transition_info is a smi, then it represents an ElementsKind |
| 7836 // for a constructed array. Otherwise, it must be a boilerplate | 7835 // for a constructed array. Otherwise, it must be a boilerplate |
| 7837 // for an array literal | 7836 // for an array literal |
| 7838 return transition_info()->IsJSArray(); | 7837 return transition_info()->IsJSArray(); |
| 7839 } | 7838 } |
| 7840 | 7839 |
| 7841 DECLARE_PRINTER(AllocationSite) | 7840 DECLARE_PRINTER(AllocationSite) |
| 7842 DECLARE_VERIFIER(AllocationSite) | 7841 DECLARE_VERIFIER(AllocationSite) |
| 7843 | 7842 |
| 7844 static inline AllocationSite* cast(Object* obj); | 7843 static inline AllocationSite* cast(Object* obj); |
| 7845 static inline AllocationSiteMode GetMode( | 7844 static inline AllocationSiteMode GetMode( |
| 7846 ElementsKind boilerplate_elements_kind); | 7845 ElementsKind boilerplate_elements_kind); |
| 7847 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7846 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7848 | 7847 |
| 7849 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 7848 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
| 7850 static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize; | 7849 static const int kDependentCodeOffset = kTransitionInfoOffset + kPointerSize; |
| 7850 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
| 7851 static const int kSize = kWeakNextOffset + kPointerSize; | 7851 static const int kSize = kWeakNextOffset + kPointerSize; |
| 7852 | 7852 |
| 7853 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 7853 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
| 7854 kTransitionInfoOffset + kPointerSize, | 7854 kDependentCodeOffset + kPointerSize, |
| 7855 kSize> BodyDescriptor; | 7855 kSize> BodyDescriptor; |
| 7856 | 7856 |
| 7857 private: | 7857 private: |
| 7858 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 7858 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
| 7859 }; | 7859 }; |
| 7860 | 7860 |
| 7861 | 7861 |
| 7862 class AllocationMemento: public Struct { | 7862 class AllocationMemento: public Struct { |
| 7863 public: | 7863 public: |
| 7864 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 7864 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
| (...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10206 } else { | 10206 } else { |
| 10207 value &= ~(1 << bit_position); | 10207 value &= ~(1 << bit_position); |
| 10208 } | 10208 } |
| 10209 return value; | 10209 return value; |
| 10210 } | 10210 } |
| 10211 }; | 10211 }; |
| 10212 | 10212 |
| 10213 } } // namespace v8::internal | 10213 } } // namespace v8::internal |
| 10214 | 10214 |
| 10215 #endif // V8_OBJECTS_H_ | 10215 #endif // V8_OBJECTS_H_ |
| OLD | NEW |