Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index d17d0d1ef1c851e08dca8eb5b1cfa8a812f04660..cdac7471750fd72d9ef01c4e9ec2954af19a15c9 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -5661,12 +5661,21 @@ class Map: public HeapObject { |
| class IsFrozen : public BitField<bool, 24, 1> {}; |
| class IsUnstable : public BitField<bool, 25, 1> {}; |
| class IsMigrationTarget : public BitField<bool, 26, 1> {}; |
| - class DoneInobjectSlackTracking : public BitField<bool, 27, 1> {}; |
| - // Bit 28 is free. |
| + // Bit 27 is free. |
| // Keep this bit field at the very end for better code in |
| // Builtins::kJSConstructStubGeneric stub. |
| - class ConstructionCount: public BitField<int, 29, 3> {}; |
| + class Counter : public BitField<bool, 28, 4> {}; |
| + static const int kSlackTrackingCounterStart = 15; |
| + static const int kSlackTrackingCounterEnd = 1 << (Counter::kSize - 1); |
| + static const int kRetainingCounterStart = kSlackTrackingCounterEnd - 1; |
|
ulan
2014/12/02 11:41:04
This counter will be used in future CL.
|
| + static const int kRetainingCounterEnd = 0; |
| + STATIC_ASSERT((kSlackTrackingCounterStart >> (Counter::kSize - 1)) == |
| + (kSlackTrackingCounterEnd >> (Counter::kSize - 1))); |
| + STATIC_ASSERT((kRetainingCounterStart >> (Counter::kSize - 1)) == |
| + (kRetainingCounterEnd >> (Counter::kSize - 1))); |
| + STATIC_ASSERT((kSlackTrackingCounterEnd >> (Counter::kSize - 1)) != |
| + (kRetainingCounterEnd >> (Counter::kSize - 1))); |
| // Tells whether the object in the prototype property will be used |
| // for instances created from this function. If the prototype |
| @@ -6008,10 +6017,8 @@ class Map: public HeapObject { |
| inline bool is_stable(); |
| inline void set_migration_target(bool value); |
| inline bool is_migration_target(); |
| - inline void set_done_inobject_slack_tracking(bool value); |
| - inline bool done_inobject_slack_tracking(); |
| - inline void set_construction_count(int value); |
| - inline int construction_count(); |
| + inline void set_counter(int value); |
| + inline int counter(); |
| inline void deprecate(); |
| inline bool is_deprecated(); |
| inline bool CanBeDeprecated(); |
| @@ -7360,13 +7367,13 @@ class JSFunction: public JSObject { |
| // Here is the algorithm to reclaim the unused inobject space: |
| // - Detect the first constructor call for this JSFunction. |
| // When it happens enter the "in progress" state: initialize construction |
| - // counter in the initial_map and set the |done_inobject_slack_tracking| |
| + // counter in the initial_map and clear the |is_inobject_slack_tracking_off| |
| // flag. |
| // - While the tracking is in progress create objects filled with |
| // one_pointer_filler_map instead of undefined_value. This way they can be |
| // resized quickly and safely. |
| - // - Once enough (kGenerousAllocationCount) objects have been created |
| - // compute the 'slack' (traverse the map transition tree starting from the |
| + // - Once enough objects have been created compute the 'slack' |
| + // (traverse the map transition tree starting from the |
| // initial_map and find the lowest value of unused_property_fields). |
| // - Traverse the transition tree again and decrease the instance size |
| // of every map. Existing objects will resize automatically (they are |
| @@ -7379,23 +7386,17 @@ class JSFunction: public JSObject { |
| // Important: inobject slack tracking is not attempted during the snapshot |
| // creation. |
| - static const int kGenerousAllocationCount = Map::ConstructionCount::kMax; |
| - static const int kFinishSlackTracking = 1; |
| - static const int kNoSlackTracking = 0; |
| - |
| // True if the initial_map is set and the object constructions countdown |
| // counter is not zero. |
| + static const int kGenerousAllocationCount = |
| + Map::kSlackTrackingCounterStart - Map::kSlackTrackingCounterEnd; |
| inline bool IsInobjectSlackTrackingInProgress(); |
| // Starts the tracking. |
| // Initializes object constructions countdown counter in the initial map. |
| - // IsInobjectSlackTrackingInProgress is normally true after this call, |
| - // except when tracking have not been started (e.g. the map has no unused |
| - // properties or the snapshot is being built). |
| void StartInobjectSlackTracking(); |
| // Completes the tracking. |
| - // IsInobjectSlackTrackingInProgress is false after this call. |
| void CompleteInobjectSlackTracking(); |
| // [literals_or_bindings]: Fixed array holding either |