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 5676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5687 | 5687 |
5688 // Code aging -- platform-specific | 5688 // Code aging -- platform-specific |
5689 static void PatchPlatformCodeAge(Isolate* isolate, | 5689 static void PatchPlatformCodeAge(Isolate* isolate, |
5690 byte* sequence, Age age, | 5690 byte* sequence, Age age, |
5691 MarkingParity parity); | 5691 MarkingParity parity); |
5692 | 5692 |
5693 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 5693 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
5694 }; | 5694 }; |
5695 | 5695 |
5696 | 5696 |
5697 class CompilationInfo; | |
5698 | |
5699 // This class describes the layout of dependent codes array of a map. The | 5697 // 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 | 5698 // 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 | 5699 // contains codes with the same dependency on the map. The array has the |
5702 // following layout for n dependency groups: | 5700 // following layout for n dependency groups: |
5703 // | 5701 // |
5704 // +----+----+-----+----+---------+----------+-----+---------+-----------+ | 5702 // +----+----+-----+----+---------+----------+-----+---------+-----------+ |
5705 // | C1 | C2 | ... | Cn | group 1 | group 2 | ... | group n | undefined | | 5703 // | C1 | C2 | ... | Cn | group 1 | group 2 | ... | group n | undefined | |
5706 // +----+----+-----+----+---------+----------+-----+---------+-----------+ | 5704 // +----+----+-----+----+---------+----------+-----+---------+-----------+ |
5707 // | 5705 // |
5708 // The first n elements are Smis, each of them specifies the number of codes | 5706 // 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); | 5756 explicit GroupStartIndexes(DependentCode* entries); |
5759 void Recompute(DependentCode* entries); | 5757 void Recompute(DependentCode* entries); |
5760 int at(int i) { return start_indexes_[i]; } | 5758 int at(int i) { return start_indexes_[i]; } |
5761 int number_of_entries() { return start_indexes_[kGroupCount]; } | 5759 int number_of_entries() { return start_indexes_[kGroupCount]; } |
5762 private: | 5760 private: |
5763 int start_indexes_[kGroupCount + 1]; | 5761 int start_indexes_[kGroupCount + 1]; |
5764 }; | 5762 }; |
5765 | 5763 |
5766 bool Contains(DependencyGroup group, WeakCell* code_cell); | 5764 bool Contains(DependencyGroup group, WeakCell* code_cell); |
5767 | 5765 |
5768 static Handle<DependentCode> InsertCompilationInfo( | 5766 static Handle<DependentCode> InsertCompilationDependencies( |
5769 Handle<DependentCode> entries, DependencyGroup group, | 5767 Handle<DependentCode> entries, DependencyGroup group, |
5770 Handle<Foreign> info); | 5768 Handle<Foreign> info); |
5771 | 5769 |
5772 static Handle<DependentCode> InsertWeakCode(Handle<DependentCode> entries, | 5770 static Handle<DependentCode> InsertWeakCode(Handle<DependentCode> entries, |
5773 DependencyGroup group, | 5771 DependencyGroup group, |
5774 Handle<WeakCell> code_cell); | 5772 Handle<WeakCell> code_cell); |
5775 | 5773 |
5776 void UpdateToFinishedCode(DependencyGroup group, Foreign* info, | 5774 void UpdateToFinishedCode(DependencyGroup group, Foreign* info, |
5777 WeakCell* code_cell); | 5775 WeakCell* code_cell); |
5778 | 5776 |
5779 void RemoveCompilationInfo(DependentCode::DependencyGroup group, | 5777 void RemoveCompilationDependencies(DependentCode::DependencyGroup group, |
5780 Foreign* info); | 5778 Foreign* info); |
5781 | 5779 |
5782 void DeoptimizeDependentCodeGroup(Isolate* isolate, | 5780 void DeoptimizeDependentCodeGroup(Isolate* isolate, |
5783 DependentCode::DependencyGroup group); | 5781 DependentCode::DependencyGroup group); |
5784 | 5782 |
5785 bool MarkCodeForDeoptimization(Isolate* isolate, | 5783 bool MarkCodeForDeoptimization(Isolate* isolate, |
5786 DependentCode::DependencyGroup group); | 5784 DependentCode::DependencyGroup group); |
5787 | 5785 |
5788 // The following low-level accessors should only be used by this class | 5786 // The following low-level accessors should only be used by this class |
5789 // and the mark compact collector. | 5787 // and the mark compact collector. |
5790 inline int number_of_entries(DependencyGroup group); | 5788 inline int number_of_entries(DependencyGroup group); |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6339 bool IsJSGlobalObjectMap() { | 6337 bool IsJSGlobalObjectMap() { |
6340 return instance_type() == JS_GLOBAL_OBJECT_TYPE; | 6338 return instance_type() == JS_GLOBAL_OBJECT_TYPE; |
6341 } | 6339 } |
6342 bool IsGlobalObjectMap() { | 6340 bool IsGlobalObjectMap() { |
6343 const InstanceType type = instance_type(); | 6341 const InstanceType type = instance_type(); |
6344 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; | 6342 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; |
6345 } | 6343 } |
6346 | 6344 |
6347 inline bool CanOmitMapChecks(); | 6345 inline bool CanOmitMapChecks(); |
6348 | 6346 |
6349 static void AddDependentCompilationInfo(Handle<Map> map, | |
6350 DependentCode::DependencyGroup group, | |
6351 CompilationInfo* info); | |
6352 | |
6353 static void AddDependentCode(Handle<Map> map, | 6347 static void AddDependentCode(Handle<Map> map, |
6354 DependentCode::DependencyGroup group, | 6348 DependentCode::DependencyGroup group, |
6355 Handle<Code> code); | 6349 Handle<Code> code); |
6356 | 6350 |
6357 bool IsMapInArrayPrototypeChain(); | 6351 bool IsMapInArrayPrototypeChain(); |
6358 | 6352 |
6359 static Handle<WeakCell> WeakCellForMap(Handle<Map> map); | 6353 static Handle<WeakCell> WeakCellForMap(Handle<Map> map); |
6360 | 6354 |
6361 // Dispatched behavior. | 6355 // Dispatched behavior. |
6362 DECLARE_PRINTER(Map) | 6356 DECLARE_PRINTER(Map) |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8545 bool SitePointsToLiteral() { | 8539 bool SitePointsToLiteral() { |
8546 // If transition_info is a smi, then it represents an ElementsKind | 8540 // If transition_info is a smi, then it represents an ElementsKind |
8547 // for a constructed array. Otherwise, it must be a boilerplate | 8541 // for a constructed array. Otherwise, it must be a boilerplate |
8548 // for an object or array literal. | 8542 // for an object or array literal. |
8549 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8543 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
8550 } | 8544 } |
8551 | 8545 |
8552 static void DigestTransitionFeedback(Handle<AllocationSite> site, | 8546 static void DigestTransitionFeedback(Handle<AllocationSite> site, |
8553 ElementsKind to_kind); | 8547 ElementsKind to_kind); |
8554 | 8548 |
8555 static void RegisterForDeoptOnTenureChange(Handle<AllocationSite> site, | |
8556 CompilationInfo* info); | |
8557 | |
8558 static void RegisterForDeoptOnTransitionChange(Handle<AllocationSite> site, | |
8559 CompilationInfo* info); | |
8560 | |
8561 DECLARE_PRINTER(AllocationSite) | 8549 DECLARE_PRINTER(AllocationSite) |
8562 DECLARE_VERIFIER(AllocationSite) | 8550 DECLARE_VERIFIER(AllocationSite) |
8563 | 8551 |
8564 DECLARE_CAST(AllocationSite) | 8552 DECLARE_CAST(AllocationSite) |
8565 static inline AllocationSiteMode GetMode( | 8553 static inline AllocationSiteMode GetMode( |
8566 ElementsKind boilerplate_elements_kind); | 8554 ElementsKind boilerplate_elements_kind); |
8567 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8555 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
8568 static inline bool CanTrack(InstanceType type); | 8556 static inline bool CanTrack(InstanceType type); |
8569 | 8557 |
8570 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 8558 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
(...skipping 10 matching lines...) Expand all Loading... |
8581 // field. | 8569 // field. |
8582 static const int kPointerFieldsBeginOffset = kTransitionInfoOffset; | 8570 static const int kPointerFieldsBeginOffset = kTransitionInfoOffset; |
8583 static const int kPointerFieldsEndOffset = kWeakNextOffset; | 8571 static const int kPointerFieldsEndOffset = kWeakNextOffset; |
8584 | 8572 |
8585 // For other visitors, use the fixed body descriptor below. | 8573 // For other visitors, use the fixed body descriptor below. |
8586 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 8574 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
8587 kDependentCodeOffset + kPointerSize, | 8575 kDependentCodeOffset + kPointerSize, |
8588 kSize> BodyDescriptor; | 8576 kSize> BodyDescriptor; |
8589 | 8577 |
8590 private: | 8578 private: |
8591 static void AddDependentCompilationInfo(Handle<AllocationSite> site, | |
8592 DependentCode::DependencyGroup group, | |
8593 CompilationInfo* info); | |
8594 | |
8595 bool PretenuringDecisionMade() { | 8579 bool PretenuringDecisionMade() { |
8596 return pretenure_decision() != kUndecided; | 8580 return pretenure_decision() != kUndecided; |
8597 } | 8581 } |
8598 | 8582 |
8599 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 8583 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
8600 }; | 8584 }; |
8601 | 8585 |
8602 | 8586 |
8603 class AllocationMemento: public Struct { | 8587 class AllocationMemento: public Struct { |
8604 public: | 8588 public: |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9817 static PropertyCellType UpdatedType(Handle<PropertyCell> cell, | 9801 static PropertyCellType UpdatedType(Handle<PropertyCell> cell, |
9818 Handle<Object> value, | 9802 Handle<Object> value, |
9819 PropertyDetails details); | 9803 PropertyDetails details); |
9820 static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry, | 9804 static Handle<Object> UpdateCell(Handle<NameDictionary> dictionary, int entry, |
9821 Handle<Object> value, | 9805 Handle<Object> value, |
9822 PropertyDetails details); | 9806 PropertyDetails details); |
9823 | 9807 |
9824 static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary, | 9808 static Handle<PropertyCell> InvalidateEntry(Handle<NameDictionary> dictionary, |
9825 int entry); | 9809 int entry); |
9826 | 9810 |
9827 static void AddDependentCompilationInfo(Handle<PropertyCell> cell, | |
9828 CompilationInfo* info); | |
9829 | |
9830 DECLARE_CAST(PropertyCell) | 9811 DECLARE_CAST(PropertyCell) |
9831 | 9812 |
9832 // Dispatched behavior. | 9813 // Dispatched behavior. |
9833 DECLARE_PRINTER(PropertyCell) | 9814 DECLARE_PRINTER(PropertyCell) |
9834 DECLARE_VERIFIER(PropertyCell) | 9815 DECLARE_VERIFIER(PropertyCell) |
9835 | 9816 |
9836 // Layout description. | 9817 // Layout description. |
9837 static const int kValueOffset = HeapObject::kHeaderSize; | 9818 static const int kValueOffset = HeapObject::kHeaderSize; |
9838 static const int kDependentCodeOffset = kValueOffset + kPointerSize; | 9819 static const int kDependentCodeOffset = kValueOffset + kPointerSize; |
9839 static const int kSize = kDependentCodeOffset + kPointerSize; | 9820 static const int kSize = kDependentCodeOffset + kPointerSize; |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11075 } else { | 11056 } else { |
11076 value &= ~(1 << bit_position); | 11057 value &= ~(1 << bit_position); |
11077 } | 11058 } |
11078 return value; | 11059 return value; |
11079 } | 11060 } |
11080 }; | 11061 }; |
11081 | 11062 |
11082 } } // namespace v8::internal | 11063 } } // namespace v8::internal |
11083 | 11064 |
11084 #endif // V8_OBJECTS_H_ | 11065 #endif // V8_OBJECTS_H_ |
OLD | NEW |