Chromium Code Reviews| 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 static const int kElementsKindMask = 0xffff; | |
|
Toon Verwaest
2013/11/06 16:42:44
Is there a reason why you don't use BitFields?
mvstanton
2013/11/07 16:34:05
Nope, now I do, thx!
| |
| 8087 static const int kFlagsMask = 0x7fff0000; | |
| 8088 | |
| 8080 ElementsKind GetElementsKind() { | 8089 ElementsKind GetElementsKind() { |
| 8081 ASSERT(!SitePointsToLiteral()); | 8090 ASSERT(!SitePointsToLiteral()); |
| 8082 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 8091 int value = Smi::cast(transition_info())->value(); |
| 8092 value = value & kElementsKindMask; | |
| 8093 return static_cast<ElementsKind>(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 value = (value & kFlagsMask) | static_cast<int>(kind); | |
| 8099 set_transition_info(Smi::FromInt(value)); | |
| 8100 } | |
| 8101 | |
| 8102 bool DoNotInlineCall() { | |
| 8103 int value = Smi::cast(transition_info())->value(); | |
| 8104 return (value & kFlagsMask) != 0; | |
| 8105 } | |
| 8106 | |
| 8107 void SetDoNotInlineCall() { | |
| 8108 int value = Smi::cast(transition_info())->value(); | |
| 8109 value |= (1 << 16); | |
| 8110 set_transition_info(Smi::FromInt(value)); | |
| 8087 } | 8111 } |
| 8088 | 8112 |
| 8089 bool SitePointsToLiteral() { | 8113 bool SitePointsToLiteral() { |
| 8090 // If transition_info is a smi, then it represents an ElementsKind | 8114 // If transition_info is a smi, then it represents an ElementsKind |
| 8091 // for a constructed array. Otherwise, it must be a boilerplate | 8115 // for a constructed array. Otherwise, it must be a boilerplate |
| 8092 // for an object or array literal. | 8116 // for an object or array literal. |
| 8093 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8117 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
| 8094 } | 8118 } |
| 8095 | 8119 |
| 8120 MaybeObject* DigestTransitionFeedback(ElementsKind to_kind); | |
| 8121 | |
| 8122 enum Reason { | |
| 8123 TENURING, | |
| 8124 TRANSITIONS | |
| 8125 }; | |
| 8126 | |
| 8127 void AddDependentCompilationInfo(Reason reason, CompilationInfo* info); | |
| 8128 void AddDependentCode(Reason reason, Handle<Code> code); | |
| 8129 | |
| 8096 DECLARE_PRINTER(AllocationSite) | 8130 DECLARE_PRINTER(AllocationSite) |
| 8097 DECLARE_VERIFIER(AllocationSite) | 8131 DECLARE_VERIFIER(AllocationSite) |
| 8098 | 8132 |
| 8099 static inline AllocationSite* cast(Object* obj); | 8133 static inline AllocationSite* cast(Object* obj); |
| 8100 static inline AllocationSiteMode GetMode( | 8134 static inline AllocationSiteMode GetMode( |
| 8101 ElementsKind boilerplate_elements_kind); | 8135 ElementsKind boilerplate_elements_kind); |
| 8102 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 8136 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 8103 static inline bool CanTrack(InstanceType type); | 8137 static inline bool CanTrack(InstanceType type); |
| 8104 | 8138 |
| 8105 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | 8139 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
| 8106 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; | 8140 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; |
| 8107 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; | 8141 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; |
| 8108 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; | 8142 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; |
| 8109 static const int kSize = kWeakNextOffset + kPointerSize; | 8143 static const int kSize = kWeakNextOffset + kPointerSize; |
| 8110 | 8144 |
| 8111 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, | 8145 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
| 8112 kDependentCodeOffset + kPointerSize, | 8146 kDependentCodeOffset + kPointerSize, |
| 8113 kSize> BodyDescriptor; | 8147 kSize> BodyDescriptor; |
| 8114 | 8148 |
| 8115 private: | 8149 private: |
| 8150 inline DependentCode::DependencyGroup ToDependencyGroup(Reason reason); | |
| 8116 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 8151 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
| 8117 }; | 8152 }; |
| 8118 | 8153 |
| 8119 | 8154 |
| 8120 class AllocationMemento: public Struct { | 8155 class AllocationMemento: public Struct { |
| 8121 public: | 8156 public: |
| 8122 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 8157 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
| 8123 static const int kSize = kAllocationSiteOffset + kPointerSize; | 8158 static const int kSize = kAllocationSiteOffset + kPointerSize; |
| 8124 | 8159 |
| 8125 DECL_ACCESSORS(allocation_site, Object) | 8160 DECL_ACCESSORS(allocation_site, Object) |
| (...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10472 } else { | 10507 } else { |
| 10473 value &= ~(1 << bit_position); | 10508 value &= ~(1 << bit_position); |
| 10474 } | 10509 } |
| 10475 return value; | 10510 return value; |
| 10476 } | 10511 } |
| 10477 }; | 10512 }; |
| 10478 | 10513 |
| 10479 } } // namespace v8::internal | 10514 } } // namespace v8::internal |
| 10480 | 10515 |
| 10481 #endif // V8_OBJECTS_H_ | 10516 #endif // V8_OBJECTS_H_ |
| OLD | NEW |