| 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 5547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5558 // described by this map. The group is deoptimized whenever an object | 5558 // described by this map. The group is deoptimized whenever an object |
| 5559 // described by this map changes shape (and transitions to a new map), | 5559 // described by this map changes shape (and transitions to a new map), |
| 5560 // possibly invalidating the assumptions embedded in the code. | 5560 // possibly invalidating the assumptions embedded in the code. |
| 5561 kPrototypeCheckGroup, | 5561 kPrototypeCheckGroup, |
| 5562 // Group of code that depends on elements not being added to objects with | 5562 // Group of code that depends on elements not being added to objects with |
| 5563 // this map. | 5563 // this map. |
| 5564 kElementsCantBeAddedGroup, | 5564 kElementsCantBeAddedGroup, |
| 5565 // Group of code that depends on global property values in property cells | 5565 // Group of code that depends on global property values in property cells |
| 5566 // not being changed. | 5566 // not being changed. |
| 5567 kPropertyCellChangedGroup, | 5567 kPropertyCellChangedGroup, |
| 5568 kGroupCount = kPropertyCellChangedGroup + 1 | 5568 // Group of code that depends on tenuring information in AllocationSites |
| 5569 // not being changed. |
| 5570 kAllocationSiteTenuringChangedGroup, |
| 5571 // Group of code that depends on element transition information in |
| 5572 // AllocationSites not being changed. |
| 5573 kAllocationSiteTransitionChangedGroup, |
| 5574 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 |
| 5569 }; | 5575 }; |
| 5570 | 5576 |
| 5571 // Array for holding the index of the first code object of each group. | 5577 // Array for holding the index of the first code object of each group. |
| 5572 // The last element stores the total number of code objects. | 5578 // The last element stores the total number of code objects. |
| 5573 class GroupStartIndexes { | 5579 class GroupStartIndexes { |
| 5574 public: | 5580 public: |
| 5575 explicit GroupStartIndexes(DependentCode* entries); | 5581 explicit GroupStartIndexes(DependentCode* entries); |
| 5576 void Recompute(DependentCode* entries); | 5582 void Recompute(DependentCode* entries); |
| 5577 int at(int i) { return start_indexes_[i]; } | 5583 int at(int i) { return start_indexes_[i]; } |
| 5578 int number_of_entries() { return start_indexes_[kGroupCount]; } | 5584 int number_of_entries() { return start_indexes_[kGroupCount]; } |
| (...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8080 | 8086 |
| 8081 inline void Initialize(); | 8087 inline void Initialize(); |
| 8082 | 8088 |
| 8083 bool HasNestedSites() { | 8089 bool HasNestedSites() { |
| 8084 return nested_site()->IsAllocationSite(); | 8090 return nested_site()->IsAllocationSite(); |
| 8085 } | 8091 } |
| 8086 | 8092 |
| 8087 // This method is expensive, it should only be called for reporting. | 8093 // This method is expensive, it should only be called for reporting. |
| 8088 bool IsNestedSite(); | 8094 bool IsNestedSite(); |
| 8089 | 8095 |
| 8096 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {}; |
| 8097 class UnusedBits: public BitField<int, 15, 14> {}; |
| 8098 class DoNotInlineBit: public BitField<bool, 29, 1> {}; |
| 8099 |
| 8090 ElementsKind GetElementsKind() { | 8100 ElementsKind GetElementsKind() { |
| 8091 ASSERT(!SitePointsToLiteral()); | 8101 ASSERT(!SitePointsToLiteral()); |
| 8092 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 8102 int value = Smi::cast(transition_info())->value(); |
| 8103 return ElementsKindBits::decode(value); |
| 8093 } | 8104 } |
| 8094 | 8105 |
| 8095 void SetElementsKind(ElementsKind kind) { | 8106 void SetElementsKind(ElementsKind kind) { |
| 8096 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 8107 int value = Smi::cast(transition_info())->value(); |
| 8108 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)), |
| 8109 SKIP_WRITE_BARRIER); |
| 8110 } |
| 8111 |
| 8112 bool CanInlineCall() { |
| 8113 int value = Smi::cast(transition_info())->value(); |
| 8114 return DoNotInlineBit::decode(value) == 0; |
| 8115 } |
| 8116 |
| 8117 void SetDoNotInlineCall() { |
| 8118 int value = Smi::cast(transition_info())->value(); |
| 8119 set_transition_info(Smi::FromInt(DoNotInlineBit::update(value, true)), |
| 8120 SKIP_WRITE_BARRIER); |
| 8097 } | 8121 } |
| 8098 | 8122 |
| 8099 bool SitePointsToLiteral() { | 8123 bool SitePointsToLiteral() { |
| 8100 // If transition_info is a smi, then it represents an ElementsKind | 8124 // If transition_info is a smi, then it represents an ElementsKind |
| 8101 // for a constructed array. Otherwise, it must be a boilerplate | 8125 // for a constructed array. Otherwise, it must be a boilerplate |
| 8102 // for an object or array literal. | 8126 // for an object or array literal. |
| 8103 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8127 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
| 8104 } | 8128 } |
| 8105 | 8129 |
| 8130 MaybeObject* DigestTransitionFeedback(ElementsKind to_kind); |
| 8131 |
| 8132 enum Reason { |
| 8133 TENURING, |
| 8134 TRANSITIONS |
| 8135 }; |
| 8136 |
| 8137 void AddDependentCompilationInfo(Reason reason, CompilationInfo* info); |
| 8138 void AddDependentCode(Reason reason, Handle<Code> code); |
| 8139 |
| 8106 DECLARE_PRINTER(AllocationSite) | 8140 DECLARE_PRINTER(AllocationSite) |
| 8107 DECLARE_VERIFIER(AllocationSite) | 8141 DECLARE_VERIFIER(AllocationSite) |
| 8108 | 8142 |
| 8109 static inline AllocationSite* cast(Object* obj); | 8143 static inline AllocationSite* cast(Object* obj); |
| 8110 static inline AllocationSiteMode GetMode( | 8144 static inline AllocationSiteMode GetMode( |
| 8111 ElementsKind boilerplate_elements_kind); | 8145 ElementsKind boilerplate_elements_kind); |
| 8112 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8146 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 8113 static inline bool CanTrack(InstanceType type); | 8147 static inline bool CanTrack(InstanceType type); |
| 8114 | 8148 |
| 8115 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 8149 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
| 8116 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; | 8150 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; |
| 8117 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; | 8151 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; |
| 8118 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; | 8152 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
| 8119 static const int kSize = kWeakNextOffset + kPointerSize; | 8153 static const int kSize = kWeakNextOffset + kPointerSize; |
| 8120 | 8154 |
| 8121 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 8155 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
| 8122 kDependentCodeOffset + kPointerSize, | 8156 kDependentCodeOffset + kPointerSize, |
| 8123 kSize> BodyDescriptor; | 8157 kSize> BodyDescriptor; |
| 8124 | 8158 |
| 8125 private: | 8159 private: |
| 8160 inline DependentCode::DependencyGroup ToDependencyGroup(Reason reason); |
| 8126 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 8161 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
| 8127 }; | 8162 }; |
| 8128 | 8163 |
| 8129 | 8164 |
| 8130 class AllocationMemento: public Struct { | 8165 class AllocationMemento: public Struct { |
| 8131 public: | 8166 public: |
| 8132 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 8167 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
| 8133 static const int kSize = kAllocationSiteOffset + kPointerSize; | 8168 static const int kSize = kAllocationSiteOffset + kPointerSize; |
| 8134 | 8169 |
| 8135 DECL_ACCESSORS(allocation_site, Object) | 8170 DECL_ACCESSORS(allocation_site, Object) |
| (...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10488 } else { | 10523 } else { |
| 10489 value &= ~(1 << bit_position); | 10524 value &= ~(1 << bit_position); |
| 10490 } | 10525 } |
| 10491 return value; | 10526 return value; |
| 10492 } | 10527 } |
| 10493 }; | 10528 }; |
| 10494 | 10529 |
| 10495 } } // namespace v8::internal | 10530 } } // namespace v8::internal |
| 10496 | 10531 |
| 10497 #endif // V8_OBJECTS_H_ | 10532 #endif // V8_OBJECTS_H_ |
| OLD | NEW |