Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 1f6e7cc0878c87a8630b77f4e05bd40f7d89cc18..f86190a2cdfb861e07d26498965f5a042fdc5835 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -862,7 +862,7 @@ class MaybeObject BASE_EMBEDDED { |
| V(TransitionArray) \ |
| V(DeoptimizationInputData) \ |
| V(DeoptimizationOutputData) \ |
| - V(DependentCodes) \ |
| + V(DependentCode) \ |
| V(TypeFeedbackCells) \ |
| V(FixedArray) \ |
| V(FixedDoubleArray) \ |
| @@ -4695,32 +4695,43 @@ class Code: public HeapObject { |
| // in the corresponding group. The subsequent elements contain grouped code |
| // objects. The suffix of the array can be filled with the undefined value if |
| // the number of codes is less than the length of the array. |
| -// |
| +// |
| // All code indexes used in the class are counted starting from the first |
| // code object of the first group. In other words, code index 0 corresponds |
| // to array index n = kCodesStartIndex. |
| -class DependentCodes: public FixedArray { |
| +class DependentCode: public FixedArray { |
| public: |
| enum DependencyGroup { |
| // Group of codes that weakly embed this map and depend on being |
|
Toon Verwaest
2013/02/13 15:18:25
Group of code
ulan
2013/02/14 09:30:46
Done.
|
| // deoptimized when the map is garbage collected. |
| kWeaklyEmbeddedGroup, |
| - kGroupCount = kWeaklyEmbeddedGroup + 1 |
| + // Group of code that omit run-time prototype checks for prototypes |
| + // described by this map. The group is deoptimized whenever an object |
| + // described by this map changes shape (and transitions to a new map), |
| + // possibly invalidating the assumptions embedded in the code. |
| + kPrototypeCheckGroup, |
| + kGroupCount = kPrototypeCheckGroup + 1 |
| }; |
| // Array for holding the index of the first code object of each group. |
| // The last element stores the total number of code objects. |
| - typedef int GroupStartIndexes[kGroupCount + 1]; |
| + class GroupStartIndexes { |
| + public: |
| + explicit GroupStartIndexes(DependentCode* codes); |
| + void Recompute(DependentCode* codes); |
| + int at(int i) { return start_indexes_[i]; } |
| + private: |
| + int start_indexes_[kGroupCount + 1]; |
| + }; |
| inline int number_of_codes(DependencyGroup group); |
| inline void set_number_of_codes(DependencyGroup group, int value); |
| inline Code* code_at(int i); |
| inline void set_code_at(int i, Code* value); |
| inline Object** code_slot_at(int i); |
| inline void clear_code_at(int i); |
| - static inline DependentCodes* cast(Object* object); |
| - inline void ComputeGroupStartIndexes(GroupStartIndexes starts); |
| + static inline DependentCode* cast(Object* object); |
| bool Contains(DependencyGroup group, Code* code); |
| - static Handle<DependentCodes> Insert(Handle<DependentCodes> codes, |
| + static Handle<DependentCode> Insert(Handle<DependentCode> codes, |
| DependencyGroup group, |
| Handle<Code> value); |
| @@ -4962,7 +4973,7 @@ class Map: public HeapObject { |
| DECL_ACCESSORS(code_cache, Object) |
| // [dependent codes]: list of optimized codes that have this map embedded. |
| - DECL_ACCESSORS(dependent_codes, DependentCodes) |
| + DECL_ACCESSORS(dependent_code, DependentCode) |
| // [back pointer]: points back to the parent map from which a transition |
| // leads to this map. The field overlaps with prototype transitions and the |
| @@ -5179,9 +5190,16 @@ class Map: public HeapObject { |
| return instance_type() >= FIRST_JS_OBJECT_TYPE; |
| } |
| - inline void AddDependentCode(DependentCodes::DependencyGroup group, |
| + |
| + inline void NotifyObjectLayoutChange(); |
| + |
| + inline bool CanOmitPrototypeChecks(); |
| + |
| + inline void AddDependentCode(DependentCode::DependencyGroup group, |
| Handle<Code> code); |
| + void DeoptimizeDependentCode(DependentCode::DependencyGroup group); |
| + |
| // Dispatched behavior. |
| DECLARE_PRINTER(Map) |
| DECLARE_VERIFIER(Map) |
| @@ -5230,8 +5248,8 @@ class Map: public HeapObject { |
| static const int kDescriptorsOffset = |
| kTransitionsOrBackPointerOffset + kPointerSize; |
| static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; |
| - static const int kDependentCodesOffset = kCodeCacheOffset + kPointerSize; |
| - static const int kBitField3Offset = kDependentCodesOffset + kPointerSize; |
| + static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; |
| + static const int kBitField3Offset = kDependentCodeOffset + kPointerSize; |
| static const int kSize = kBitField3Offset + kPointerSize; |
| // Layout of pointer fields. Heap iteration code relies on them |