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