Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index e8e20e9a3fe9bf0374bfd07a58562b73a31cb9ab..924947308ea3836dbae29897310759a1f3bbb0ba 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -5314,6 +5314,16 @@ class Code: public HeapObject { |
inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } |
inline bool is_keyed_stub(); |
inline bool is_optimized_code() { return kind() == OPTIMIZED_FUNCTION; } |
+ inline bool can_be_weak_stub() { |
+ Kind k = kind(); |
+ return (k == LOAD_IC || k == STORE_IC || k == KEYED_LOAD_IC || |
+ k == KEYED_STORE_IC || k == COMPARE_NIL_IC) && |
+ ic_state() == MONOMORPHIC; |
+ } |
+ inline bool is_weak_stub(); |
+ inline void mark_as_weak_stub(); |
+ inline bool is_invalidated_weak_stub(); |
+ inline void mark_as_invalidated_weak_stub(); |
inline void set_raw_kind_specific_flags1(int value); |
inline void set_raw_kind_specific_flags2(int value); |
@@ -5571,11 +5581,17 @@ class Code: public HeapObject { |
void VerifyEmbeddedObjectsDependency(); |
#endif |
+ inline bool CanContainWeakObjects() { |
+ return is_optimized_code() || is_weak_stub(); |
+ } |
+ |
inline bool IsWeakObject(Object* object) { |
- return is_optimized_code() && IsWeakObjectInOptimizedCode(object); |
+ return (is_optimized_code() && IsWeakObjectInOptimizedCode(object)) || |
+ (is_weak_stub() && IsWeakObjectInIC(object)); |
} |
inline bool IsWeakObjectInOptimizedCode(Object* object); |
+ inline bool IsWeakObjectInIC(Object* object); |
// Max loop nesting marker used to postpose OSR. We don't take loop |
// nesting that is deeper than 5 levels into account. |
@@ -5638,11 +5654,17 @@ class Code: public HeapObject { |
static const int kMarkedForDeoptimizationFirstBit = |
kStackSlotsFirstBit + kStackSlotsBitCount + 1; |
static const int kMarkedForDeoptimizationBitCount = 1; |
+ static const int kWeakStubFirstBit = |
+ kMarkedForDeoptimizationFirstBit + kMarkedForDeoptimizationBitCount; |
+ static const int kWeakStubBitCount = 1; |
+ static const int kInvalidatedWeakStubFirstBit = |
+ kWeakStubFirstBit + kWeakStubBitCount; |
+ static const int kInvalidatedWeakStubBitCount = 1; |
STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
STATIC_ASSERT(kHasFunctionCacheFirstBit + kHasFunctionCacheBitCount <= 32); |
- STATIC_ASSERT(kMarkedForDeoptimizationFirstBit + |
- kMarkedForDeoptimizationBitCount <= 32); |
+ STATIC_ASSERT(kInvalidatedWeakStubFirstBit + |
+ kInvalidatedWeakStubBitCount <= 32); |
class StackSlotsField: public BitField<int, |
kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT |
@@ -5651,6 +5673,12 @@ class Code: public HeapObject { |
class MarkedForDeoptimizationField: public BitField<bool, |
kMarkedForDeoptimizationFirstBit, |
kMarkedForDeoptimizationBitCount> {}; // NOLINT |
+ class WeakStubField: public BitField<bool, |
+ kWeakStubFirstBit, |
+ kWeakStubBitCount> {}; // NOLINT |
+ class InvalidatedWeakStubField: public BitField<bool, |
+ kInvalidatedWeakStubFirstBit, |
+ kInvalidatedWeakStubBitCount> {}; // NOLINT |
// KindSpecificFlags2 layout (ALL) |
static const int kIsCrankshaftedBit = 0; |
@@ -6104,9 +6132,14 @@ class Map: public HeapObject { |
// [stub cache]: contains stubs compiled for this map. |
DECL_ACCESSORS(code_cache, Object) |
- // [dependent code]: list of optimized codes that have this map embedded. |
+ // [dependent code]: list of optimized codes that weakly embed this map. |
DECL_ACCESSORS(dependent_code, DependentCode) |
+ // [depenent ic]: list of IC stubs that weakly embed this map. |
+ // This points to the head of the list or to the undefined value. |
+ // IC stubs in the list are linked using the next_code_link field. |
+ DECL_ACCESSORS(dependent_ic, Object) |
+ |
// [back pointer]: points back to the parent map from which a transition |
// leads to this map. The field overlaps with prototype transitions and the |
// back pointer will be moved into the prototype transitions array if |
@@ -6390,6 +6423,7 @@ class Map: public HeapObject { |
void AddDependentCode(DependentCode::DependencyGroup group, |
Handle<Code> code); |
+ void AddDependentIC(Handle<Code> stub); |
bool IsMapInArrayPrototypeChain(); |
@@ -6440,13 +6474,15 @@ class Map: public HeapObject { |
kTransitionsOrBackPointerOffset + kPointerSize; |
static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; |
static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; |
- static const int kBitField3Offset = kDependentCodeOffset + kPointerSize; |
+ static const int kDependentICOffset = kDependentCodeOffset + kPointerSize; |
+ static const int kBitField3Offset = kDependentICOffset + kPointerSize; |
static const int kSize = kBitField3Offset + kPointerSize; |
// Layout of pointer fields. Heap iteration code relies on them |
// being continuously allocated. |
static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
- static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize; |
+ static const int kPointerFieldsEndOffset = kDependentICOffset + kPointerSize; |
+ static const int kFirstWeakFieldOffset = kDependentICOffset; |
// Byte offsets within kInstanceSizesOffset. |
static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |