OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 5678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5689 | 5689 |
5690 // Code aging -- platform-specific | 5690 // Code aging -- platform-specific |
5691 static void PatchPlatformCodeAge(Isolate* isolate, | 5691 static void PatchPlatformCodeAge(Isolate* isolate, |
5692 byte* sequence, Age age, | 5692 byte* sequence, Age age, |
5693 MarkingParity parity); | 5693 MarkingParity parity); |
5694 | 5694 |
5695 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 5695 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
5696 }; | 5696 }; |
5697 | 5697 |
5698 | 5698 |
5699 class CompilationInfo; | |
5700 | |
5701 // This class describes the layout of dependent codes array of a map. The | 5699 // This class describes the layout of dependent codes array of a map. The |
5702 // array is partitioned into several groups of dependent codes. Each group | 5700 // array is partitioned into several groups of dependent codes. Each group |
5703 // contains codes with the same dependency on the map. The array has the | 5701 // contains codes with the same dependency on the map. The array has the |
5704 // following layout for n dependency groups: | 5702 // following layout for n dependency groups: |
5705 // | 5703 // |
5706 // +----+----+-----+----+---------+----------+-----+---------+-----------+ | 5704 // +----+----+-----+----+---------+----------+-----+---------+-----------+ |
5707 // | C1 | C2 | ... | Cn | group 1 | group 2 | ... | group n | undefined | | 5705 // | C1 | C2 | ... | Cn | group 1 | group 2 | ... | group n | undefined | |
5708 // +----+----+-----+----+---------+----------+-----+---------+-----------+ | 5706 // +----+----+-----+----+---------+----------+-----+---------+-----------+ |
5709 // | 5707 // |
5710 // The first n elements are Smis, each of them specifies the number of codes | 5708 // The first n elements are Smis, each of them specifies the number of codes |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5760 explicit GroupStartIndexes(DependentCode* entries); | 5758 explicit GroupStartIndexes(DependentCode* entries); |
5761 void Recompute(DependentCode* entries); | 5759 void Recompute(DependentCode* entries); |
5762 int at(int i) { return start_indexes_[i]; } | 5760 int at(int i) { return start_indexes_[i]; } |
5763 int number_of_entries() { return start_indexes_[kGroupCount]; } | 5761 int number_of_entries() { return start_indexes_[kGroupCount]; } |
5764 private: | 5762 private: |
5765 int start_indexes_[kGroupCount + 1]; | 5763 int start_indexes_[kGroupCount + 1]; |
5766 }; | 5764 }; |
5767 | 5765 |
5768 bool Contains(DependencyGroup group, WeakCell* code_cell); | 5766 bool Contains(DependencyGroup group, WeakCell* code_cell); |
5769 | 5767 |
5770 static Handle<DependentCode> InsertCompilationInfo( | 5768 static Handle<DependentCode> InsertCompilationDependencies( |
5771 Handle<DependentCode> entries, DependencyGroup group, | 5769 Handle<DependentCode> entries, DependencyGroup group, |
5772 Handle<Foreign> info); | 5770 Handle<Foreign> info); |
5773 | 5771 |
5774 static Handle<DependentCode> InsertWeakCode(Handle<DependentCode> entries, | 5772 static Handle<DependentCode> InsertWeakCode(Handle<DependentCode> entries, |
5775 DependencyGroup group, | 5773 DependencyGroup group, |
5776 Handle<WeakCell> code_cell); | 5774 Handle<WeakCell> code_cell); |
5777 | 5775 |
5778 void UpdateToFinishedCode(DependencyGroup group, Foreign* info, | 5776 void UpdateToFinishedCode(DependencyGroup group, Foreign* info, |
5779 WeakCell* code_cell); | 5777 WeakCell* code_cell); |
5780 | 5778 |
5781 void RemoveCompilationInfo(DependentCode::DependencyGroup group, | 5779 void RemoveCompilationDependencies(DependentCode::DependencyGroup group, |
5782 Foreign* info); | 5780 Foreign* info); |
5783 | 5781 |
5784 void DeoptimizeDependentCodeGroup(Isolate* isolate, | 5782 void DeoptimizeDependentCodeGroup(Isolate* isolate, |
5785 DependentCode::DependencyGroup group); | 5783 DependentCode::DependencyGroup group); |
5786 | 5784 |
5787 bool MarkCodeForDeoptimization(Isolate* isolate, | 5785 bool MarkCodeForDeoptimization(Isolate* isolate, |
5788 DependentCode::DependencyGroup group); | 5786 DependentCode::DependencyGroup group); |
5789 | 5787 |
5790 // The following low-level accessors should only be used by this class | 5788 // The following low-level accessors should only be used by this class |
5791 // and the mark compact collector. | 5789 // and the mark compact collector. |
5792 inline int number_of_entries(DependencyGroup group); | 5790 inline int number_of_entries(DependencyGroup group); |
5793 inline void set_number_of_entries(DependencyGroup group, int value); | 5791 inline void set_number_of_entries(DependencyGroup group, int value); |
5794 inline Object* object_at(int i); | 5792 inline Object* object_at(int i); |
5795 inline void set_object_at(int i, Object* object); | 5793 inline void set_object_at(int i, Object* object); |
5796 inline void clear_at(int i); | 5794 inline void clear_at(int i); |
5797 inline void copy(int from, int to); | 5795 inline void copy(int from, int to); |
5798 DECLARE_CAST(DependentCode) | 5796 DECLARE_CAST(DependentCode) |
5799 | 5797 |
5800 static DependentCode* ForObject(Handle<HeapObject> object, | |
5801 DependencyGroup group); | |
5802 | |
5803 static const char* DependencyGroupName(DependencyGroup group); | 5798 static const char* DependencyGroupName(DependencyGroup group); |
5804 static void SetMarkedForDeoptimization(Code* code, DependencyGroup group); | 5799 static void SetMarkedForDeoptimization(Code* code, DependencyGroup group); |
5805 | 5800 |
5806 private: | 5801 private: |
5807 static Handle<DependentCode> Insert(Handle<DependentCode> entries, | 5802 static Handle<DependentCode> Insert(Handle<DependentCode> entries, |
5808 DependencyGroup group, | 5803 DependencyGroup group, |
5809 Handle<Object> object); | 5804 Handle<Object> object); |
5810 static Handle<DependentCode> EnsureSpace(Handle<DependentCode> entries); | 5805 static Handle<DependentCode> EnsureSpace(Handle<DependentCode> entries); |
5811 // Make a room at the end of the given group by moving out the first | 5806 // Make a room at the end of the given group by moving out the first |
5812 // code objects of the subsequent groups. | 5807 // code objects of the subsequent groups. |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6350 bool IsJSGlobalObjectMap() { | 6345 bool IsJSGlobalObjectMap() { |
6351 return instance_type() == JS_GLOBAL_OBJECT_TYPE; | 6346 return instance_type() == JS_GLOBAL_OBJECT_TYPE; |
6352 } | 6347 } |
6353 bool IsGlobalObjectMap() { | 6348 bool IsGlobalObjectMap() { |
6354 const InstanceType type = instance_type(); | 6349 const InstanceType type = instance_type(); |
6355 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; | 6350 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; |
6356 } | 6351 } |
6357 | 6352 |
6358 inline bool CanOmitMapChecks(); | 6353 inline bool CanOmitMapChecks(); |
6359 | 6354 |
6360 static void AddDependentCompilationInfo(Handle<Map> map, | |
6361 DependentCode::DependencyGroup group, | |
6362 CompilationInfo* info); | |
6363 | |
6364 static void AddDependentCode(Handle<Map> map, | 6355 static void AddDependentCode(Handle<Map> map, |
6365 DependentCode::DependencyGroup group, | 6356 DependentCode::DependencyGroup group, |
6366 Handle<Code> code); | 6357 Handle<Code> code); |
6367 | 6358 |
6368 bool IsMapInArrayPrototypeChain(); | 6359 bool IsMapInArrayPrototypeChain(); |
6369 | 6360 |
6370 static Handle<WeakCell> WeakCellForMap(Handle<Map> map); | 6361 static Handle<WeakCell> WeakCellForMap(Handle<Map> map); |
6371 | 6362 |
6372 // Dispatched behavior. | 6363 // Dispatched behavior. |
6373 DECLARE_PRINTER(Map) | 6364 DECLARE_PRINTER(Map) |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8556 bool SitePointsToLiteral() { | 8547 bool SitePointsToLiteral() { |
8557 // If transition_info is a smi, then it represents an ElementsKind | 8548 // If transition_info is a smi, then it represents an ElementsKind |
8558 // for a constructed array. Otherwise, it must be a boilerplate | 8549 // for a constructed array. Otherwise, it must be a boilerplate |
8559 // for an object or array literal. | 8550 // for an object or array literal. |
8560 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8551 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
8561 } | 8552 } |
8562 | 8553 |
8563 static void DigestTransitionFeedback(Handle<AllocationSite> site, | 8554 static void DigestTransitionFeedback(Handle<AllocationSite> site, |
8564 ElementsKind to_kind); | 8555 ElementsKind to_kind); |
8565 | 8556 |
8566 static void RegisterForDeoptOnTenureChange(Handle<AllocationSite> site, | |
8567 CompilationInfo* info); | |
8568 | |
8569 static void RegisterForDeoptOnTransitionChange(Handle<AllocationSite> site, | |
8570 CompilationInfo* info); | |
8571 | |
8572 DECLARE_PRINTER(AllocationSite) | 8557 DECLARE_PRINTER(AllocationSite) |
8573 DECLARE_VERIFIER(AllocationSite) | 8558 DECLARE_VERIFIER(AllocationSite) |
8574 | 8559 |
8575 DECLARE_CAST(AllocationSite) | 8560 DECLARE_CAST(AllocationSite) |
8576 static inline AllocationSiteMode GetMode( | 8561 static inline AllocationSiteMode GetMode( |
8577 ElementsKind boilerplate_elements_kind); | 8562 ElementsKind boilerplate_elements_kind); |
8578 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8563 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
8579 static inline bool CanTrack(InstanceType type); | 8564 static inline bool CanTrack(InstanceType type); |
8580 | 8565 |
8581 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 8566 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
(...skipping 10 matching lines...) Expand all Loading... |
8592 // field. | 8577 // field. |
8593 static const int kPointerFieldsBeginOffset = kTransitionInfoOffset; | 8578 static const int kPointerFieldsBeginOffset = kTransitionInfoOffset; |
8594 static const int kPointerFieldsEndOffset = kWeakNextOffset; | 8579 static const int kPointerFieldsEndOffset = kWeakNextOffset; |
8595 | 8580 |
8596 // For other visitors, use the fixed body descriptor below. | 8581 // For other visitors, use the fixed body descriptor below. |
8597 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 8582 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
8598 kDependentCodeOffset + kPointerSize, | 8583 kDependentCodeOffset + kPointerSize, |
8599 kSize> BodyDescriptor; | 8584 kSize> BodyDescriptor; |
8600 | 8585 |
8601 private: | 8586 private: |
8602 static void AddDependentCompilationInfo(Handle<AllocationSite> site, | |
8603 DependentCode::DependencyGroup group, | |
8604 CompilationInfo* info); | |
8605 | |
8606 bool PretenuringDecisionMade() { | 8587 bool PretenuringDecisionMade() { |
8607 return pretenure_decision() != kUndecided; | 8588 return pretenure_decision() != kUndecided; |
8608 } | 8589 } |
8609 | 8590 |
8610 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 8591 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
8611 }; | 8592 }; |
8612 | 8593 |
8613 | 8594 |
8614 class AllocationMemento: public Struct { | 8595 class AllocationMemento: public Struct { |
8615 public: | 8596 public: |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9828 static PropertyCellType UpdatedType(Handle<PropertyCell> cell, | 9809 static PropertyCellType UpdatedType(Handle<PropertyCell> cell, |
9829 Handle<Object> value, | 9810 Handle<Object> value, |
9830 PropertyDetails details); | 9811 PropertyDetails details); |
9831 static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry, | 9812 static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry, |
9832 Handle<Object> value, | 9813 Handle<Object> value, |
9833 PropertyDetails details); | 9814 PropertyDetails details); |
9834 | 9815 |
9835 static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary, | 9816 static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary, |
9836 int entry); | 9817 int entry); |
9837 | 9818 |
9838 static void AddDependentCompilationInfo(Handle<PropertyCell> cell, | |
9839 CompilationInfo* info); | |
9840 | |
9841 DECLARE_CAST(PropertyCell) | 9819 DECLARE_CAST(PropertyCell) |
9842 | 9820 |
9843 // Dispatched behavior. | 9821 // Dispatched behavior. |
9844 DECLARE_PRINTER(PropertyCell) | 9822 DECLARE_PRINTER(PropertyCell) |
9845 DECLARE_VERIFIER(PropertyCell) | 9823 DECLARE_VERIFIER(PropertyCell) |
9846 | 9824 |
9847 // Layout description. | 9825 // Layout description. |
9848 static const int kValueOffset = HeapObject::kHeaderSize; | 9826 static const int kValueOffset = HeapObject::kHeaderSize; |
9849 static const int kDependentCodeOffset = kValueOffset + kPointerSize; | 9827 static const int kDependentCodeOffset = kValueOffset + kPointerSize; |
9850 static const int kSize = kDependentCodeOffset + kPointerSize; | 9828 static const int kSize = kDependentCodeOffset + kPointerSize; |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11091 } else { | 11069 } else { |
11092 value &= ~(1 << bit_position); | 11070 value &= ~(1 << bit_position); |
11093 } | 11071 } |
11094 return value; | 11072 return value; |
11095 } | 11073 } |
11096 }; | 11074 }; |
11097 | 11075 |
11098 } } // namespace v8::internal | 11076 } } // namespace v8::internal |
11099 | 11077 |
11100 #endif // V8_OBJECTS_H_ | 11078 #endif // V8_OBJECTS_H_ |
OLD | NEW |