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 5545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5556 // described by this map. The group is deoptimized whenever an object | 5556 // described by this map. The group is deoptimized whenever an object |
5557 // described by this map changes shape (and transitions to a new map), | 5557 // described by this map changes shape (and transitions to a new map), |
5558 // possibly invalidating the assumptions embedded in the code. | 5558 // possibly invalidating the assumptions embedded in the code. |
5559 kPrototypeCheckGroup, | 5559 kPrototypeCheckGroup, |
5560 // Group of code that depends on elements not being added to objects with | 5560 // Group of code that depends on elements not being added to objects with |
5561 // this map. | 5561 // this map. |
5562 kElementsCantBeAddedGroup, | 5562 kElementsCantBeAddedGroup, |
5563 // Group of code that depends on global property values in property cells | 5563 // Group of code that depends on global property values in property cells |
5564 // not being changed. | 5564 // not being changed. |
5565 kPropertyCellChangedGroup, | 5565 kPropertyCellChangedGroup, |
5566 kGroupCount = kPropertyCellChangedGroup + 1 | 5566 // Group of code that depends on tenuring information in AllocationSites |
5567 // not being changed. | |
5568 kAllocationSiteTenuringChangedGroup, | |
5569 // Group of code that depends on element transition information in | |
5570 // AllocationSites not being changed. | |
5571 kAllocationSiteTransitionChangedGroup, | |
5572 kGroupCount = kAllocationSiteTransitionChangedGroup + 1 | |
5567 }; | 5573 }; |
5568 | 5574 |
5569 // Array for holding the index of the first code object of each group. | 5575 // Array for holding the index of the first code object of each group. |
5570 // The last element stores the total number of code objects. | 5576 // The last element stores the total number of code objects. |
5571 class GroupStartIndexes { | 5577 class GroupStartIndexes { |
5572 public: | 5578 public: |
5573 explicit GroupStartIndexes(DependentCode* entries); | 5579 explicit GroupStartIndexes(DependentCode* entries); |
5574 void Recompute(DependentCode* entries); | 5580 void Recompute(DependentCode* entries); |
5575 int at(int i) { return start_indexes_[i]; } | 5581 int at(int i) { return start_indexes_[i]; } |
5576 int number_of_entries() { return start_indexes_[kGroupCount]; } | 5582 int number_of_entries() { return start_indexes_[kGroupCount]; } |
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8070 | 8076 |
8071 inline void Initialize(); | 8077 inline void Initialize(); |
8072 | 8078 |
8073 bool HasNestedSites() { | 8079 bool HasNestedSites() { |
8074 return nested_site()->IsAllocationSite(); | 8080 return nested_site()->IsAllocationSite(); |
8075 } | 8081 } |
8076 | 8082 |
8077 // This method is expensive, it should only be called for reporting. | 8083 // This method is expensive, it should only be called for reporting. |
8078 bool IsNestedSite(); | 8084 bool IsNestedSite(); |
8079 | 8085 |
8086 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {}; | |
8087 class UnusedBits: public BitField<int, 15, 14> {}; | |
8088 class DoNotInlineBit: public BitField<bool, 29, 1> {}; | |
8089 | |
8080 ElementsKind GetElementsKind() { | 8090 ElementsKind GetElementsKind() { |
8081 ASSERT(!SitePointsToLiteral()); | 8091 ASSERT(!SitePointsToLiteral()); |
8082 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 8092 int value = Smi::cast(transition_info())->value(); |
8093 return ElementsKindBits::decode(value); | |
8083 } | 8094 } |
8084 | 8095 |
8085 void SetElementsKind(ElementsKind kind) { | 8096 void SetElementsKind(ElementsKind kind) { |
8086 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 8097 int value = Smi::cast(transition_info())->value(); |
8098 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)), | |
8099 SKIP_WRITE_BARRIER); | |
8100 } | |
8101 | |
8102 bool CanInlineCall() { | |
8103 int value = Smi::cast(transition_info())->value(); | |
8104 return DoNotInlineBit::decode(value) == 0; | |
8105 } | |
8106 | |
8107 void SetDoNotInlineCall() { | |
8108 int value = Smi::cast(transition_info())->value(); | |
8109 value |= (1 << 16); | |
Toon Verwaest
2013/11/11 13:59:28
Remove the line above.
mvstanton
2013/11/13 14:12:52
oops!
| |
8110 set_transition_info(Smi::FromInt(DoNotInlineBit::update(value, true)), | |
8111 SKIP_WRITE_BARRIER); | |
8087 } | 8112 } |
8088 | 8113 |
8089 bool SitePointsToLiteral() { | 8114 bool SitePointsToLiteral() { |
8090 // If transition_info is a smi, then it represents an ElementsKind | 8115 // If transition_info is a smi, then it represents an ElementsKind |
8091 // for a constructed array. Otherwise, it must be a boilerplate | 8116 // for a constructed array. Otherwise, it must be a boilerplate |
8092 // for an object or array literal. | 8117 // for an object or array literal. |
8093 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8118 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
8094 } | 8119 } |
8095 | 8120 |
8121 MaybeObject* DigestTransitionFeedback(ElementsKind to_kind); | |
8122 | |
8123 enum Reason { | |
8124 TENURING, | |
8125 TRANSITIONS | |
8126 }; | |
8127 | |
8128 void AddDependentCompilationInfo(Reason reason, CompilationInfo* info); | |
8129 void AddDependentCode(Reason reason, Handle<Code> code); | |
8130 | |
8096 DECLARE_PRINTER(AllocationSite) | 8131 DECLARE_PRINTER(AllocationSite) |
8097 DECLARE_VERIFIER(AllocationSite) | 8132 DECLARE_VERIFIER(AllocationSite) |
8098 | 8133 |
8099 static inline AllocationSite* cast(Object* obj); | 8134 static inline AllocationSite* cast(Object* obj); |
8100 static inline AllocationSiteMode GetMode( | 8135 static inline AllocationSiteMode GetMode( |
8101 ElementsKind boilerplate_elements_kind); | 8136 ElementsKind boilerplate_elements_kind); |
8102 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8137 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
8103 static inline bool CanTrack(InstanceType type); | 8138 static inline bool CanTrack(InstanceType type); |
8104 | 8139 |
8105 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 8140 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
8106 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; | 8141 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; |
8107 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; | 8142 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; |
8108 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; | 8143 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
8109 static const int kSize = kWeakNextOffset + kPointerSize; | 8144 static const int kSize = kWeakNextOffset + kPointerSize; |
8110 | 8145 |
8111 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 8146 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
8112 kDependentCodeOffset + kPointerSize, | 8147 kDependentCodeOffset + kPointerSize, |
8113 kSize> BodyDescriptor; | 8148 kSize> BodyDescriptor; |
8114 | 8149 |
8115 private: | 8150 private: |
8151 inline DependentCode::DependencyGroup ToDependencyGroup(Reason reason); | |
8116 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 8152 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
8117 }; | 8153 }; |
8118 | 8154 |
8119 | 8155 |
8120 class AllocationMemento: public Struct { | 8156 class AllocationMemento: public Struct { |
8121 public: | 8157 public: |
8122 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 8158 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
8123 static const int kSize = kAllocationSiteOffset + kPointerSize; | 8159 static const int kSize = kAllocationSiteOffset + kPointerSize; |
8124 | 8160 |
8125 DECL_ACCESSORS(allocation_site, Object) | 8161 DECL_ACCESSORS(allocation_site, Object) |
(...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10472 } else { | 10508 } else { |
10473 value &= ~(1 << bit_position); | 10509 value &= ~(1 << bit_position); |
10474 } | 10510 } |
10475 return value; | 10511 return value; |
10476 } | 10512 } |
10477 }; | 10513 }; |
10478 | 10514 |
10479 } } // namespace v8::internal | 10515 } } // namespace v8::internal |
10480 | 10516 |
10481 #endif // V8_OBJECTS_H_ | 10517 #endif // V8_OBJECTS_H_ |
OLD | NEW |